public async Task Start() { Log.Info("Registering modules..."); await CommandService.AddModulesAsync(Assembly.GetEntryAssembly(), DIHost.ServiceProvider); Log.Info("Registering modules done"); await Client.LoginAsync(TokenType.Bot, EnvUtils.VariableOrThrow(Constants.Environment.DiscordBotToken)); await Client.StartAsync(); StreamNotifier?.Start(); }
public StreamNotifier(DiscordSocketClient discordClient) { Configuration = ConfigurationHost.Current; DiscordClient = discordClient; TwitchAPI = new TwitchAPI(); TwitchAPI.Settings.ClientId = EnvUtils.VariableOrThrow(Constants.Environment.TwitchClientId); TwitchAPI.Settings.AccessToken = EnvUtils.VariableOrThrow(Constants.Environment.TwitchBotToken); LiveStreamMonitor = new LiveStreamMonitorService(TwitchAPI, 20); LiveStreamMonitor.SetChannelsByName(Configuration.TwitchFriends.ToList()); LiveStreamMonitor.OnStreamOnline += async(s, e) => { await LiveStreamMonitor_OnStreamOnline(e); }; ConfigurationHost.ConfigurationChanged += ConfigurationChanged; }