Skip to content

Commit

Permalink
fix(message-listeners): fixed potential null pointer exception in can…
Browse files Browse the repository at this point in the history
…RunInChannel (#515)
  • Loading branch information
favna committed Aug 26, 2022
1 parent 314840b commit 5409282
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export class CoreListener extends Listener<typeof Events.PreMessageParsed> {
if (!me) return false;

const channel = message.channel as GuildBasedChannelTypes;
return channel.permissionsFor(me).has(this.requiredPermissions, true);
const permissionsFor = channel.permissionsFor(me);
if (!permissionsFor) return false;

return permissionsFor.has(this.requiredPermissions, true);
}

private getMentionPrefix(message: Message): string | null {
Expand Down

0 comments on commit 5409282

Please sign in to comment.