/// <summary> /// The async version of the main method /// </summary> /// <returns></returns> public async Task MainAsync() { // Instantiate Discord Socket Client and hook the logging method _client = new DiscordSocketClient(); _client.Log += Log; // Pass the type of the program as bot and reads the token from a JSON file await _client.LoginAsync(TokenType.Bot, JsonWrapper.ReadJSON(@"E:\Development\_Bots\Discord\Ageha\Ageha\Resources\auth.json").Value <string>("token")); await _client.StartAsync(); // Activate the commands and modules _commandService = new CommandService(); _commandHandler = new CommandHandler(_client, _commandService, '|'); _commandHandler.MessageOnError = true; await _commandHandler.InstallCommandsAsync(); _client.Ready += OnReady; //_client.MessageReceived += OnMessageReceived; // Block this task until the bot is closed (prevent the main method from closing upon completing one task) await Task.Delay(-1); }