async Task createCategory(IGuild guild, guildSave guildInfo) { guildInfo.Category = await LogGuild.CreateCategoryAsync(guild.Name); guildInfo.Role = await LogGuild.CreateRoleAsync(guild.Name, GuildPermissions.None, isMentionable : false); await guildInfo.Category.AddPermissionOverwriteAsync(LogGuild.EveryoneRole, new OverwritePermissions(viewChannel : PermValue.Deny, sendMessages : PermValue.Deny)); await guildInfo.Category.AddPermissionOverwriteAsync(guildInfo.Role, new OverwritePermissions(viewChannel : PermValue.Allow)); }
public override void OnReady() { var sv = ReadSave(); var lg = Program.Deserialise <logSave>(sv); GuildMap = lg.guilds ?? new Dictionary <ulong, guildSave>(); if (lg.guildId.HasValue) { LogGuild = Program.Client.GetGuild(lg.guildId.Value); } else { LogGuild = Program.Client.Guilds.FirstOrDefault(x => x.Name == "Logging Guild"); if (LogGuild == null) { var regions = Program.Client.GetOptimalVoiceRegionAsync().Result; LogGuild = Program.Client.CreateGuildAsync("Logging Guild", regions).Result; LogGuild.CreateRoleAsync("Log Master", new GuildPermissions(administrator: true), isMentionable: false).Wait(); } OnSave(); } }