Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        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);
        }