Skip to content

Commit

Permalink
Fix sending polls in interactions (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
LonelyDeathVGX authored Jul 1, 2024
1 parent ae20187 commit 0f6f29b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
11 changes: 10 additions & 1 deletion lib/routes/Interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@ export default class Interactions {
content: options.data.content,
components: options.data.components ? this._manager.client.util.componentsToRaw(options.data.components) : undefined,
embeds: options.data.embeds ? this._manager.client.util.embedsToRaw(options.data.embeds) : undefined,
flags: options.data.flags
flags: options.data.flags,
poll: options.data.poll ? {
allow_multiselect: options.data.poll.allowMultiselect,
answers: options.data.poll.answers.map(a => ({
poll_media: a.pollMedia
})),
duration: options.data.poll.duration,
layout_type: options.data.poll.layoutType,
question: options.data.poll.question
} : undefined
};
break;
}
Expand Down
16 changes: 12 additions & 4 deletions lib/routes/Webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,18 @@ export default class Webhooks {
content: options.content,
embeds: options.embeds ? this._manager.client.util.embedsToRaw(options.embeds) : undefined,
flags: options.flags,
poll: options.poll,
thread_name: options.threadName,
tts: options.tts,
username: options.username
poll: options.poll ? {
allow_multiselect: options.poll.allowMultiselect,
answers: options.poll.answers.map(a => ({
poll_media: a.pollMedia
})),
duration: options.poll.duration,
layout_type: options.poll.layoutType,
question: options.poll.question
} : undefined,
thread_name: options.threadName,
tts: options.tts,
username: options.username
},
files
}).then(res => res === null ? undefined : new Message(res, this._manager.client));
Expand Down

0 comments on commit 0f6f29b

Please sign in to comment.