public async Task Configure() { _client = new DiscordSocketClient(); var configBuilder = new ConfigurationBuilder() .AddCommandLine(_serviceArgs); _configuration = configBuilder.Build(); _commands = new CommandService(); RoomLifetimeService roomLifetimeService = new RoomLifetimeService(_client); roomLifetimeService.Initialize(); _services = new ServiceCollection() .AddDbContext <SasnoBotDbContext>(ServiceLifetime.Scoped) .AddSingleton(_client) .AddSingleton(_commands) .AddSingleton(roomLifetimeService) .AddScoped <IUserManager, UserManager>() .BuildServiceProvider(); await InstallCommandsAsync(); await _client.LoginAsync(TokenType.Bot, _configuration["token"]); await _client.StartAsync(); await Task.Delay(-1); }
public RoomModule(RoomLifetimeService roomLifetimeService) { _roomLifetimeService = roomLifetimeService; }