kama
kama
DIAdiscord.js - Imagine an app
Created by kama on 5/4/2025 in #djs-questions
How to handle multiple tokens.
I have a single file of code. I'd like to run a service where you send a bot token and it runs the code on that bot too. How could i handle that? discord.js@latest node.js@latest
35 replies
DIAdiscord.js - Imagine an app
Created by kama on 1/31/2023 in #djs-questions
I want to have a text command handler separate from my present slash command handler.
Hi! I was originally a djsv12 developer but now we've moved to v14 I still want to use prefix commands aswell. I know how to reply specifically, but I want an actual handler. I tried something but it doesn't seem to listen to the commands. Here is my actual text handler :
const { Message, Discord } = require("discord.js");

module.exports = {
name: "messageCreate",
/**
*
* @param {Message} message
*/
execute(Discord, client, message) {
if (message.author.bot) return;
if (!message.content.startsWith(client.config.PREFIX)) return;

const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
const cmd = client.commands.get(command, interaction.commandName);
if (cmd.developer && !client.config.DEVID.includes(interaction.user.id))
return message.reply({
content: ":x: This command is only available to developers.",
ephemeral: true,
});

if (cmd.owneronly && interaction.user.id !== client.config.OWNERID)
return message.reply({
content: ":x: This command is only available to the owner.",
ephemeral: true,
});
cmd.execute(client, message, args, Discord);
},
};
const { Message, Discord } = require("discord.js");

module.exports = {
name: "messageCreate",
/**
*
* @param {Message} message
*/
execute(Discord, client, message) {
if (message.author.bot) return;
if (!message.content.startsWith(client.config.PREFIX)) return;

const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
const cmd = client.commands.get(command, interaction.commandName);
if (cmd.developer && !client.config.DEVID.includes(interaction.user.id))
return message.reply({
content: ":x: This command is only available to developers.",
ephemeral: true,
});

if (cmd.owneronly && interaction.user.id !== client.config.OWNERID)
return message.reply({
content: ":x: This command is only available to the owner.",
ephemeral: true,
});
cmd.execute(client, message, args, Discord);
},
};
(1/...)
10 replies