private async Task StoreRoles(SocketGuildUser target) { try { var storeRoles = new StoreRoleMethods(); await storeRoles.StoreUserRoles(Context, target); await Context.Channel.SendMessageAsync($"{target.Username} successfully had their roles stored"); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task KickUser(SocketGuildUser user, [Remainder] string reason) { if (Helpers.IsRole(UtilityRoles.Moderator, (SocketGuildUser)user)) { await Context.Channel.SendMessageAsync("stop fighting urselves u retards"); return; } if (reason.Length < 1) { reason = "cya"; } string kickTargetName = user.Username; try { await user.KickAsync(reason); var embed = new EmbedBuilder(); embed.WithTitle($"✅ {Context.User.Username} _booted_ {kickTargetName}"); embed.WithDescription($"reason: **{reason}**"); embed.WithColor(new Color(0, 255, 0)); await Context.Channel.SendMessageAsync("", false, embed.Build()); } catch (Exception ex) { await ExceptionHandler.HandleExceptionPublically(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } try { var storeRoles = new StoreRoleMethods(); await storeRoles.StoreUserRoles(Context, user as SocketGuildUser); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task BanUser(SocketGuildUser user, [Remainder] string reason) { string kickTargetName = user.Username; if (Helpers.IsRole(UtilityRoles.Moderator, (SocketGuildUser)user)) { await Context.Channel.SendMessageAsync("stop fighting urselves u retards"); return; } try { await user.Guild.AddBanAsync(user, 0, reason); var embed = new EmbedBuilder(); embed.WithTitle($"✅ {Context.User.Username} banned {kickTargetName}"); embed.WithDescription($"reason: _{reason}_"); embed.WithColor(new Color(0, 255, 0)); await Context.Channel.SendMessageAsync("", false, embed.Build()); } catch (Exception ex) { await Context.Channel.SendMessageAsync("unable to ban user ! " + ex.Message); } try { var storeRoles = new StoreRoleMethods(); await storeRoles.StoreUserRoles(Context, user as SocketGuildUser); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }