コード例 #1
0
        public async Task StartAsync()
        {
            string Token = Environment.GetEnvironmentVariable("FalopaBotToken");

            if (string.IsNullOrWhiteSpace(Token))
            {
                throw new Exception("Please enter your bot's token into the `_configuration.json` file found in the applications root directory.");
            }

            await Discord.LoginAsync(TokenType.Bot, Token);

            await Discord.StartAsync();

            await Commands.AddModulesAsync(Assembly.GetEntryAssembly(), Provider);

            await Commands.AddExternalModulesAsync("FalopaBot.Lib", Provider);

            Commands.AddTypeReader(typeof(bool), new BooleanTypeReader());
            Commands.AddTypeReader(typeof(Drug), new DrugTypeReader());
        }