public async Task RemoveRole(SocketGuildUser user, ulong roleId) { if (testMode) { return; } await user.RemoveRoleAsync(CurGuild.GetRole(roleId)); }
public SocketGuildUser GetUser(ulong userId) { if (testMode) { return(null); } return(CurGuild.GetUser(userId)); }
public ISocketMessageChannel GetChannel(ulong id) { if (testMode) { return(null); } // the bot is designed to only be in one server return(CurGuild.GetTextChannel(id)); }
public async Task <RestCategoryChannel> CreateCategory(string name) { if (testMode) { return(null); } var cat = await CurGuild.CreateCategoryChannelAsync(name); await cat.AddPermissionOverwriteAsync(CurGuild.EveryoneRole, new OverwritePermissions(0, sendInt)); await cat.AddPermissionOverwriteAsync(client.CurrentUser, new OverwritePermissions(botInt, 0)); return(cat); }
public async Task RemoveRoles(SocketGuildUser user, IEnumerable <ulong> roleIds) { if (testMode) { return; } var roles = new List <SocketRole>(); foreach (var id in roleIds) { roles.Add(CurGuild.GetRole(id)); } await user.RemoveRolesAsync(roles); }
public async Task <RestTextChannel> CreateChannel(string name, ulong categoryId = 0, bool everyoneCanSend = false) { if (testMode) { return(null); } var chnl = await CurGuild.CreateTextChannelAsync(name); // deny everyone send message perms if (!everyoneCanSend) { await chnl.AddPermissionOverwriteAsync(CurGuild.EveryoneRole, new OverwritePermissions(0, sendInt)); } // give bot perms to send and manage await chnl.AddPermissionOverwriteAsync(client.CurrentUser, new OverwritePermissions(botInt, 0)); if (categoryId != 0) { await chnl.ModifyAsync(p => p.CategoryId = categoryId); } return(chnl); }