I'm currently coding a discord bot using node.js, I wanted to create a command that sends a dm to a certain user, but I can't get my client variable into the needed file.
Here's my code in index.js
// my index.js file
client.login(token)
module.exports = client;
// my sendMessage.js file
const bot = require("../index");
module.exports = {
data: new SlashCommandBuilder()
.setName('new-command')
.setDescription('some description'),
async execute(interaction) {
// interaction.guild is the object representing the Guild in which the command was run
bot.users.cache.get('439484647022526465').send("test");
}
};
Via Active questions tagged javascript - Stack Overflow https://ift.tt/W9ytHld
Comments
Post a Comment