Esempio n. 1
0
        private async Task CreateDemoLeaderboardsAsync(SocketGuild guild)
        {
            ITextChannel channel = guild.TextChannels.Where(x => x.Name == "demo-battleground").FirstOrDefault();

            if (channel is null)
            {
                channel = await guild.CreateTextChannelAsync("demo-battleground");

                await channel.AddPermissionOverwriteAsync(guild.EveryoneRole, new OverwritePermissions(sendMessages : PermValue.Deny));

                await channel.AddPermissionOverwriteAsync(_discord.CurrentUser, new OverwritePermissions(sendMessages : PermValue.Allow));
            }

            Bot.demoLeaderboard = await Leaderboard.CreateAsync(LeaderboardType.Demo, 5, channel, _players);

            Bot.KdrLeaderboard = await Leaderboard.CreateAsync(LeaderboardType.KDR, 5, channel, _players);
        }