internal static SpamType Merge(SpamType spamType1, SpamType spamType2) { switch (spamType1) { case SpamType.ALL_GOOD: { return(spamType2); } default: { return(spamType1); } } }
public void SetupSpamType(SpamType type) { if (type == SpamType.Maps) { ShowMenu(MapsMenu); } else if (type == SpamType.Mobs) { ShowMenu(MobsMenu); } else if (type == SpamType.Boss) { ShowMenu(BossMenu); } else { ShowMenu(null); } }
public static async Task AntiSpamMeasure(TelegramBotAbstract telegramBotClient, MessageEventArgs e, SpamType checkSpam) { if (checkSpam == SpamType.ALL_GOOD) { return; } await RestrictUser.Mute(60 * 5, telegramBotClient, e.Message.Chat.Id, e.Message.From.Id); var language = e.Message.From.LanguageCode.ToLower(); switch (checkSpam) { case SpamType.SPAM_LINK: { var text2 = new Language(new Dictionary <string, string> { { "en", "You sent a message with spam, and you were muted for 5 minutes" }, { "it", "Hai inviato un messaggio con spam, e quindi il bot ti ha mutato per 5 minuti" } }); await SendMessage.SendMessageInPrivate(telegramBotClient, e, text2); break; } case SpamType.NOT_ALLOWED_WORDS: { var text2 = new Language(new Dictionary <string, string> { { "en", "You sent a message with banned words, and you were muted for 5 minutes" }, { "it", "Hai inviato un messaggio con parole bandite, e quindi il bot ti ha mutato per 5 minuti" } }); await SendMessage.SendMessageInPrivate(telegramBotClient, e, text2); break; } case SpamType.FOREIGN: { var text2 = new Language(new Dictionary <string, string> { { "en", "You sent a message with banned characters, and you were muted for 5 minutes" }, { "it", "Hai inviato un messaggio con caratteri banditi, e quindi il bot ti ha mutato per 5 minuti" } }); await SendMessage.SendMessageInPrivate(telegramBotClient, e, text2); break; } // ReSharper disable once UnreachableSwitchCaseDueToIntegerAnalysis case SpamType.ALL_GOOD: return; default: throw new ArgumentOutOfRangeException(nameof(checkSpam), checkSpam, null); } await telegramBotClient.DeleteMessageAsync(e.Message.Chat.Id, e.Message.MessageId, e.Message.Chat.Type); }
public static async Task PermittedSpamMeasure(TelegramBotAbstract telegramBotClient, MessageEventArgs messageEventArgs, SpamType checkSpam) { var title = ""; if (messageEventArgs is { Message : { Chat : { Title : { } } } })