summary refs log tree commit diff
path: root/api/src/util/Message.ts
diff options
context:
space:
mode:
authorSamuel <34555296+Flam3rboy@users.noreply.github.com>2021-10-15 18:39:57 +0200
committerGitHub <noreply@github.com>2021-10-15 18:39:57 +0200
commit1bbf789a7eb54e19459931d3928db1e34472f6d2 (patch)
tree4ac117b32e6b6c8d2c380e552597e6caad70294d /api/src/util/Message.ts
parentMerge pull request #462 from hbjydev/unit-tests-expanded (diff)
parent:sparkles: sticker events (diff)
downloadserver-1bbf789a7eb54e19459931d3928db1e34472f6d2.tar.xz
Merge pull request #455 from fosscord/sticker
Stickers
Diffstat (limited to 'api/src/util/Message.ts')
-rw-r--r--api/src/util/Message.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/api/src/util/Message.ts b/api/src/util/Message.ts

index 40d96b42..d14d3aa2 100644 --- a/api/src/util/Message.ts +++ b/api/src/util/Message.ts
@@ -24,7 +24,7 @@ import fetch from "node-fetch"; import cheerio from "cheerio"; import { MessageCreateSchema } from "../routes/channels/#channel_id/messages"; -// TODO: check webhook, application, system author +// TODO: check webhook, application, system author, stickers // TODO: embed gifs/videos/images const LINK_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g; @@ -46,6 +46,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { const message = new Message({ ...opts, + sticker_items: opts.sticker_ids?.map((x) => ({ id: x })), guild_id: channel.guild_id, channel_id: opts.channel_id, attachments: opts.attachments || [], @@ -82,7 +83,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { } // TODO: stickers/activity - if (!opts.content && !opts.embeds?.length && !opts.attachments?.length) { + if (!opts.content && !opts.embeds?.length && !opts.attachments?.length && !opts.sticker_ids?.length) { throw new HTTPError("Empty messages are not allowed", 50006); }