Merge branch 'dev' into 'main'
Updated buttonhandler to ignore tempbuttons See merge request illegitimate/illegitimate-bot!277
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 id = Math.random().toString(32).slice(2)
|
||||||
const buttonid = "button-" + id
|
const buttonid = `tempbutton-pruneconfirm-${id}`
|
||||||
const cancelid = "cancel-" + id
|
const cancelid = `tempbutton-prunecancel-${id}`
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|||||||
@@ -41,11 +41,19 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (interaction.isButton()) {
|
if (interaction.isButton()) {
|
||||||
|
const customId = interaction.customId
|
||||||
|
let btnId: string = ""
|
||||||
|
|
||||||
|
if (customId.startsWith("tempbutton-")) {
|
||||||
|
btnId = customId.split("-")[1]
|
||||||
|
btnId = btnId.split("-")[0]
|
||||||
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
color(
|
color(
|
||||||
interaction.user.username + "#" +
|
interaction.user.username + "#" +
|
||||||
interaction.user.discriminator + " clicked " +
|
interaction.user.discriminator + " clicked " +
|
||||||
interaction.customId,
|
btnId,
|
||||||
"pink"
|
"pink"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,7 +32,10 @@ export default async function loadButtonEvents(client: Client, ft: FileType) {
|
|||||||
client.on(Events.InteractionCreate, async interaction => {
|
client.on(Events.InteractionCreate, async interaction => {
|
||||||
if (!interaction.isButton()) return
|
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) {
|
if (!button) {
|
||||||
console.error(`No event matching ${interaction.customId} was found.`)
|
console.error(`No event matching ${interaction.customId} was found.`)
|
||||||
|
|||||||
Reference in New Issue
Block a user