public Task Subreddit(AdminCollectionAction action, string subreddit) { var check = Context.GuildHelper.ListCheck(Context.Server.Reddit.Subreddits, subreddit, subreddit, "server's subreddits"); switch (action) { case AdminCollectionAction.Add: if (!check.Item1) { return(ReplyAsync(check.Item2)); } // TODO: check if subreddit is valid Context.Server.Reddit.Subreddits.Add(subreddit); return(ReplyAsync(check.Item2, document: DocumentType.Server)); case AdminCollectionAction.Remove: if (!Context.Server.Reddit.Subreddits.Contains(subreddit)) { return(ReplyAsync($"You aren't subbed to {subreddit}.")); } Context.Server.Reddit.Subreddits.Remove(subreddit); return(ReplyAsync($"Removed {subreddit} from server's subreddits.", document: DocumentType.Server)); } return(Task.CompletedTask); }
public Task SelfRolesAsync(AdminCollectionAction action, [Remainder] IRole role) { if (role == Context.Guild.EveryoneRole) { return(ReplyAsync("Role can't be everyone role.")); } if (role.IsManaged) { return(ReplyAsync("Can't assign managed roles.")); } var check = Context.GuildHelper.ListCheck(Context.Server.SelfRoles, role.Id, role.Name, "assignable roles"); switch (action) { case AdminCollectionAction.Add: if (!check.Item1) { return(ReplyAsync(check.Item2)); } Context.Server.SelfRoles.Add(role.Id); return(ReplyAsync(check.Item2, document: DocumentType.Server)); case AdminCollectionAction.Remove: if (!Context.Server.SelfRoles.Contains(role.Id)) { return(ReplyAsync($"{role.Name} isn't an assignable role.")); } Context.Server.SelfRoles.Remove(role.Id); return(ReplyAsync($"`{role.Name}` is no longer an assignable role.", document: DocumentType.Server)); } return(Task.CompletedTask); }
public Task BlockXP(AdminCollectionAction action, [Remainder] IRole role) { if (role == Context.Guild.EveryoneRole) { return(ReplyAsync($"Role can't be everyone role.")); } var check = Context.GuildHelper.ListCheck(Context.Server.ChatXP.XPBlockedRoles, role.Id, role.Name, "XP-blocked roles"); switch (action) { case AdminCollectionAction.Add: if (!check.Item1) { return(ReplyAsync(check.Item2)); } Context.Server.ChatXP.XPBlockedRoles.Add(role.Id); return(ReplyAsync(check.Item2, document: DocumentType.Server)); case AdminCollectionAction.Remove: if (!Context.Server.ChatXP.XPBlockedRoles.Contains(role.Id)) { return(ReplyAsync($"{role} isn't blocked from gaining XP.")); } Context.Server.ChatXP.XPBlockedRoles.Remove(role.Id); return(ReplyAsync($"`{role}` has been removed from the XP-blocked roles.", document: DocumentType.Server)); } return(Task.CompletedTask); }
public Task Blacklist(AdminCollectionAction action, IGuildUser user) { if (user.IsBot) { return(Task.CompletedTask); } var profile = Context.GuildHelper.GetProfile(Context.Guild.Id, user.Id); switch (action) { case AdminCollectionAction.Add: if (profile.IsBlacklisted) { return(ReplyAsync($"{user} is already blacklisted.")); } profile.IsBlacklisted = true; Context.GuildHelper.SaveProfile(Context.Guild.Id, user.Id, profile); return(ReplyAsync($"{user} has been blacklisted.")); case AdminCollectionAction.Remove: if (!profile.IsBlacklisted) { return(ReplyAsync($"{user} isn't blacklisted.")); } profile.IsBlacklisted = false; Context.GuildHelper.SaveProfile(Context.Guild.Id, user.Id, profile); return(ReplyAsync($"{user} has been whitelisted.")); } return(Task.CompletedTask); }
public Task LevelRole(AdminCollectionAction action, IRole role, int level = 10) { if (role == Context.Guild.EveryoneRole) { return(ReplyAsync("Role can't be everyone role.")); } if (role.IsManaged) { return(ReplyAsync("Can't assign managed roles.")); } switch (action) { case AdminCollectionAction.Add: if (Context.Server.ChatXP.LeveledRoles.Count == 20) { return(ReplyAsync("You have reached the max number of leveled roles.")); } else if (Context.Server.ChatXP.LeveledRoles.ContainsKey(role.Id)) { return(ReplyAsync($"{role} is already a leveled role.")); } Context.Server.ChatXP.LeveledRoles.Add(role.Id, level); return(ReplyAsync($"Added `{role}` role as a leveled role.", document: DocumentType.Server)); case AdminCollectionAction.Remove: if (!Context.Server.ChatXP.LeveledRoles.ContainsKey(role.Id)) { return(ReplyAsync($"{role} isn't a leveled role.")); } Context.Server.ChatXP.LeveledRoles.Remove(role.Id); return(ReplyAsync($"Removed `{role}` role from leveled roles.", document: DocumentType.Server)); case AdminCollectionAction.Modify: if (!Context.Server.ChatXP.LeveledRoles.ContainsKey(role.Id)) { return(ReplyAsync($"{role} isn't a leveled role.")); } Context.Server.ChatXP.LeveledRoles[role.Id] = level; return(ReplyAsync($"Modified leveled role `{role}`.", document: DocumentType.Server)); } return(Task.CompletedTask); }
public Task JoinMessage(AdminCollectionAction action, [Remainder] string message = null) { var check = Context.GuildHelper.ListCheck(Context.Server.JoinMessages, message, $"```{message}```", "join messages"); switch (action) { case AdminCollectionAction.Add: if (!check.Item1 || message == null) { return(ReplyAsync(check.Item2)); } Context.Server.JoinMessages.Add(message); return(ReplyAsync("Join message has been added.", document: DocumentType.Server)); case AdminCollectionAction.Remove: // TODO: remove menu break; } return(Task.CompletedTask); }