diff --git a/assets/openapi.json b/assets/openapi.json
index 6e8ba7446..ccc96457c 100644
--- a/assets/openapi.json
+++ b/assets/openapi.json
@@ -5091,7 +5091,14 @@
]
},
"poll": {
- "$ref": "#/components/schemas/PollCreationSchema"
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/PollCreationSchema"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"enforce_nonce": {
"type": "boolean"
@@ -5229,7 +5236,14 @@
]
},
"poll": {
- "$ref": "#/components/schemas/PollCreationSchema"
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/PollCreationSchema"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"flags": {
"type": "integer"
diff --git a/assets/schemas.json b/assets/schemas.json
index 2530028be..77918b905 100644
--- a/assets/schemas.json
+++ b/assets/schemas.json
@@ -5714,7 +5714,14 @@
]
},
"poll": {
- "$ref": "#/definitions/PollCreationSchema"
+ "anyOf": [
+ {
+ "$ref": "#/definitions/PollCreationSchema"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"enforce_nonce": {
"type": "boolean"
@@ -5858,7 +5865,14 @@
]
},
"poll": {
- "$ref": "#/definitions/PollCreationSchema"
+ "anyOf": [
+ {
+ "$ref": "#/definitions/PollCreationSchema"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"flags": {
"type": "integer"
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts
index 03e89d727..5f4cbf44c 100644
--- a/src/api/util/handlers/Message.ts
+++ b/src/api/util/handlers/Message.ts
@@ -317,7 +317,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
const message = Message.create({
...opts,
message_reference: opts.message_reference ?? undefined,
- poll: opts.poll,
+ poll: opts.poll ?? undefined,
sticker_items: stickers,
guild_id: channel.guild_id,
channel_id: opts.channel_id,
diff --git a/src/api/util/utility/polls.ts b/src/api/util/utility/polls.ts
index 549726c13..bc1bb9540 100644
--- a/src/api/util/utility/polls.ts
+++ b/src/api/util/utility/polls.ts
@@ -27,7 +27,7 @@ export async function generatePollResultsMessage(options: MessageOptions): Promi
const message = Message.create({
...options,
message_reference: options.message_reference ?? undefined,
- poll: options.poll,
+ poll: options.poll ?? undefined,
// sticker_items: stickers,
// guild_id: options.guild_id,
channel_id: options.channel_id,
diff --git a/src/schemas/uncategorised/MessageCreateSchema.ts b/src/schemas/uncategorised/MessageCreateSchema.ts
index 1ad0cc4a4..069e48417 100644
--- a/src/schemas/uncategorised/MessageCreateSchema.ts
+++ b/src/schemas/uncategorised/MessageCreateSchema.ts
@@ -75,14 +75,13 @@ export interface MessageCreateSchema {
file?: { filename: string };
// TODO: we should create an interface for attachments
attachments?: (MessageCreateAttachment | MessageCreateCloudAttachment)[];
- sticker_ids?: string[] | null; // null check: fixes Discord-Go
- components?: BaseMessageComponents[] | null; // null check: fixes Discord-Go
- // TODO: Fix TypeScript errors in src\api\util\handlers\Message.ts once this is enabled
- poll?: PollCreationSchema;
+ sticker_ids?: string[] | null;
+ components?: BaseMessageComponents[] | null;
+ poll?: PollCreationSchema | null;
enforce_nonce?: boolean; // For Discord compatibility, it's the default behavior here
- applied_tags?: string[]; // Not implemented yet, for webhooks in forums
- thread_name?: string; // Not implemented yet, for webhooks
- avatar_url?: string; // Not implemented yet, for webhooks
+ applied_tags?: string[]; // TODO: Not implemented yet, for webhooks in forums
+ thread_name?: string; // TODO: Not implemented yet, for webhooks
+ avatar_url?: string; // TODO: Not implemented yet, for webhooks
interaction?: MessageInteractionSchema;
interaction_metadata?: MessageInteractionSchema;
}
|