Discord-user-bots icon indicating copy to clipboard operation
Discord-user-bots copied to clipboard

Missing properties on channels

Open rudy3333 opened this issue 2 years ago • 1 comments

currently, {channel.name} and for {channel.id} for forum posts are undefined. i guess if someone would be good enough to add support for them i would be greatful

code :

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 (guild.name == "instaling fresh bot")
       console.log(`[${guild.name}] [#${channel.id}] ${message.author.username}: ${message.content}`);
   };

input : image

expected output : [instaling fresh bot] [(thread id) #1102685991933853746] rudy3: ur such a nerd 🤓 actual output :

console.log(`[${guild.name}] [#${channel.id}] ${message.author.username}: ${message.content}`);

TypeError: Cannot read properties of undefined (reading 'id')
    at client.on.message_create (C:\Users\mmax3\Downloads\NanaEmojiDecipher\main.js:16:49)
    at WebSocket.<anonymous> (C:\Users\mmax3\Downloads\NanaEmojiDecipher\node_modules\discord-user- 
    bots\src\client\client.js:374:37)

rudy3333 avatar May 01 '23 20:05 rudy3333

Update : Using message.channel_id seems to do the trick,

rudy3333 avatar May 02 '23 10:05 rudy3333

Discord is very inconsistent with their own API. DUB does not have any structures defined for Discord, so all data that is passed by DUB is raw body data from Discord.

Sopur avatar Jun 22 '24 01:06 Sopur