kama
kama
DIAdiscord.js - Imagine an app
Created by kama on 5/4/2025 in #djs-questions
How to handle multiple tokens.
if i ever change something, and have more bots than three thisll take forever to start everything up
35 replies
DIAdiscord.js - Imagine an app
Created by kama on 5/4/2025 in #djs-questions
How to handle multiple tokens.
yes. but i want to run them all simultaneously without having to run the code 3x
35 replies
DIAdiscord.js - Imagine an app
Created by kama on 5/4/2025 in #djs-questions
How to handle multiple tokens.
i see. well my problem still resides in how to run everything on multiple tokens without duplicating my code
35 replies
DIAdiscord.js - Imagine an app
Created by kama on 5/4/2025 in #djs-questions
How to handle multiple tokens.
i'm not asking them. they willingly give it to me. that's why services like crowbots or myself can work around that rule
35 replies
DIAdiscord.js - Imagine an app
Created by kama on 5/4/2025 in #djs-questions
How to handle multiple tokens.
discord is very limited with per-server bot identity
35 replies
DIAdiscord.js - Imagine an app
Created by kama on 5/4/2025 in #djs-questions
How to handle multiple tokens.
yea if for example you want go have your custom branding
35 replies
DIAdiscord.js - Imagine an app
Created by kama on 5/4/2025 in #djs-questions
How to handle multiple tokens.
okay yeah but the point is to use multiple tokens at once
35 replies
DIAdiscord.js - Imagine an app
Created by kama on 5/4/2025 in #djs-questions
How to handle multiple tokens.
no. it's basically my friends whenever they create a server they need a protection bot. so they give me token and i host script on that token
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.
The bot seems to not handle text commands.
10 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.
I use NodeJS v16.15.0 and discord.js v14.7.1
10 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.
10 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.
This is my ascii table :
async function loadCommands(client) {
const { loadFiles } = require("../Functions/fileLoader");
const ascii = require("ascii-table");
const table = new ascii().setHeading("Commands", "Status");

await client.commands.clear();
await client.subCommands.clear();

let commandsArray = [];

const Files = await loadFiles("Commands");

Files.forEach((file) => {
const command = require(file);

if (command.subCommand)
return client.subCommands.set(command.subCommand, command);
if (!command.data) return;
else client.commands.set(command.data.name, command);

commandsArray.push(command.data.toJSON());

table.addRow(command.data.name, "✅");
table.addRow(command.name, "✅");
});

client.application.commands.set(commandsArray);

return console.log(table.toString(), "\n✅ Loaded Commands");
}

module.exports = { loadCommands };
async function loadCommands(client) {
const { loadFiles } = require("../Functions/fileLoader");
const ascii = require("ascii-table");
const table = new ascii().setHeading("Commands", "Status");

await client.commands.clear();
await client.subCommands.clear();

let commandsArray = [];

const Files = await loadFiles("Commands");

Files.forEach((file) => {
const command = require(file);

if (command.subCommand)
return client.subCommands.set(command.subCommand, command);
if (!command.data) return;
else client.commands.set(command.data.name, command);

commandsArray.push(command.data.toJSON());

table.addRow(command.data.name, "✅");
table.addRow(command.name, "✅");
});

client.application.commands.set(commandsArray);

return console.log(table.toString(), "\n✅ Loaded Commands");
}

module.exports = { loadCommands };
10 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.
And a normal text command like this :
const premiumSchema = require("../../Models/premium");
const { Client, Message, EmbedBuilder } = require("discord.js");

module.exports = {
name: "add-premium",
/**
*
* @param {Client} client
* @param {Message}} message
* @param {String[]} args
* @returns
*/
async execute(client, message, args) {
if (!client.config.DEVID.includes(message.user.id)) return;

const member =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0]);

if (!member) message.reply("Please specify a valid member");

premiumSchema.findOne(
{
User: member.id,
},
async (err, data) => {
if (data)
return message.channel.send(
"User has already access to premium features."
);

new premiumSchema({
User: member.id,
}).save();
return message.channel.send(`Added ${user} to the database.`);
}
);
},
};
const premiumSchema = require("../../Models/premium");
const { Client, Message, EmbedBuilder } = require("discord.js");

