Fix editing permissions interactions not working
Co-authored-by: Cadence Ember <cadence@disroot.org>
This commit is contained in:
committed by
Cadence Ember
co-authored by
Cadence Ember
parent
313efb29d8
commit
18b6efdd18
@@ -91,15 +91,6 @@ function registerInteractions() {
|
|||||||
async function dispatchInteraction(interaction) {
|
async function dispatchInteraction(interaction) {
|
||||||
const interactionId = interaction.data?.["custom_id"] || interaction.data?.["name"]
|
const interactionId = interaction.data?.["custom_id"] || interaction.data?.["name"]
|
||||||
try {
|
try {
|
||||||
if (interaction.type === DiscordTypes.InteractionType.MessageComponent || interaction.type === DiscordTypes.InteractionType.ModalSubmit) {
|
|
||||||
// All we get is custom_id, don't know which context the button was clicked in.
|
|
||||||
// So we namespace these ourselves in the custom_id. Currently the only existing namespace is POLL_.
|
|
||||||
if (interaction.data.custom_id.startsWith("POLL_")) {
|
|
||||||
await poll.interact(interaction)
|
|
||||||
} else {
|
|
||||||
throw new Error(`Unknown message component ${interaction.data.custom_id}`)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (interactionId === "Matrix info") {
|
if (interactionId === "Matrix info") {
|
||||||
await matrixInfo.interact(interaction)
|
await matrixInfo.interact(interaction)
|
||||||
} else if (interactionId === "invite") {
|
} else if (interactionId === "invite") {
|
||||||
@@ -122,10 +113,11 @@ async function dispatchInteraction(interaction) {
|
|||||||
await ping.interact(interaction)
|
await ping.interact(interaction)
|
||||||
} else if (interactionId === "privacy") {
|
} else if (interactionId === "privacy") {
|
||||||
await privacy.interact(interaction)
|
await privacy.interact(interaction)
|
||||||
|
} else if (interactionId.startsWith("POLL_")) {
|
||||||
|
await poll.interact(interaction)
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unknown interaction ${interactionId}`)
|
throw new Error(`Unknown interaction ${interactionId}`)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
let stackLines = null
|
let stackLines = null
|
||||||
if (e.stack) {
|
if (e.stack) {
|
||||||
|
|||||||
Reference in New Issue
Block a user