Example #1
0
        private async Task MainAsync()
        {
            client   = new DiscordSocketClient();
            Commands = new CommandService();


            client = new DiscordSocketClient(new DiscordSocketConfig
            {
                LogLevel = LogSeverity.Debug //Set to Error or Critical at Release
            });
            Console.WriteLine("Logging In...");
            await client.LoginAsync(TokenType.Bot, Tokens.token_bot);

            await client.StartAsync();

            Console.WriteLine("Logged In");
            await client.SetGameAsync("$help | THE LINE ONLY GOES UP!!!!!!!");

            economy = MongoUtil.getEconomy();

            CommandHandler ch = new CommandHandler(client, Commands);
            await ch.InstallCommandsAsync();

            client.Ready       += ClientReady;
            client.JoinedGuild += Client_JoinedGuild;
            client.LeftGuild   += Client_LeftGuild;

            //Put stuff here
            //client.MessageReceived += IN COMMAND HANDLER;

            // Block this task until the program is closed.
            await Task.Delay(-1);
        }
Example #2
0
        public static void updateLoop()
        {
            nextUpdate = DateTime.Now.AddHours(2);
            Thread.Sleep(10000);
            while (true)
            {
                if (economy == null)
                {
                    continue;
                }

                if (updates % 4 == 0)
                {
                    economy.updateAll();
                    nextUpdate = DateTime.Now.AddHours(2);
                }

                MongoUtil.updateEcon(CoreClass.economy);
                updates++;
                //Wait 30 mins
                Thread.Sleep(1000 * 60 * 30);
            }
        }
Example #3
0
 public static void manualUpdate()
 {
     economy.updateAll();
     MongoUtil.updateEcon(CoreClass.economy);
 }
Example #4
0
 public static void updateDB()
 {
     MongoUtil.updateEcon(CoreClass.economy);
 }