mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Allow certain or all roles to be removed upon mute and readded on unmute (#140)
This commit is contained in:
parent
8e812aab2f
commit
a13b0b6fda
12 changed files with 135 additions and 27 deletions
|
@ -11,6 +11,8 @@ const BaseSingleSpamConfig = t.type({
|
|||
count: t.number,
|
||||
mute: tNullable(t.boolean),
|
||||
mute_time: tNullable(t.number),
|
||||
remove_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])),
|
||||
restore_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])),
|
||||
clean: tNullable(t.boolean),
|
||||
});
|
||||
export type TBaseSingleSpamConfig = t.TypeOf<typeof BaseSingleSpamConfig>;
|
||||
|
|
|
@ -82,12 +82,19 @@ export async function logAndDetectMessageSpam(
|
|||
(spamConfig.mute_time && convertDelayStringToMS(spamConfig.mute_time.toString())) ?? 120 * 1000;
|
||||
|
||||
try {
|
||||
muteResult = await mutesPlugin.muteUser(member.id, muteTime, "Automatic spam detection", {
|
||||
caseArgs: {
|
||||
modId: pluginData.client.user.id,
|
||||
postInCaseLogOverride: false,
|
||||
muteResult = await mutesPlugin.muteUser(
|
||||
member.id,
|
||||
muteTime,
|
||||
"Automatic spam detection",
|
||||
{
|
||||
caseArgs: {
|
||||
modId: pluginData.client.user.id,
|
||||
postInCaseLogOverride: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
spamConfig.remove_roles_on_mute,
|
||||
spamConfig.restore_roles_on_mute,
|
||||
);
|
||||
} catch (e) {
|
||||
if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) {
|
||||
logs.log(LogType.BOT_ALERT, {
|
||||
|
|
|
@ -41,12 +41,19 @@ export async function logAndDetectOtherSpam(
|
|||
(spamConfig.mute_time && convertDelayStringToMS(spamConfig.mute_time.toString())) ?? 120 * 1000;
|
||||
|
||||
try {
|
||||
await mutesPlugin.muteUser(member.id, muteTime, "Automatic spam detection", {
|
||||
caseArgs: {
|
||||
modId: pluginData.client.user.id,
|
||||
extraNotes: [`Details: ${details}`],
|
||||
await mutesPlugin.muteUser(
|
||||
member.id,
|
||||
muteTime,
|
||||
"Automatic spam detection",
|
||||
{
|
||||
caseArgs: {
|
||||
modId: pluginData.client.user.id,
|
||||
extraNotes: [`Details: ${details}`],
|
||||
},
|
||||
},
|
||||
});
|
||||
spamConfig.remove_roles_on_mute,
|
||||
spamConfig.restore_roles_on_mute,
|
||||
);
|
||||
} catch (e) {
|
||||
if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) {
|
||||
logs.log(LogType.BOT_ALERT, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue