public async Task Ban([Summary("The user to ban.")] IGuildUser userToBan, [Summary("The reason for banning the user.")][Remainder] string reason = null) { if (_moderationService.GetPermissionLevel(Context.DbGuild, userToBan) > 0) { await ReplyErrorAsync($"**{userToBan.Mention}** is a moderator and thus cannot be banned."); return; } string message = $"**{Context.User.Mention}** has banned you from **{Context.Guild.Name}**"; string reply = $"You have successfully banned **{userToBan.Mention}**"; if (!string.IsNullOrWhiteSpace(reason)) { message += $" for **{reason}**"; reply += $" for **{reason}**"; } await _moderationService.InformUserAsync(userToBan, message + "."); await userToBan.BanAsync(0, reason); await _moderationService.ModLogAsync(Context.DbGuild, Context.Guild, "Ban", Configuration.KickColor, reason, Context.User as IGuildUser, userToBan); var dbUser = await _userRepository.GetUserAsync(userToBan.Id, userToBan.GuildId); if (!dbUser.HasBeenBanned) { await _userRepository.ModifyUserAsync(userToBan, x => x.HasBeenBanned = true); } await ReplyAsync(reply + "."); }
public async Task BanAsync(IGuildUser user, [Remainder] string reason = "No reason specified.") { var victim = user as SocketGuildUser; var author = Context.User as SocketGuildUser; if (Context.User.Id == user.Id) { await ReplyAsync("Just leave"); return; } if (victim.Hierarchy >= author.Hierarchy) { await ReplyAsync("You are not high enough in the Role Hierarchy to do that"); } else { await user.BanAsync(0, reason); UserBanned?.Invoke(this, new ModEventArgs() { OffendingUser = user, ResponsibleModerator = Context.User, Reason = reason }); await ReplyAsync("User " + user.Username + " has been banned. Reason: " + reason); } }
public async Task Ban(string member, params string[] reason) { if (!await Settings.IsAdmin((IGuildUser)Context.User)) { await ReplyAsync("Only an admin can do this command."); return; } IGuildUser user = await Utils.GetUser(member, Context.Guild); if (user == null) { await ReplyAsync("Invalid user"); return; } if (!await Features.Moderation.KickBanCheck.CanBanAsync(Context.Guild)) { await ReplyAsync("I don't have the permission to kick people"); return; } if (!Features.Moderation.KickBanCheck.HaveHighestRole(await Context.Guild.GetCurrentUserAsync(), user)) { await ReplyAsync("I can't kick this user."); return; } await user.BanAsync(0, string.Join(" ", reason)); await user.SendMessageAsync("You were banned from " + Context.Guild.Name + (reason.Length > 1 ? " for the following reason: " + string.Join(" ", reason) : ".")); await ReplyAsync("User " + user.ToString() + " was banned" + (reason.Length > 1 ? " for the following reason: " + string.Join(" ", reason) : ".")); }
public async Task BanUser(IGuildUser user, [Remainder] string reason = "") { _ = Context.Message.DeleteAsync(); try { await user.BanAsync(0, reason); } catch (Discord.Net.HttpException e) { LogUtil.Write("Administration:BanUser", e.Message); _ = Context.User.SendMessageAsync(e.Message); return; } var embed = new EmbedBuilder(); embed.WithAuthor(user.Nickname ?? user.Username, user.GetAvatarUrl() ?? user.GetDefaultAvatarUrl()); embed.WithDescription("User banned"); embed.AddField("Judge", Context.User.Username, true); if (!string.IsNullOrEmpty(reason)) { embed.AddField("Reason", reason, true); } _ = ReplyAsync("", false, embed.Build()); await user.SendMessageAsync($"You have been banned from {Context.Guild.Name}, reason: {reason}"); }
public async Task ban(IGuildUser user = null, [Remainder] string reason = null) { if (user.ToString() == "kevz#2073" || user.Id == 683136306825658418) { await Context.User.SendMessageAsync("You are banned for banning owner."); await(Context.User as IGuildUser).BanAsync(); return; } if (!(Context.User as SocketGuildUser).GuildPermissions.BanMembers && !(Context.User as SocketGuildUser).GuildPermissions.Administrator) { return; } if (user == null) { await ReplyAsync("Syntax : \"ban [user] [reason]\""); } else if (reason == null) { await ReplyAsync("Please provide the reason."); } await user.SendMessageAsync("You were kicked by user " + Context.User + " with reason : \"**" + reason + "**\""); await user.BanAsync(); }
public async Task SoftBan(IGuildUser user) { await user.BanAsync(7); await user.Guild.RemoveBanAsync(user); await Context.Channel.SendMessageAsync("**" + user.ToString() + "** has been softbanned by: **" + Context.User.ToString() + "**"); }
public async Task BanUserAsync(IGuildUser user, [Remainder] string reason = null) { await Mogmog.BanUserAsync(user); await user.BanAsync(reason : reason); await Context.User.SendMessageAsync($"Successfully banned user {user} from {user.Guild.Name}." + (reason != null ? $" Reason: {reason}" : string.Empty)); }
public async Task TempbanUserAsync(IGuildUser user, [Remainder] string parameters = null) { var endTime = DateTimeUtils.GetDateTime(parameters); await Mogmog.TempbanUserAsync(user, endTime); await user.BanAsync(reason : $"Should be unbanned at {endTime.ToLongDateString()}"); await Context.User.SendMessageAsync($"Successfully tempbanned user {user} from {user.Guild.Name} until {endTime.ToLongDateString()}."); }
public async Task Ban(IGuildUser user, int msgRemoveDays = 1, [Remainder] string reason = "Keine Begründung angegeben") { EmbedBuilder embed = new EmbedBuilder(); embed.Color = color; embed.AddField($"{user} wurde gebannt und Nachrichten für {msgRemoveDays} Tag(e) gelöscht", reason); await user.BanAsync(msgRemoveDays, reason); await((ISocketMessageChannel)Program._client.GetChannel(modlogId)).SendMessageAsync("", false, embed.Build()); }
public async Task Ban(IGuildUser user, string reason = "No reason provided.") { if (reason != "No reason provided.") { await user.BanAsync(0, reason); embed.WithTitle($"User Banned"); embed.WithDescription($"{Context.User.Mention} has banned `{user}` with reason: \"{reason}\""); embed.WithColor(Pink); BE(); } else { await user.BanAsync(0, reason); embed.WithTitle($"User Banned"); embed.WithDescription($"{Context.User.Mention} has banned `{user}` without a specified reason."); embed.WithColor(Pink); BE(); } }
public async Task Ban(IGuildUser user, [Remainder] string reason) { if (!enabled) { await ReplyAsync("Module Disabled"); return; } await user.BanAsync(reason : reason); await ReplyAsync("Banning user"); }
public async Task Ban(IGuildUser UserName, int SupprDay, string Reason) { await UserName.BanAsync(SupprDay, Reason); EmbedBuilder embedBuilder = new EmbedBuilder(); embedBuilder.WithTitle("User : "******" has been banned for :\n" + Reason) .WithDescription("By " + Context.User.Mention) .WithColor(Color.DarkRed); await Context.Channel.SendMessageAsync("", false, embedBuilder.Build()); }
public async Task Ban(IGuildUser member) { if (Context.Guild.Owner.Id == member.Id) { await ReplyAsync("You can't ban the guild owner!"); return; } await member.BanAsync(); await ReplyAsync("I didn't like that guy anyways."); }
public async Task Ban(IGuildUser member, [Remainder] string reason) { if (Context.Guild.Owner.Id == member.Id) { await ReplyAsync("You can't ban the guild owner!"); return; } await member.BanAsync(reason : reason + $" (banned by {Context.User.Username} using YukoBot)"); await ReplyAsync("I didn't like that guy anyways."); }
public async Task ExecuteAsync(IGuildUser member, [Remainder] string reason = "Unspecified reason.") { var displayReason = reason.Length >= 75 ? Format.Code(reason.EscapeCodeblock().Truncate(150), "") : Format.Code(Format.Sanitize(reason)); var confirmationEmbed = CreateResponseEmbed(ResponseFormat.Default, "Confirmation", $"Are you sure you want to softban {member.Mention} for {displayReason}?"); var cancelledEmbed = CreateResponseEmbed(ResponseFormat.Cancelled, description: "No action was taken."); var abortedEmbed = CreateResponseEmbed(ResponseFormat.Default, "Aborted", "Interaction timed out."); var msg = await Context.AnswerAsync(embed : confirmationEmbed.Build()); var request = new ConfirmationBuilder() .WithContent(PageBuilder.FromEmbedBuilder(confirmationEmbed)) .WithCancelledEmbed(cancelledEmbed) .WithTimeoutedEmbed(abortedEmbed) .WithConfirmEmote(new Emoji("✅")) .WithDeclineEmote(new Emoji("❌")) .WithUsers((SocketUser)Context.User) .WithDeletion(DeletionOptions.None) .Build(); var result = await Interactivity.SendConfirmationAsync(request, Context.Channel, message : msg); if (result.IsSuccess) { try { await member.BanAsync(reason : reason); await Context.Guild.RemoveBanAsync(member); var successEmbed = CreateResponseEmbed(ResponseFormat.Success, description: $"Softbanned {member.Mention} for {displayReason}"); await msg.ModifyAsync(props => props.Embed = successEmbed.Build()); } catch { var errorEmbed = CreateResponseEmbed(ResponseFormat.Error, description: $"Couldn't softban {member.Mention}. Check if I have enough permissions."); await msg.ModifyAsync(props => props.Embed = errorEmbed.Build()); } } }
public async Task Ban(IGuildUser user, string reason = "No reason provided.") { stopWatch.Start(); if (reason != "No reason provided.") { await user.BanAsync(0, reason); embed.WithTitle($"User Banned"); embed.WithDescription($"{Context.User.Mention} has banned `{user}` with reason: \"{reason}\""); embed.WithColor(Pink); await BE(); stopWatch.Stop(); logger.ConsoleCommandLog(Context, stopWatch.ElapsedMilliseconds); } else { await user.BanAsync(0, reason); embed.WithTitle($"User Banned"); embed.WithDescription($"{Context.User.Mention} has banned `{user}` without a specified reason."); embed.WithColor(Pink); await BE(); stopWatch.Stop(); logger.ConsoleCommandLog(Context, stopWatch.ElapsedMilliseconds); } }
public async Task BanUser(IGuildUser user, [Remainder] string reason = "") { try { await user.BanAsync(0, reason); } catch (Discord.Net.HttpException e) { _ = Logger.Instance.WriteAsync(new LogException(e, "Administration:BanUser", LogSeverity.Error)); _ = FailReply(e.Message); return; } _ = AdminReply("banned", user, reason); }
public async Task HandleWarningAsync(IGuildUser user, Context context) { var dbUser = await _userRepository.GetUserAsync(user.Id, user.GuildId); if (dbUser.Warnings.Count >= context.DbGuild.MaxmimumWarningsBeforeAction) { switch (context.DbGuild.WarnPunishment) { case "mute": var mutedRole = context.Guild.GetRole(context.DbGuild.MutedRoleId); if (mutedRole == null) { await _text.ReplyErrorAsync(context.User, context.Channel, $"there is no muted role set for this server. Please use the `{Configuration.Prefix}SetMutedRole` command to remedy this error."); return; } await user.AddRoleAsync(mutedRole); await _muteRepository.InsertMuteAsync(user, TimeSpan.FromHours(context.DbGuild.WarnMuteLength)); await ModLogAsync(context.DbGuild, context.Guild, "Mute", Configuration.MuteColor, "Exceeded maximum warnings before automatic action.", (IGuildUser)context.User, user); break; case "kick": await user.KickAsync("Exceeded maximum warnings before automatic action."); await ModLogAsync(context.DbGuild, context.Guild, "Kick", Configuration.KickColor, "Exceeded maximum warnings before automatic action.", (IGuildUser)context.User, user); break; case "ban": await user.BanAsync(reason : "Exceeded maximum warnings before automatic action."); await ModLogAsync(context.DbGuild, context.Guild, "Ban", Configuration.BanColor, "Exceeded maximum warnings before automatic action.", (IGuildUser)context.User, user); break; default: return; } } }
public async Task Ban(IGuildUser user, string reason = null) { if (!await ModerationService.ValidPermissions(Context, Context.User as IGuildUser, user, "ban")) { return; } await user.BanAsync(reason : reason); EmbedBuilder embed = new EmbedBuilder().WithDynamicColor(Context).WithDescription($"Banned {user} from {Context.Guild.Name}."); if (!string.IsNullOrWhiteSpace(reason)) { embed.AddField("Reason", reason); } await Context.Channel.EmbedAsync(embed); }
public async Task BanAsync([CheckBotHierarchy][CheckUserHierarchy] IGuildUser user, [Remainder] string reason = null) { await user.SendMessageAsync(embed : NormalizeEmbed("You got banned", $"Server ❯ {Context.Guild.Name}\nResponsible User ❯ {Context.User.Mention}\nReason ❯ {reason ?? "none"}") .Build()); await user.BanAsync(reason : reason); var logItem = _serverService.AddLogItem(Server, ActionType.Ban, reason, Context.User.Id, user.Id); await ReplyEmbedAsync("Member Banned", $"User ❯ {user.Mention}\nReason ❯ {reason ?? $"none, {Context.User.Mention} use {$"reason {logItem.LogId} <reason>".InlineCode()}"}"); await _logService.SendLog(Context.Guild, "Member banned", $"User ❯ {Context.User.Mention} ({(Context.User as IGuildUser)?.Nickname ?? Context.User.Username})\nResponsible User ❯ {Context.User.Mention}\nReason ❯ {reason ?? $"none, {Context.User.Mention} use {$"reason {logItem.LogId} <reason>".InlineCode()}"}\nId ❯ {logItem.LogId}", server : Server); }
public async Task BanAsync(IGuildUser member, [Remainder] string reason = null) { if (reason == null) { reason = "No reason provided."; } try { await member.BanAsync(7, reason); } catch (Exception e) { if (e.Message == "The server responded with error 403: Forbidden") { await Context.Channel.SendMessageAsync($"**{member.Username}#{member.Discriminator}** cannot be banned. Maybe their role is higher than me?"); return; } ; } await Context.Channel.SendMessageAsync($"<:yes:596220835254108192> | **{member.Username}#{member.Discriminator}** have been **__BANNED__** from **{Context.Guild.Name}**"); var embed = new EmbedBuilder() { Color = GetRandomColour() }; embed.WithAuthor("👢 KICKED", Context.Message.Author.GetAvatarUrl(ImageFormat.Png, 2048)) .WithCurrentTimestamp() .WithDescription($"You have been banned from **{Context.Guild.Name}** \nReason : \n```{reason}```") .WithFooter($"Regards, {Context.Guild.Name} Staff", Context.Guild.IconUrl); try { await member.SendMessageAsync("", false, embed.Build()); } catch (Exception e) { if (e.Message == "The server responded with error 50007: Cannot send messages to this user") { return; } }; }
public async Task <RuntimeResult> Kick(IGuildUser user, [Remainder] string reason = "") { if (user.Id == Context.Client.CurrentUser.Id) { return(CustomResult.FromError($"Silly { Context.User.Mention}, I can't kick myself!")); } if (user.Id == Context.User.Id) { return(CustomResult.FromError($"{ Context.User.Mention}, you can't kick yourself")); } string reasonString = (reason.Length == 0) ? "No reason given." : reason; Embed announceE = new EmbedBuilder() { Title = "User Kicked", Color = Color.Green, Description = $"{user.Mention} was kick from the server.", Fields = new List <EmbedFieldBuilder>() { new EmbedFieldBuilder() { Name = "Reason", Value = reasonString } } }.Build(); Embed dmE = new EmbedBuilder() { Title = $"You have been kicked from {Context.Guild.Name} by {Context.User.Username}", Color = Color.Red, Description = reasonString, Timestamp = DateTime.Now }.Build(); await(await user.GetOrCreateDMChannelAsync()).SendMessageAsync(embed: dmE); await user.BanAsync(reason : reasonString); await ReplyAsync(embed : announceE); return(CustomResult.FromSuccess()); }
public static async Task BanAsync(ICommandContext Context, IGuildUser user, [Remainder] string reason) { string message = $"{Context.User.ToString()} banned {user.ToString()}\n{reason}"; EmbedBuilder embed = new EmbedBuilder() { Author = new EmbedAuthorBuilder() { Name = "User Banned", IconUrl = Context.User.GetAvatarUrl() }, Description = message, Color = Color.DarkRed }; await user.BanAsync(0, reason); await Context.Channel.SendMessageAsync(null, false, embed.Build()); //await Util.Logger(new LogMessage(LogSeverity.Info, "Moderation", $"{Context.User.ToString()} banned {user.ToString()}")); await Task.CompletedTask; }
public async Task BanAsync(IGuildUser user = null, [Remainder] string banReason = "No Reason Provided") { var guildUser = Context.Guild.GetUser(Context.User.Id); if (!CheckPermissions(guildUser, "ban")) { return; } if (user == null) { await ReplyAsync("I need to know who you're trying to ban, try `s@help ban` for help"); return; } var targetUser = (user as SocketGuildUser).Nickname ?? (user as SocketGuildUser).Username; await user.BanAsync(7, banReason); await BotLogAsync(guildUser, "s@ban", $"decided to ban ***{targetUser}***.", banReason); }
public async Task banUser(IGuildUser user = null, string reason = "Not specified!", [Remainder] int pruneDays = 0) { if (user == null) { Embed nullUser = new EmbedBuilder() .WithColor(Color.Red) .WithTitle("Ban Command : Error") .AddField("Usage:", "`ban <user> <reason*> <pruneMessages* (days)>`", true) .WithDescription("Bans a user from this server.") .WithFooter("*Optional parameters") .Build(); await Context.Message.Channel.SendMessageAsync(embed : nullUser); } else { try { await user.BanAsync(pruneDays, reason); Embed successBan = new EmbedBuilder() .WithColor(Color.Green) .WithAuthor("Ban Command : Success", user.GetAvatarUrl()) .WithDescription($"Successfully banned {user.Mention}") .Build(); await Context.Message.Channel.SendMessageAsync(embed : successBan); } catch (Exception ex) { Embed errorBan = new EmbedBuilder() .WithColor(Color.Red) .WithTitle("Ban Command : Error") .WithDescription(ex.Message) .WithFooter($"{ex.HResult}") .Build(); await Context.Message.Channel.SendMessageAsync(embed : errorBan); } } }
public async Task Ban(IGuildUser user, [Remainder] string reason = "no reason") { var embed = Helper.GetBuilder(); embed.Title = "❌ Ban ❌"; try { await user.BanAsync(reason : reason); embed.AddField("Banned user", user.Mention); embed.AddField("Reason", reason); } catch (HttpException e) { embed.AddField("Failed to ban user", user.Mention); embed.AddField("Fail reason", e.Message); } embed.AddField("Action authorized by", Context.User.Mention); await ReplyAsync(embed : embed.Build()); }
private async Task UserVerified(IGuildUser guildUser, long forumUserId) { using var uow = _db.UnitOfWork; var wfa = uow.WatchedForumAccounts.GetForGuild(guildUser.GuildId).FirstOrDefault(wfa => wfa.ForumUserId == forumUserId); if (wfa is not null) { switch (wfa.WatchAction) { case Database.Models.WatchAction.NONE: break; case Database.Models.WatchAction.NOTIFY: var channelId = uow.GuildConfigs.For(guildUser.GuildId).ForumAccountWatchNotificationChannelId; if (channelId.HasValue) { var channel = await guildUser.Guild.GetTextChannelAsync(channelId.Value).ConfigureAwait(false); if (channel is not null) { await channel.SendConfirmAsync(GetText("userverified_notify_description", guildUser.GuildId, guildUser.Mention, guildUser.ToString(), $"{forumUserId}", $"{ForumPaths.MembersUrl}{forumUserId}"), GetText("userverified_notify_title", guildUser.GuildId)).ConfigureAwait(false); } } break; case Database.Models.WatchAction.BAN: await guildUser.BanAsync(reason : GetText("userverified_ban_reason", guildUser.GuildId)).ConfigureAwait(false); break; default: break; } } }
public async Task Ban(char lengthFormat, int intLength, IGuildUser infringer, IGuildUser mod, ITextChannel workingChannel, string reason) { //detect length format DateTime length = DateTime.Now; switch (lengthFormat) { case 'm': length = new DateTime(0, 0, 0, 0, intLength, 0); break; case 'h': length = new DateTime(0, 0, 0, intLength, 0, 0); break; case 'd': length = new DateTime(0, 0, intLength, 0, 0, 0); break; } //make reply await workingChannel.SendMessageAsync("Banning " + infringer.Mention + " for " + length + lengthFormat + " for " + reason); //ban user await infringer.BanAsync(reason : reason); //detect if temp ban if (length != null) { //if it is, add the end time to the database //access the database string connectionString = @"Data Source=(localdb)\ProjectsV13;Initial Catalog=THUMPS;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"; string query = "INSERT INTO Punishments VALUES (@Infringer, @Moderator, Ban, @EndDateTime, @Reason)"; using (SqlConnection connection = new SqlConnection(connectionString)) using (SqlCommand command = new SqlCommand(query, connection)) { await connection.OpenAsync(); //convert infringing id long longInfringingId = Convert.ToInt64(infringer.Id); //convert mod id long longModId = Convert.ToInt64(mod.Id); //set varibles command.Parameters.AddWithValue("@Infringer", longInfringingId); command.Parameters.AddWithValue("@Moderator", longModId); command.Parameters.AddWithValue("@EndDateTime", length); command.Parameters.AddWithValue("@Reason", reason); command.ExecuteNonQuery(); } } //make admin embed message EmbedBuilder banLogEmbedBuilder = new EmbedBuilder { Author = new EmbedAuthorBuilder { IconUrl = infringer.GetAvatarUrl(), Name = infringer.Username + " has been warned!" }, Color = new Color(235, 0, 0) }; banLogEmbedBuilder.AddField("Moderator", mod, true).AddField("Channel", workingChannel, true); banLogEmbedBuilder.AddField("Reason", reason); Embed banLogEmbed = banLogEmbedBuilder.Build(); //log in admin log await infringer.Guild.GetTextChannelAsync(adminChannelId).Result.SendMessageAsync(embed: banLogEmbed); }
public async Task BanUser(IGuildUser user, [Remainder] string reason = "No ban reason provided.") { await user.BanAsync(reason : reason); }
private async Task ReactionAdded(Cacheable <IUserMessage, ulong> cachMsg, ISocketMessageChannel chan, SocketReaction reaction) { try { if (await Modules.Settings.IsStaff((IGuildUser)reaction.User.Value)) { var msg = await cachMsg.GetOrDownloadAsync(); if (msg.Embeds.Count == 1 && msg.Author.Id == client.CurrentUser.Id) { var embed = msg.Embeds.ToArray()[0]; if (embed.Footer.Value.Text.StartsWith("Bot Technical Information:")) { dynamic json = JsonConvert.DeserializeObject(string.Join(":", embed.Footer.Value.Text.Split(':').Skip(1))); IGuild guild = ((ITextChannel)chan).Guild; IGuildUser reportedUser = await guild.GetUserAsync((ulong)json.UserId); if (reaction.Emote.Name == "♻") { await msg.RemoveAllReactionsAsync(); await msg.ModifyAsync(x => x.Embed = CreateReportEmbed("Message from " + reportedUser.ToString() + " (" + reportedUser.Id + ") was deleted", embed, reportedUser, reaction.User.Value)); var deleteMsg = await(await guild.GetTextChannelAsync((ulong)json.ChannelId)).GetMessageAsync((ulong)json.MessageId); if (deleteMsg != null) { await deleteMsg.DeleteAsync(); } } if (reaction.Emote.Name == "⚠") { if (reportedUser == null) { await reaction.User.Value.SendMessageAsync("I wasn't able to warn user " + reportedUser.ToString() + " because he is no longer in the guild."); } else { await reportedUser.SendMessageAsync("One of your message was reported for the following reason: " + (string)json.Flag); await msg.RemoveAllReactionsAsync(); await msg.ModifyAsync(x => x.Embed = CreateReportEmbed(reportedUser.ToString() + " (" + reportedUser.Id + ") got a warning", embed, reportedUser, reaction.User.Value)); var deleteMsg = await(await guild.GetTextChannelAsync((ulong)json.ChannelId)).GetMessageAsync((ulong)json.MessageId); if (deleteMsg != null) { await deleteMsg.DeleteAsync(); } } } else if (reaction.Emote.Name == "👢") { if (reportedUser == null) { await reaction.User.Value.SendMessageAsync("I wasn't able to kick user " + reportedUser.ToString() + " because he is no longer in the guild."); } else if (await Features.Moderation.KickBanCheck.CanKickAsync(guild) && Features.Moderation.KickBanCheck.HaveHighestRole(await guild.GetCurrentUserAsync(), reportedUser)) { await reportedUser.SendMessageAsync("You were kicked from " + guild.Name + " for the following reason: " + (string)json.Flag); await reportedUser.KickAsync((string)json.Flag); await msg.RemoveAllReactionsAsync(); await msg.ModifyAsync(x => x.Embed = CreateReportEmbed(reportedUser.ToString() + " (" + reportedUser.Id + ") was kicked", embed, reportedUser, reaction.User.Value)); var deleteMsg = await(await guild.GetTextChannelAsync((ulong)json.ChannelId)).GetMessageAsync((ulong)json.MessageId); if (deleteMsg != null) { await deleteMsg.DeleteAsync(); } } else { await reaction.User.Value.SendMessageAsync("I wasn't able to kick user " + reportedUser.ToString() + ", I'm lacking the proper authorisations."); } } else if (reaction.Emote.Name == "🔨") { if (reportedUser == null) { await reaction.User.Value.SendMessageAsync("I wasn't able to ban user " + reportedUser.ToString() + " because he is no longer in the guild."); } else if (await Features.Moderation.KickBanCheck.CanBanAsync(guild) && Features.Moderation.KickBanCheck.HaveHighestRole(await guild.GetCurrentUserAsync(), reportedUser)) { await reportedUser.SendMessageAsync("You were banned from " + guild.Name + " for the following reason: " + (string)json.Flag); await reportedUser.BanAsync(0, (string)json.Flag); await msg.RemoveAllReactionsAsync(); await msg.ModifyAsync(x => x.Embed = CreateReportEmbed(reportedUser.ToString() + " (" + reportedUser.Id + ") was banned", embed, reportedUser, reaction.User.Value)); var deleteMsg = await(await guild.GetTextChannelAsync((ulong)json.ChannelId)).GetMessageAsync((ulong)json.MessageId); if (deleteMsg != null) { await deleteMsg.DeleteAsync(); } } else { await reaction.User.Value.SendMessageAsync("I wasn't able to ban user " + reportedUser.ToString() + ", I'm lacking the proper authorisations."); } } else if (reaction.Emote.Name == "❌") { await msg.DeleteAsync(); } } } } } catch (Exception e) { await reaction.User.Value.SendMessageAsync("An internal error happened while doing moderation using emotes." + Environment.NewLine + "Here are the technical information: " + e.ToString()); } }