pinano-discord / Pinano-Discord-Bot

A Discord bot for the Pinano guild
MIT License
9 stars 11 forks source link

DMs to bot cause promise rejection #19

Closed pianiststickman closed 5 years ago

pianiststickman commented 5 years ago

Also from the most recent deployment:

(node:28564) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
    at Client.client.on (/home/pinanostaff/pinano/library/client_events.js:31:63)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:28564) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 12)

Line 31 is the following:

if (!client.settings.pinano_guilds.includes(message.guild.id))

So we have a guildless message?

sit commented 5 years ago

Ah, these are DMs. If you try to DM your bot, it'll ignore your messages because of this.

But also, it appears that commands like stats also assume that your message has a guild. Perhaps we need the concept of a default guild or a way to specify the guild you are DM'ing for stats for.

pianiststickman commented 5 years ago

Fixed in #83