Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(api): send stickers through webhooks (#2338)

Hampus5119febb5b5a
diff --git a/fluxer_api/src/api/channel/services/message/MessageSendService.ts b/fluxer_api/src/api/channel/services/message/MessageSendService.ts
index a635a6612..70cd2fb2e 100644
--- a/fluxer_api/src/api/channel/services/message/MessageSendService.ts
+++ b/fluxer_api/src/api/channel/services/message/MessageSendService.ts
@@ -1176,6 +1176,7 @@ export class MessageSendService {
embeds: data.embeds,
attachments: this.attachmentsToProcess(data.attachments),
attachmentUploadUserId: this.resolveWebhookAttachmentUploadUserId(webhook, data.attachments),
+ stickerIds: data.sticker_ids ? data.sticker_ids.flatMap((stickerId) => createStickerID(stickerId)) : undefined,
messageReference,
messageSnapshots,
guildId: channel.guildId,
diff --git a/fluxer_api/src/api/webhook/tests/WebhookStickerBypass.test.ts b/fluxer_api/src/api/webhook/tests/WebhookStickerBypass.test.ts
index ebf4c3fe1..daa1e9aba 100644
--- a/fluxer_api/src/api/webhook/tests/WebhookStickerBypass.test.ts
+++ b/fluxer_api/src/api/webhook/tests/WebhookStickerBypass.test.ts
@@ -7,7 +7,7 @@ import {type ApiTestHarness, createApiTestHarness} from '../../test/ApiTestHarne
import {createBuilderWithoutAuth} from '../../test/TestRequestBuilder';
import {createWebhook, deleteWebhook} from './WebhookTestUtils';
-describe('Webhook sticker bypass', () => {
+describe('Webhook stickers', () => {
let harness: ApiTestHarness;
beforeAll(async () => {
harness = await createApiTestHarness();
@@ -15,7 +15,7 @@ describe('Webhook sticker bypass', () => {
beforeEach(async () => {
await harness.reset();
});
- it('webhook messages ignore sticker_ids', async () => {
+ it('rejects unknown sticker_ids', async () => {
const user = await createTestAccount(harness);
const guild = await createGuild(harness, user.token, 'Webhook Sticker Test Guild');
const channelId = guild.system_channel_id!;
@@ -26,7 +26,7 @@ describe('Webhook sticker bypass', () => {
content: 'Webhook sticker test',
sticker_ids: ['999999999999999999'],
})
- .expect(204)
+ .expect(400)
.execute();
await deleteWebhook(harness, webhook.id, user.token);
});