Open MohamadTaha1 opened 10 months ago
const Discord = require("./node_modules/discord-user-bots/src/exports.js"); const client = new Discord.Client("blabla"); hey="hello"
client.on.ready = function() { console.log("Client online!"); };
client.on.message_create = function(message) { const guild = client.info.guilds.filter((guild) => guild.id == message.guild_id)[0]; const channel = guild.channels.filter((channel) => channel.id == message.channel_id)[0];
if(channel.id=="673488504524898304"){ console.log(message); client.send( "673488504524898304", // Channel to send in { content: "Hello",}); } }
I have this code and i dont get why no message is being sent. console.log is working but me sending the message is not
are you sure the channel ID is correct? If it is, the send function might return a promise, so you should prob ensure that its awaited or you should just handle the promise correctly
const Discord = require("./node_modules/discord-user-bots/src/exports.js"); const client = new Discord.Client("blabla"); hey="hello"
client.on.ready = function() { console.log("Client online!"); };
client.on.message_create = function(message) { const guild = client.info.guilds.filter((guild) => guild.id == message.guild_id)[0]; const channel = guild.channels.filter((channel) => channel.id == message.channel_id)[0];
if(channel.id=="673488504524898304"){ console.log(message); client.send( "673488504524898304", // Channel to send in { content: "Hello",}); } }
I have this code and i dont get why no message is being sent. console.log is working but me sending the message is not