Answer the question
In order to leave comments, you need to log in
Discord bot in js?
What's wrong with this script?
bot.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type === "dm") return;
let prefix = botconfig.prefix;
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
if(cmd === `${prefix}айхан`){
client.channels.get(`599721171633700874`).send('My Message');
}
});
Answer the question
In order to leave comments, you need to log in
I can suggest trying to replace client.channels
with bot.channels
Or it's even easier to take the channel ID from the message itself
bot.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type === "dm") return;
let prefix = botconfig.prefix;
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
bot.channels.get(message.channel.id).send('My message')
.then(msg => {
})
.catch((e) => {
console.log(e);
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question