IIoW / IIslander

The IIslander Discord bot for the IIslands of War Discord server
https://store.steampowered.com/app/1162470/IIslands_of_War/
MIT License
6 stars 1 forks source link

Error when writing a dm to the bot #50

Closed KommentatorForAll closed 2 years ago

KommentatorForAll commented 2 years ago

When one writes a message to the bot via dm, the following error occures:

TypeError: Cannot read properties of null (reading 'roles')
    at getUserRoles (file:///media/bigrpi/Programme/programming_stuff/Bots/jsBot/discordBots/IIslander/src/permissions.js:24:19)
    at getUserMod (file:///media/bigrpi/Programme/programming_stuff/Bots/jsBot/discordBots/IIslander/src/permissions.js:33:23)
    at handlePings (file:///media/bigrpi/Programme/programming_stuff/Bots/jsBot/discordBots/IIslander/src/modules/automod/message.js:68:9)
    at messageCreate (file:///media/bigrpi/Programme/programming_stuff/Bots/jsBot/discordBots/IIslander/src/modules/automod/message.js:109:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async file:///media/bigrpi/Programme/programming_stuff/Bots/jsBot/discordBots/IIslander/src/loadModules.js:36:21
WilsontheWolf commented 2 years ago

So basically this function expects a memeber to be passed but there is no member in dm's. You best bet would be pass

client.guilds.cache.get(config.defaultGuild).members.fetch(message.user.id);
WilsontheWolf commented 2 years ago

Actually since this is in auto mod just ignore dm;s in automod