3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Logs: fix crash in userMention/channelMention if the user/channel doesn't exist

This commit is contained in:
Dragory 2019-03-16 16:39:32 +02:00
parent 8f898ed972
commit db5d93b5c2

View file

@ -174,6 +174,7 @@ export class LogsPlugin extends ZeppelinPlugin<ILogsPluginConfig, ILogsPluginPer
formatted = await renderTemplate(format, {
...data,
userMention: user => {
if (!user) return "";
if (user.user) user = user.user;
const member = this.guild.members.get(user.id);
@ -186,6 +187,7 @@ export class LogsPlugin extends ZeppelinPlugin<ILogsPluginConfig, ILogsPluginPer
}
},
channelMention: channel => {
if (!channel) return "";
return `<#${channel.id}> (**#${channel.name}**, \`${channel.id}\`)`;
},
});