public async Task StartAsync() { _client = new TwitchRestClient(new TwitchRestConfig() { LogLevel = LogLevel.Info }); _client.Log += OnLogAsync; Console.Write("Please enter your oauth token: "); string token = Console.ReadLine(); var info = await _client.LoginAsync(token); var channel = await _client.GetChannelAsync(info.UserId); string previous = channel.Status; while (true) { Console.WriteLine(); Console.Write("Please enter a new value for the stream title: "); string title = Console.ReadLine(); await channel.ModifyAsync(x => { x.Status = title; }); Console.WriteLine($"I changed {channel.DisplayName}'s status from `{previous}` to `{channel.Status}`"); previous = channel.Status; } }
public async Task Start() { string token = ""; string clientId = ""; try { _client = new TwitchRestClient(new TwitchRestConfig { ClientId = clientId, LogLevel = LogSeverity.Debug, }); _client.Log += OnLogAsync; await _client.LoginAsync(token); var user = await _client.GetCurrentUserAsync(); } catch (Exception ex) { Console.WriteLine(ex); } await Task.Delay(-1); }
public async Task StartAsync() { Console.Write("Please enter your client id: "); string clientid = Console.ReadLine(); _client = new TwitchRestClient(new TwitchRestConfig() { ClientId = clientid, LogLevel = LogSeverity.Info }); _client.Log += OnLogAsync; while (true) { Console.WriteLine(); Console.Write("Enter the name of a stream: "); string name = Console.ReadLine(); var user = (await _client.GetUsersAsync(name)).FirstOrDefault(); if (user == null) { Console.WriteLine($"The user `{name}` does not exist!"); continue; } var stream = await _client.GetStreamAsync(user.Id); if (stream == null) { Console.WriteLine($"{user.DisplayName} is not currently streaming."); } else { Console.WriteLine($"{user.DisplayName} is streaming {stream.Game} at {stream.Channel.Url}!"); } } }