diff --git a/assets/openapi.json b/assets/openapi.json index f649c9b22..0a211d3c3 100644 Binary files a/assets/openapi.json and b/assets/openapi.json differ diff --git a/assets/schemas.json b/assets/schemas.json index 7a57dfcf5..a77f86b67 100644 Binary files a/assets/schemas.json and b/assets/schemas.json differ diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts index 85db26b27..64bcdd567 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts @@ -16,36 +16,36 @@ along with this program. If not, see . */ +import * as Sentry from "@sentry/node"; +import { EmbedHandlers } from "@spacebar/api"; import { + Application, + Attachment, Channel, + Config, Embed, + EmbedCache, emitEvent, - Guild, - Message, - MessageCreateEvent, - MessageUpdateEvent, + EVERYONE_MENTION, getPermission, getRights, + Guild, + HERE_MENTION, + Message, + MessageCreateEvent, + MessageCreateSchema, + MessageType, + MessageUpdateEvent, + Role, + ROLE_MENTION, + Sticker, + User, //CHANNEL_MENTION, USER_MENTION, - ROLE_MENTION, - Role, - EVERYONE_MENTION, - HERE_MENTION, - MessageType, - User, - Application, Webhook, - Attachment, - Config, - Sticker, - MessageCreateSchema, - EmbedCache, } from "@spacebar/util"; import { HTTPError } from "lambert-server"; import { In } from "typeorm"; -import { EmbedHandlers } from "@spacebar/api"; -import * as Sentry from "@sentry/node"; const allow_empty = false; // TODO: check webhook, application, system author, stickers // TODO: embed gifs/videos/images @@ -66,6 +66,7 @@ export async function handleMessage(opts: MessageOptions): Promise { : undefined; const message = Message.create({ ...opts, + poll: opts.poll ? [opts.poll] : undefined, sticker_items: stickers, guild_id: channel.guild_id, channel_id: opts.channel_id, diff --git a/src/util/schemas/MessageCreateSchema.ts b/src/util/schemas/MessageCreateSchema.ts index be1c31bec..495e2ebd6 100644 --- a/src/util/schemas/MessageCreateSchema.ts +++ b/src/util/schemas/MessageCreateSchema.ts @@ -56,7 +56,7 @@ export interface MessageCreateSchema { sticker_ids?: string[]; components?: MessageComponent[]; // TODO: Fix TypeScript errors in src\api\util\handlers\Message.ts once this is enabled - //poll?: PollCreationSchema; + poll?: PollCreationSchema; 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