예제 #1
0
        public async Task StartAsync()
        {
            config = new DiscordSocketConfig()
            {
                MessageCacheSize = 1000000
            };                                        // initialize the config for the client, and set the message cache size
            Client = new DiscordSocketClient(config); // get the client with the configurations we want

            // Managers
            userDataManager = new UserDataManager(); // This sets up the user data files and loads them into memory
            fileManager     = new FileManager();     // initialize the file manager

            // Initialize Handlers
            _commands = new CommandHandler(Client);
            _logs     = new LogHandler();
            _reaction = new ReactionHandler(Client);
            _general  = new GeneralHandler(Client);

            Client.Ready += OnReady;   // Add the OnReady event

            BotUtils.SaveReady = true; // Tell the class that the autosave loop should start
            BotUtils.GCReady   = true;

            StartThreads();

            await Client.LoginAsync(TokenType.Bot, GetToken());

            await Client.StartAsync();

            KLog.Important("Logged in!");

            await Task.Delay(-1);  // Stop this method from exiting.
        }
예제 #2
0
        public async Task OnReady()
        {
            SetupGeneral();

            await GeneralHandler.UpdateRoleMessage();  // fix the role selection message on startup

            Ready = true;
            KLog.Important("Ready!");
        }