Logs: fix crash in userMention/channelMention if the user/channel doesn't exist
This commit is contained in:
parent
8f898ed972
commit
db5d93b5c2
1 changed files with 2 additions and 0 deletions
|
@ -174,6 +174,7 @@ export class LogsPlugin extends ZeppelinPlugin<ILogsPluginConfig, ILogsPluginPer
|
||||||
formatted = await renderTemplate(format, {
|
formatted = await renderTemplate(format, {
|
||||||
...data,
|
...data,
|
||||||
userMention: user => {
|
userMention: user => {
|
||||||
|
if (!user) return "";
|
||||||
if (user.user) user = user.user;
|
if (user.user) user = user.user;
|
||||||
|
|
||||||
const member = this.guild.members.get(user.id);
|
const member = this.guild.members.get(user.id);
|
||||||
|
@ -186,6 +187,7 @@ export class LogsPlugin extends ZeppelinPlugin<ILogsPluginConfig, ILogsPluginPer
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
channelMention: channel => {
|
channelMention: channel => {
|
||||||
|
if (!channel) return "";
|
||||||
return `<#${channel.id}> (**#${channel.name}**, \`${channel.id}\`)`;
|
return `<#${channel.id}> (**#${channel.name}**, \`${channel.id}\`)`;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue