mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Fix error with unknown mod_actions alert_channel
This commit is contained in:
parent
1787ec707c
commit
6730e51552
1 changed files with 9 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
import { eventListener } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
||||
/**
|
||||
* Show an alert if a member with prior notes joins the server
|
||||
|
@ -18,6 +20,13 @@ export const PostAlertOnMemberJoinEvt = eventListener<ModActionsPluginType>()(
|
|||
|
||||
if (actions.length) {
|
||||
const alertChannel: any = pluginData.guild.channels.get(alertChannelId);
|
||||
if (!alertChannel) {
|
||||
pluginData.getPlugin(LogsPlugin).log(LogType.BOT_ALERT, {
|
||||
body: `Unknown \`alert_channel\` configured for \`mod_actions\`: \`${alertChannelId}\``,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
alertChannel.send(
|
||||
`<@!${member.id}> (${member.user.username}#${member.user.discriminator} \`${member.id}\`) joined with ${actions.length} prior record(s)`,
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue