fix poll in msg create schema

This commit is contained in:
Madeline 2024-07-09 15:27:24 +10:00
parent c52d6c49a3
commit 35c9a09ea5
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
4 changed files with 20 additions and 19 deletions

Binary file not shown.

Binary file not shown.

View File

@ -16,36 +16,36 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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<Message> {
: 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,

View File

@ -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