summary refs log tree commit diff
path: root/src/api/util
diff options
context:
space:
mode:
authorCyberL1 <cyber.hf18@gmail.com>2026-06-24 14:06:48 +0200
committerRory& <root@rory.gay>2026-06-25 17:56:49 +0200
commit4cf0e48dd0ff91a7bd70334abe986b12dfa5d089 (patch)
treefaacf8d6f2352ac7fee209f30f05cdfaf6f3c684 /src/api/util
parentfix: add `expiry` field to polls in message handling (diff)
downloadserver-ts-4cf0e48dd0ff91a7bd70334abe986b12dfa5d089.tar.xz
fix: assign id to poll answers
Diffstat (limited to 'src/api/util')
-rw-r--r--src/api/util/handlers/Message.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts

index 21204992..3b2fda51 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -490,6 +490,12 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { message.poll.expiry = new Date(Date.now() + opts.poll.duration * 3600000); } + if (message.poll && opts.poll?.answers) { + for (let i = 0; i < opts.poll.answers.length; i++) { + message.poll.answers[i].answer_id = i; + } + } + await handleMessageMentionsAsync(message); const attachmentIndices = new Map(message.attachments?.map((attachment, index) => [`attachment://${attachment.filename}`, index]));