Beispiel #1
0
            public static async Task TriggeredAntiProtection(IGuildUser[] users, PunishmentAction action, ProtectionType protection)
            {
                if (users.Length == 0)
                    return;

                LogSetting logSetting;
                if (!GuildLogSettings.TryGetValue(users.First().Guild.Id, out logSetting)
                    || !logSetting.IsLogging)
                    return;
                ITextChannel logChannel;
                if ((logChannel = TryGetLogChannel(users.First().Guild, logSetting)) == null)
                    return;

                var punishment = "";
                if (action == PunishmentAction.Mute)
                {
                    punishment = "🔇 MUTED";
                    //punishment = "MUTED";
                }
                else if (action == PunishmentAction.Kick)
                {
                    punishment = "☣ SOFT-BANNED (KICKED)";
                    //punishment = "KICKED";
                }
                else if (action == PunishmentAction.Ban)
                {
                    punishment = "⛔️ BANNED";
                    //punishment = "BANNED";
                }
                await logChannel.SendMessageAsync(String.Join("\n",users.Select(user=>$"‼️ {Format.Bold(user.ToString())} got **{punishment}** due to __**{protection}**__ protection on **{user.Guild.Name}** server.")))
                //await logChannel.SendMessageAsync(String.Join("\n",users.Select(user=>$"{Format.Bold(user.ToString())} was **{punishment}** due to `{protection}` protection on **{user.Guild.Name}** server.")))
                                .ConfigureAwait(false);
            }