Sopur / Discord-user-bots

Working discord user bots library.
MIT License
81 stars 35 forks source link

Not able to send messages #55

Open MohamadTaha1 opened 10 months ago

MohamadTaha1 commented 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

kit2d2alt commented 1 day ago

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