コード例 #1
0
        public async Task GetVoters(ulong botId = 0)
        {
            string er = "```\n";

            WebUtil.SetUpDbl(botId == 0 ? Context.Client.CurrentUser.Id : botId);
            var voters = await WebUtil.GetVotersAsync();

            foreach (var id in voters.Take(10))
            {
                er += $"{id.Id}\n";
            }
            er += "...\n";
            foreach (var id in voters.Skip(voters.Count - 10))
            {
                er += $"{id.Id}\n";
            }
            er += "```";
            await ReplyAsync($"Found {voters.Count} new voters.\n {er}");
        }
コード例 #2
0
        private async Task SetUp_FirstShardConnected(DiscordSocketClient arg)
        {
            // Making sure this part only runs once, unless an exception is thrown. Thread safe.
            if (Interlocked.Exchange(ref Startup, 1) == 0)
            {
                try
                {
                    WebUtil.SetUpDbl(arg.CurrentUser.Id);
                    await StartTimers();

                    if (!Development)
                    {
                        await Music.Initialize(Client);
                    }
                    await Client.SetActivityAsync(new Game($"Chinese Cartoons. Try @{arg.CurrentUser.Username} help", ActivityType.Watching));
                }
                catch (Exception ex)
                {
                    Startup = 0;
                    SentrySdk.CaptureException(ex);
                }
            }
        }