irukanoko
irukanoko
DIAdiscord.js - Imagine an app
Created by irukanoko on 11/5/2023 in #djs-questions
Overloaded? DiscordAPIError[50027]: Invalid Webhook Token
I'm assuming I'm not being rate limited. Should I implement something below? Will it help? Avoid Repetitive Interactions: To prevent repetitive interactions, you can maintain a record of interactions and ignore duplicates. You can store a unique identifier for each interaction, such as a user ID and a message ID, and check if you've already processed an interaction from the same user for the same message. If you've already processed it, you can ignore subsequent interactions. Asynchronous Processing: Depending on your bot's architecture, you might consider offloading the processing of button interactions to a background queue system. This can help distribute the workload and improve responsiveness. (Isn't it was already async)
4 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
fixed it. have to .getSubcommand() and invoke it in the main slashcommand execute
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
do i need to explain more?
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
do i need to add my subcommands separately from the main commands?
const { loadFiles } = require("../functions/fileLoader");

async function loadCommands(client) {
console.time("Commands loaded");

const tableArray = new Array();
const commandFiles = await loadFiles("src/commands");
for (const file of commandFiles) {
const command = require(file);
// Set a new item in the Collection with the key as the command name and the value as the exported module
if ("data" in command && "execute" in command) {
client.commands.set(command.data.name, command);
tableArray.push({ Command: command.data.name, Status: "✅" });
} else {
// [WARNING] The command at ${file} is missing a required "data" or "execute" property.`
tableArray.push({ Command: file, Status: "❌" });
}
}

console.table(tableArray, ["Command", "Status"]);
console.info("\n\x1b[36m%s\x1b[0m", "Loaded Commands."); // Cyan
console.timeEnd("Commands loaded");
}

module.exports = { loadCommands };
const { loadFiles } = require("../functions/fileLoader");

async function loadCommands(client) {
console.time("Commands loaded");

const tableArray = new Array();
const commandFiles = await loadFiles("src/commands");
for (const file of commandFiles) {
const command = require(file);
// Set a new item in the Collection with the key as the command name and the value as the exported module
if ("data" in command && "execute" in command) {
client.commands.set(command.data.name, command);
tableArray.push({ Command: command.data.name, Status: "✅" });
} else {
// [WARNING] The command at ${file} is missing a required "data" or "execute" property.`
tableArray.push({ Command: file, Status: "❌" });
}
}

console.table(tableArray, ["Command", "Status"]);
console.info("\n\x1b[36m%s\x1b[0m", "Loaded Commands."); // Cyan
console.timeEnd("Commands loaded");
}

module.exports = { loadCommands };
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
from my understanding, my command handler is essentially the guide's https://discordjs.guide/creating-your-bot/command-handling.html#command-categories await command.execute(interaction); brawl.js
module.exports = {
data: new SlashCommandBuilder()
.setName("brawl")
.setDescription("Brawl main command description. You shouldn't see this.")
.addSubcommand(create.data, create.execute),
category: "public",
async execute(interaction) {
await interaction.reply(
"Brawl main command reply. You shouldn't see this."
);
},
};
module.exports = {
data: new SlashCommandBuilder()
.setName("brawl")
.setDescription("Brawl main command description. You shouldn't see this.")
.addSubcommand(create.data, create.execute),
category: "public",
async execute(interaction) {
await interaction.reply(
"Brawl main command reply. You shouldn't see this."
);
},
};
on discord the ./brawl create shows with all of it's desc and options but when i run it, executes the reply you see above. any thoughts on how to change the interaction to execute my subcommands?
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
only ./brawl create shows up. great! but the output is wrong bc it's executing the brawl.js interaction reply (which shouldn't be seen) do i have to change my slashcommand handler or is there something i can do inside brawl.js
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
ahhh i failed to understand that ty
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
do you have an example of something i can reference? the only thing i have in my main slashcommand is .addSubcommand(importedcmd.data, importedcmd.execute)
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
everything works fine when i have it all in 1 file. somehow separating it is causing a problem
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
is there something special you need to do with the command handler for subcommands?
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
ideally, /brawl create is the only thing that should be visable. i reset the global/guild commands using the guide's deploy-commands.js
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
i have that in my deploy-commands.js which i run everytime i start up the bot
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
how do i make sure to prevent this?
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
ty for the help and clarifications!
20 replies
DIAdiscord.js - Imagine an app
Created by irukanoko on 9/6/2023 in #djs-questions
how do you modularize your subcommands so their implementation is in different files?
let's say i just have
command
|
|__ subcommand
command
|
|__ subcommand
both /command and /command subcommand show up. how do i hide the main command so just the latter shows up?
20 replies