Example #1
0
        public async Task Self_Ready()
        {
            //inits
            DataManager.pp_songs               = Utils.InitPpSong();
            DataManager.people_spam            = new Dictionary <ulong, int>();
            DataManager.actions                = new Dictionary <string, Actions.Action>();
            DataManager.otherActions           = new List <Actions.OtherActions.AOtherAction>();
            DataManager.nsfw_content_inprocess = new Dictionary <IUserMessage, IUserMessage>();
            DataManager.actions_used           = SaveStateManager.Load <Dictionary <string, int> >(DataManager.Binary.POP_ACTIONS_FILE) ?? new Dictionary <string, int>();

            //register des actions
            ActionUtils.RegisterActions("DiscordBot.Actions.CommandActions");
            ActionUtils.RegisterActions("DiscordBot.Actions.AdminActions");
            ActionUtils.RegisterActions("DiscordBot.Actions.DeleteActions");
            ActionUtils.RegisterActions("DiscordBot.Actions.OtherActions");

            //mes setups
            Utils.Init();

            try {
                if (!Utils.IsTestBot)
                {
                    //Thread qui regarde les nouveaux scans
                    new Thread(ThreadUtils.QwerteeThread).Start();
                    new Thread(new JapscanMangaCrawler().Crawl).Start();
                }
                new Thread(ThreadUtils.EmptyPeopleSpamStack).Start();
            }
            catch (System.Exception e) {
                e.Display("Problème Threads Self_Ready");
                await Channels.Problems.SendMessagesAsync(e.Message);
            }

            await Channels.Debugs.SendMessageAsync("Bot ready");
        }
Example #2
0
        public async Task Self_Ready()
        {
            //inits
            DataManager.database               = new Database();
            DataManager.pp_songs               = Utils.InitPpSong();
            DataManager.mangasData             = Utils.InitMangasData();
            DataManager.people_spam            = new Dictionary <ulong, int>();
            DataManager.actions                = new Dictionary <string, Actions.Action>();
            DataManager.otherActions           = new List <Actions.OtherActions.AOtherAction>();
            DataManager.nsfw_content_inprocess = new Dictionary <IUserMessage, IUserMessage>();
            DataManager.baned_people           = SaveStateManager.Load <List <ulong> >(DataManager.Binary.BANNED_FILE) ?? new List <ulong>();
            DataManager.actions_used           = SaveStateManager.Load <Dictionary <string, int> >(DataManager.Binary.POP_ACTIONS_FILE) ?? new Dictionary <string, int>();

            //TODO déplacer ça dans la config
            ActionUtils.RegisterActions("DiscordBot.Actions.CommandActions");
            ActionUtils.RegisterActions("DiscordBot.Actions.AdminActions");
            ActionUtils.RegisterActions("DiscordBot.Actions.DeleteActions");
            ActionUtils.RegisterActions("DiscordBot.Actions.OtherActions");

            //mes setups
            Utils.Init();
            DataManager.guild = DataManager._client.GetGuild(309407896070782976);

            try {
                if (!Utils.IsTestBot)
                {
                    //Thread qui regarde les nouveaux scans
                    new Thread(ThreadUtils.MangasCrawlerOnLireScanV2).Start();
                }

                new Thread(ThreadUtils.EmptyBannedPeopleStack).Start();
            }
            catch (System.Exception e) {
                e.DisplayException("Threads ready");
                await Channels.Problems.SendMessagesAsync(e.Message);
            }

            await Channels.Debugs.SendMessageAsync("Bot ready");
        }