Esempio n. 1
0
        private async Task onShardReady(DiscordSocketClient client)
        {
            shardsReady++;
            await MopsLog(new LogMessage(LogSeverity.Verbose, "", $"Shard {shardsReady} is ready."));

            if (shardsReady == 1)
            {
                Task.Run(() =>
                {
                    foreach (var shard in Client.Shards)
                    {
                        failsafe.Add(new ReliabilityService(shard, ClientLog));
                    }
                });
            }

            if (shardsReady == Client.Shards.Count)
            {
                var map = new ServiceCollection().AddSingleton(Client)
                          .AddSingleton(new InteractiveService(Client));
                provider = map.BuildServiceProvider();

                ReactionHandler = new ReactionHandler();
                ReactionHandler.Install(provider);
                Handler = new CommandHandler();
                Handler.Install(provider).Wait();

                Task.Run(() =>
                {
                    StaticBase.initTracking();
                });
            }
        }
Esempio n. 2
0
 private Task onClientReady()
 {
     Task.Run(() => {
         StaticBase.UpdateStatusAsync();
         StaticBase.initTracking();
     });
     return(Task.CompletedTask);
 }
Esempio n. 3
0
        private async Task Start()
        {
            using (StreamReader sr = new StreamReader(new FileStream("mopsdata//Config.json", FileMode.Open)))
                Config = JsonConvert.DeserializeObject <Dictionary <string, string> >(sr.ReadToEnd());

            StaticBase.UpdateStatusAsync();
            StaticBase.initTracking();

            await Task.Delay(-1);
        }