Add FilterAction to supress reports in bot log channel

fixes #415
This commit is contained in:
13xforever 2019-11-06 03:55:03 +05:00
parent 15ed3a64fe
commit fd0a53056b
4 changed files with 18 additions and 1 deletions

View File

@ -255,6 +255,7 @@ namespace CompatBot.Commands
var letterW = DiscordEmoji.FromUnicode("🇼");
var letterM = DiscordEmoji.FromUnicode("🇲");
var letterE = DiscordEmoji.FromUnicode("🇪");
var letterU = DiscordEmoji.FromUnicode("🇺");
DiscordMessage msg = null;
string errorMsg = null;
@ -380,6 +381,7 @@ namespace CompatBot.Commands
$"**`W`** = **`{FilterAction.IssueWarning}`** will issue a warning to the user.\n" +
$"**`M`** = **`{FilterAction.SendMessage}`** send _a_ message with an explanation of why it was removed.\n" +
$"**`E`** = **`{FilterAction.ShowExplain}`** show `explain` for the specified term (**not implemented**).\n" +
$"**`U`** = **`{FilterAction.MuteModQueue}`** mute mod queue reporting for this action.\n" +
"Reactions will toggle the action, text message will set the specified flags."
);
msg = await msg.UpdateOrCreateMessageAsync(ctx.Channel, "Please specify filter **action(s)**", embed: embed).ConfigureAwait(false);
@ -419,6 +421,12 @@ namespace CompatBot.Commands
filter.Actions ^= FilterAction.ShowExplain;
goto step3;
}
if (emoji.Emoji == letterU)
{
filter.Actions ^= FilterAction.MuteModQueue;
goto step3;
}
}
else if (txt != null)
{
@ -455,6 +463,12 @@ namespace CompatBot.Commands
case "SENDEXPLAIN":
newActions |= FilterAction.ShowExplain;
break;
case "U":
case "MMQ":
case "MUTE":
case "MUTEMODQUEUE":
newActions |= FilterAction.MuteModQueue;
break;
case "ABORT":
return (false, msg);
case "-":

View File

@ -95,6 +95,7 @@ namespace CompatBot.Database
IssueWarning = 0b_0000_0010,
ShowExplain = 0b_0000_0100,
SendMessage = 0b_0000_1000,
MuteModQueue = 0b_0001_0000,
}
internal class Warning

View File

@ -167,7 +167,8 @@ namespace CompatBot.Database.Providers
try
{
await client.ReportAsync("🤬 Content filter hit", message, trigger.String, triggerContext ?? message.Content, severity, actionList).ConfigureAwait(false);
if (!trigger.Actions.HasFlag(FilterAction.MuteModQueue) && !ignoreFlags.HasFlag(FilterAction.MuteModQueue))
await client.ReportAsync("🤬 Content filter hit", message, trigger.String, triggerContext ?? message.Content, severity, actionList).ConfigureAwait(false);
}
catch (Exception e)
{

View File

@ -14,6 +14,7 @@ namespace CompatBot.Utils.Extensions
[FilterAction.IssueWarning] = 'w',
[FilterAction.SendMessage] = 'm',
[FilterAction.ShowExplain] = 'e',
[FilterAction.MuteModQueue] = 'u',
};
public static string ToFlagsString(this FilterAction flags)