Exemplo n.º 1
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            Log.Information("Migrating Database...");
            await _databaseContext.Database.MigrateAsync(cancellationToken);

            Log.Information("Activating NATS responders");
            _natsResponders = NatsResponder.ActivateAll(_serviceProvider);
            // We need to access the IEnumerable for them to actually activate :(
            Log.Debug("Found {count} responders: {@names}", _natsResponders.Count(), _natsResponders.Select(x => x.GetType().Name));

            Log.Information("Ready :)");

            await Task.Delay(-1, cancellationToken);
        }
Exemplo n.º 2
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            Log.Information("Activating NATS responders");
            _natsResponders = NatsResponder.ActivateAll(_serviceProvider);
            // We need to access the IEnumerable for them to actually activate :(
            Log.Debug("Found {count} responders: {@names}", _natsResponders.Count(), _natsResponders.Select(x => x.GetType().Name));

            Log.Debug("Initializing command handler");
            await _commandHandler.InitializeAsync();

            Log.Information("Logging in...");
            await _discordService.LoginAndStart();

            Log.Information("Bot started");
        }