public async Task DelAutoRole([Remainder] string name) { await Context.Channel.TriggerTypingAsync(); var autoRoles = await _autoRolesHelper.GetAutoRolesAsync(Context.Guild); var role = Context.Guild.Roles.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.CurrentCultureIgnoreCase)); if (role == null) { await ReplyAsync("That role does not exist!"); return; } if (autoRoles.Any(x => x.Id != role.Id)) { await ReplyAsync("That role is not an autorole yet!"); return; } await _autoRoles.RemoveAutoRoleAsync(Context.Guild.Id, role.Id); await ReplyAsync($"The role {role.Mention} has been removed from the autoroles!"); }
public async Task DelAutoRole([Remainder] string name) { await Context.Channel.TriggerTypingAsync(); var autoRoles = await _autoRolesHelper.GetAutoRolesAsync(Context.Guild); var role = Context.Guild.Roles.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.CurrentCultureIgnoreCase)); if (role == null) { await Context.Channel.SendErrorAsync("Error", "That role does not exist!"); return; } if (autoRoles.Any(x => x.Id != role.Id)) { await Context.Channel.SendErrorAsync("Error", "That role isnt an autorole yet!"); return; } await _autoRoles.RemoveAutoRoleAsync(Context.Guild.Id, role.Id); await Context.Channel.SendSuccessAsync("Success", $"The role {role.Mention} has been removed from the autorole list"); await _serverHelper.SendLogAsync(Context.Guild, "Auto-Role Deleted", $"{Context.User.Mention} has removed the `{role.Name} autorole from the autoroles list`"); }