Esempio n. 1
0
        private async Task MakeActionAsync(Action action, SocketGuildUser user, SocketUserMessage message, SocketRole userRole, SocketRole muteRole, ITextChannel notifChannel)
        {
            switch (action)
            {
            case Action.Warn:
                await message.Channel.SendMessageAsync("",
                                                       embed : $"{user.Mention} zaraz przekroczysz granicę!".ToEmbedMessage(EMType.Bot).Build());

                break;

            case Action.Mute:
                if (muteRole != null)
                {
                    if (user.Roles.Contains(muteRole))
                    {
                        return;
                    }

                    using (var db = new Database.ManagmentContext(_config))
                    {
                        var info = await _moderator.MuteUserAysnc(user, muteRole, null, userRole, db, 24, "spam/flood");

                        await _moderator.NotifyAboutPenaltyAsync(user, notifChannel, info);
                    }
                }
                break;

            case Action.Ban:
                await user.Guild.AddBanAsync(user, 1, "Supervisor(ban) spam/flood");

                break;

            default:
            case Action.None:
                break;
            }
        }