コード例 #1
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            Client.Log         += LogWrapper.Log;
            Client.ShardReady  += ShardReady;
            CommandService.Log += LogWrapper.Log;
            await Client.LoginAsync(TokenType.Bot, Config["Token"]).ConfigureAwait(false);

            await Client.StartAsync().ConfigureAwait(false);

            await CommandHandler.InitializeAsync().ConfigureAwait(false);

            CuteDetection.Initialize();
        }
コード例 #2
0
 public BotHostedService(DiscordSocketClient client,
                         IConfiguration config,
                         CommandHandler commandHandler,
                         CommandService commandService,
                         CuteDetection cuteDetection,
                         DiscordLogWrapper logWrapper,
                         ILogger <BotHostedService> logger)
 {
     Client         = client;
     Config         = config;
     CommandHandler = commandHandler;
     CommandService = commandService;
     CuteDetection  = cuteDetection;
     LogWrapper     = logWrapper;
     Logger         = logger;
 }