Exemplo n.º 1
0
        public async Task ForceBan([Summary("The ID to ban")] ulong id,
                                   [Summary("Time of ban")] TimeSpan time,
                                   [Summary("Reason for ban")] string reason = "N/A")
        {
            await Context.Guild.AddBanAsync(id);

            var ban = await _records.AddTempBanAsync(new TempBan
            {
                GuildId     = Context.Guild.Id,
                SubjectId   = id,
                SubjectName = "N/A (FORCEBANNED)",
                ModeratorId = Context.User.Id,
                Timestamp   = DateTime.UtcNow,
                UnbanAt     = DateTime.UtcNow.Add(time),
                Reason      = reason,
                Active      = true
            });

            _unpunish.Bans.Add(ban);
            _records.DisposeContext();
            var author = Context.User as SocketGuildUser;
            await _log.LogModMessageAsync($"**{author.Nickname ?? author.Username}** forcebanned **{id}*** for {time.Humanize(5)} for `{reason}`");

            await ReplyAsync(":ok:");
        }