TripSit / TripBot

The discord bot on TripSit.Me
22 stars 12 forks source link

TypeError: Cannot read properties of null (reading 'id') #770

Closed LunaUrsa closed 1 week ago

LunaUrsa commented 4 months ago

View details in Rollbar: https://app.rollbar.com/a/tripsit/fix/item/TripBot/62

TypeError: Cannot read properties of null (reading 'id')
    at modResponse (/usr/src/app/src/discord/commands/guild/d.moderate.ts:915:26)
    at Object.execute (/usr/src/app/src/discord/commands/guild/m.report.ts:40:50)
    at commandRun (/usr/src/app/src/discord/utils/commandRun.ts:34:5)
LunaUrsa commented 4 months ago

Hullabaloo: @ʍօօռɮɛǟʀ this is the error message that comes up for trying to run “Report message” for the user that left the guild. It seems it isn’t having their discord ID correctly?

LunaUrsa commented 4 months ago

Steps to reproduce: 1) Go to this message by this user who has left the guild 2) Right click on the message and Report Message

LunaUrsa commented 4 months ago

This is likely coming down to how the system finds the 'target' variable in the code.

If the user leaves the guild then targetMessage.member wont have a value

Maybe we can change this to targetMessage.author? That will resolve a User object which should always be populated?

d.moderate.ts image