public async Task Banlookup(string user = "") { if (Context.Channel.Id != _adminChannelId) { return; } if (user == null) { ReplyAsync("`/banlookup <userid, username>` - Search for discord issued bans" + "\n" + "Search by a ID (*Open the ban list, Right click, Copy ID*)"); return; } var bans = _banningService.GetBans(user); if (bans.Count == 0) { ReplyAsync("No bans found."); return; } bans.ForEach(async ban => { if (ban.ExpiresOn != null) { ReplyAsync($"<@{ban.Userid}> ({ban.Name}) by <@{ban.ByUserid}> ({ban.ByName}) on **{ban.BannedOn.DateTime.ToHumanReadableString()}** for **{ban.Reason}**. Ban expires on **{ban.ExpiresOn?.ToHumanReadableString()}**."); } else { ReplyAsync($"<@{ban.Userid}> ({ban.Name}) by <@{ban.ByUserid}> ({ban.ByName}) on **{ban.BannedOn.DateTime.ToHumanReadableString()}** for **{ban.Reason}**. Ban is permanent."); } }); }
private async Task OnUserUnbanned(SocketUser user, SocketGuild server) { var banData = _banningService.GetBans(user.Id.ToString()); if (banData.Count > 0) { Logger.Write($"[OnUserUnbanned] {banData[0].Name} banned by {banData[0].ByName} for {banData[0].Reason}. Lifting..."); _banningService.RemoveBan(user.Id); } Logger.Write($"[OnUserUnbanned] {user.Username}"); }