'NoXz
'NoXz
DIAdiscord.js - Imagine an app
Created by 'NoXz on 1/22/2024 in #djs-questions
Never expiring button blocks another button
Hello 👋 I made a code so my buttons for a command never expire, but it seems to block other buttons from working.
client.on('interactionCreate', async (interaction) => {
if (!interaction.customId === 'tank' || !interaction.customId === 'dps' || !interaction.customId === 'heal' || !interaction.customId === 'absent' || !interaction.customId === 'reset') return;
// more code here
client.on('interactionCreate', async (interaction) => {
if (!interaction.customId === 'tank' || !interaction.customId === 'dps' || !interaction.customId === 'heal' || !interaction.customId === 'absent' || !interaction.customId === 'reset') return;
// more code here
But i made another command and the buttons of the new command seems to go inside the 'interactionCreate' as if that if ( !customId ) return didnt exist. I changed the if, and instead of !interaction.customId === 'id' i did interaction.customId !== 'id'. It now doesnt block the new command anymore, but now blocks the initial 'tank', 'dps', 'heal', 'absent' and 'reset' buttons. Any ideas ?
7 replies
DIAdiscord.js - Imagine an app
Created by 'NoXz on 1/7/2024 in #djs-questions
Importing embed and message variables from another file.
Hi, i am trying to make a button that never expire, so im using the method of doing and even handler inside client.on in index.js The issue is that the button edits an embed message from a command reply. When i try to export the embed variable from the command file and do embed.spliceFields(), i get this error :
undefined
undefined
node:events:497
throw er; // Unhandled 'error' event
^

TypeError: Cannot read properties of undefined (reading 'spliceFields')
at Client.<anonymous> (C:\Users\const\Documents\Discord\Bots\Silas Sombrelune\src\index.js:84:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:402:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

Node.js v21.5.0
undefined
undefined
node:events:497
throw er; // Unhandled 'error' event
^

TypeError: Cannot read properties of undefined (reading 'spliceFields')
at Client.<anonymous> (C:\Users\const\Documents\Discord\Bots\Silas Sombrelune\src\index.js:84:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:402:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

Node.js v21.5.0
This is how i imported the embed :
const { raidmessage, raidembed } = require('./commands/Community/raid.js')
// raidembed = embed
// raidmessage = raidembed message sent by command reply with embeds: [raidembed]
const { raidmessage, raidembed } = require('./commands/Community/raid.js')
// raidembed = embed
// raidmessage = raidembed message sent by command reply with embeds: [raidembed]
The two "undefined" at the start of the error message are from :
client.on('interactionCreate', async (interaction) => {
// [...]
console.log(raidembed)
console.log(raidmessage)
// [...]
}
client.on('interactionCreate', async (interaction) => {
// [...]
console.log(raidembed)
console.log(raidmessage)
// [...]
}
So i assume the error is from how I import my variables... Could you help me please ? Feel free to ping me. Tell me if you need to see some code, and what part you need.
23 replies
DIAdiscord.js - Imagine an app
Created by 'NoXz on 7/31/2022 in #djs-questions
My anti-raid function doesn't work
Hello, I want to create a function that kicks new members during 30 seconds if 10 members join in 10 seconds. I am on this for now 1 entire day, but cant find how to do it. Could you help me please ?
82 replies