public async Task Ban(IGuildUser u, int minutes = 0, [Remainder] string reason = null) { string rText = "."; if (reason != null) { rText = $" for: \"{reason}\"."; } string tText = ""; if (minutes != 0) { TimeSpan tSpan = new TimeSpan(0, minutes, 0); var unbanTime = DateTime.Now + tSpan; Var.leaveBanned.Add(u); Var.unbanTime.Add(unbanTime); tText = $"\nThey have been banned until {unbanTime}."; } InfoEmbed banEmb = new InfoEmbed("USER BAN", $"User: {u} has been banned{rText}.{tText}", Constants.Images.Ban); await Context.Guild.AddBanAsync(u, reason : reason); await Context.Channel.SendMessageAsync("", embed : banEmb.Build()); }
public async Task Purge(int amount) { Var.purging = true; var messages = await Context.Channel.GetMessagesAsync(amount + 1).Flatten(); await Context.Channel.DeleteMessagesAsync(messages); InfoEmbed ie = new InfoEmbed("PURGE", $"{amount} messages deleted by {Context.User.Username}."); Var.purgeMessage = await Context.Channel.SendMessageAsync("", embed : ie.Build()); Timers.unpurge = new Timer(new TimerCallback(Timers.UnPurge), null, 5000, Timeout.Infinite); }
public async Task Kick(IUser u, [Remainder] string reason = null) { string rText = "."; if (reason != null) { rText = $" for: \"{reason}\"."; } InfoEmbed kickEmb = new InfoEmbed("USER KICK", $"User: {u} has been kicked{rText}", Constants.Images.Kick); await(u as IGuildUser).KickAsync(reason); await Context.Channel.SendMessageAsync("", embed : kickEmb.Build()); }