Migrate ModActions to new Plugin structure !!mutes dont work!!
This commit is contained in:
parent
ebcb28261b
commit
fd56664984
29 changed files with 1213 additions and 16 deletions
|
@ -0,0 +1,26 @@
|
|||
import { eventListener } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
|
||||
/**
|
||||
* Show an alert if a member with prior notes joins the server
|
||||
*/
|
||||
export const PostAlertOnMemberJoinEvt = eventListener<ModActionsPluginType>()(
|
||||
"guildMemberAdd",
|
||||
async ({ pluginData, args: { guild, member } }) => {
|
||||
const config = pluginData.config.get();
|
||||
|
||||
if (!config.alert_on_rejoin) return;
|
||||
|
||||
const alertChannelId = config.alert_channel;
|
||||
if (!alertChannelId) return;
|
||||
|
||||
const actions = await pluginData.state.cases.getByUserId(member.id);
|
||||
|
||||
if (actions.length) {
|
||||
const alertChannel: any = pluginData.guild.channels.get(alertChannelId);
|
||||
alertChannel.send(
|
||||
`<@!${member.id}> (${member.user.username}#${member.user.discriminator} \`${member.id}\`) joined with ${actions.length} prior record(s)`,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue