Updated buttonhandler to ignore tempbuttons
This commit is contained in:
@@ -35,8 +35,8 @@ export default async function prune(interaction: ChatInputCommandInteraction): P
|
||||
}
|
||||
|
||||
const id = Math.random().toString(32).slice(2)
|
||||
const buttonid = "button-" + id
|
||||
const cancelid = "cancel-" + id
|
||||
const buttonid = `tempbutton-pruneconfirm-${id}`
|
||||
const cancelid = `tempbutton-prunecancel-${id}`
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
|
||||
@@ -41,11 +41,19 @@ export default {
|
||||
}
|
||||
|
||||
if (interaction.isButton()) {
|
||||
const customId = interaction.customId
|
||||
let btnId: string = ""
|
||||
|
||||
if (customId.startsWith("tempbutton-")) {
|
||||
btnId = customId.split("-")[1]
|
||||
btnId = btnId.split("-")[0]
|
||||
}
|
||||
|
||||
console.log(
|
||||
color(
|
||||
interaction.user.username + "#" +
|
||||
interaction.user.discriminator + " clicked " +
|
||||
interaction.customId,
|
||||
btnId,
|
||||
"pink"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -32,7 +32,10 @@ export default async function loadButtonEvents(client: Client, ft: FileType) {
|
||||
client.on(Events.InteractionCreate, async interaction => {
|
||||
if (!interaction.isButton()) return
|
||||
|
||||
const button = client.buttons.get(interaction.customId)
|
||||
const customId = interaction.customId
|
||||
if (customId.startsWith("tempbutton-")) return
|
||||
|
||||
const button = client.buttons.get(customId)
|
||||
|
||||
if (!button) {
|
||||
console.error(`No event matching ${interaction.customId} was found.`)
|
||||
|
||||
Reference in New Issue
Block a user