module.exports = {
name: "add-premium",
/**
*
* @param {Client} client
* @param {Message}} message
* @param {String[]} args
* @returns
*/
async execute(client, message, args) {
if (!client.config.DEVID.includes(message.user.id)) return;

const member =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0]);

if (!member) message.reply("Please specify a valid member");

premiumSchema.findOne(
{
User: member.id,
},
async (err, data) => {
if (data)
return message.channel.send(
"User has already access to premium features."
);

new premiumSchema({
User: member.id,
}).save();
return message.channel.send(`Added ${user} to the database.`);
}
);
},
};
10 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.
A normal slash command looks like this :
module.exports = {
developer: true,
data: new SlashCommandBuilder()
.setName("emit")
.setDescription("Emit the guildMemberAdd / Remove events")
.setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild)
.setDMPermission(false),
/**
*
* @param {ChatInputCommandInteraction} interaction
* @param {Client} client
*/
execute(interaction, client) {
client.emit("guildMemberRemove", interaction.member);
client.emit("guildMemberAdd", interaction.member);

interaction.reply({
content: "Emitted GuidlMemberAdd and GuildMemberRemove",
ephemeral: true,
});
},
};
module.exports = {
developer: true,
data: new SlashCommandBuilder()
.setName("emit")
.setDescription("Emit the guildMemberAdd / Remove events")
.setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild)
.setDMPermission(false),
/**
*
* @param {ChatInputCommandInteraction} interaction
* @param {Client} client
*/
execute(interaction, client) {
client.emit("guildMemberRemove", interaction.member);
client.emit("guildMemberAdd", interaction.member);

interaction.reply({
content: "Emitted GuidlMemberAdd and GuildMemberRemove",
ephemeral: true,
});
},
};
(3/...)
10 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.
And this is my slash command handler :
const { ChatInputCommandInteraction } = require("discord.js");

module.exports = {
name: "interactionCreate",
/**
*
* @param {ChatInputCommandInteraction} interaction
*/
execute(interaction, client) {
if (!interaction.isChatInputCommand()) return;

const command = client.commands.get(interaction.commandName);
if (!command)
return interaction.reply({
content: "Command Outdated.",
ephemeral: true,
});

if (command.developer && !client.config.DEVID.includes(interaction.user.id))
return interaction.reply({
content: ":x: This command is only available to developers.",
ephemeral: true,
});

if (command.owneronly && interaction.user.id !== client.config.OWNERID)
return interaction.reply({
content: ":x: This command is only available to the owner.",
ephemeral: true,
});

const subCommand = interaction.options.getSubcommand(false);
if (subCommand) {
const subCommandFile = client.subCommands.get(
`${interaction.commandName}.${subCommand}`
);
if (!subCommand)
return interaction.reply({
content: "Subcommand Outdated.",
ephemeral: true,
});
subCommandFile.execute(interaction, client);
} else command.execute(interaction, client);
},
};
const { ChatInputCommandInteraction } = require("discord.js");

module.exports = {
name: "interactionCreate",
/**
*
* @param {ChatInputCommandInteraction} interaction
*/
execute(interaction, client) {
if (!interaction.isChatInputCommand()) return;

const command = client.commands.get(interaction.commandName);
if (!command)
return interaction.reply({
content: "Command Outdated.",
ephemeral: true,
});

if (command.developer && !client.config.DEVID.includes(interaction.user.id))
return interaction.reply({
content: ":x: This command is only available to developers.",
ephemeral: true,
});

if (command.owneronly && interaction.user.id !== client.config.OWNERID)
return interaction.reply({
content: ":x: This command is only available to the owner.",
ephemeral: true,
});

const subCommand = interaction.options.getSubcommand(false);
if (subCommand) {
const subCommandFile = client.subCommands.get(
`${interaction.commandName}.${subCommand}`
);
if (!subCommand)
return interaction.reply({
content: "Subcommand Outdated.",
ephemeral: true,
});
subCommandFile.execute(interaction, client);
} else command.execute(interaction, client);
},
};
(2/...)
10 replies