Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public TwitchBot()
- {
- connectionCredentials = new ConnectionCredentials(TwitchInfo.BotName, TwitchInfo.AccessToken);
- random = new Random();
- CreateCommands();
- Connection();
- var channelInfo = new TwitchLib.Api.Models.v5.Channels.Channel();
- twitchAPI = new TwitchLib.Api.TwitchAPI();
- twitchAPI.Settings.ClientId = TwitchInfo.ClientId;
- twitchAPI.Settings.AccessToken = TwitchInfo.AccessToken;
- DisplayResultAsync();
- }
- static async void DisplayResultAsync()
- {
- await ExampleCallsAsync();
- }
- void Connection()
- {
- twitchClient = new TwitchClient();
- twitchClient.Initialize(connectionCredentials, TwitchInfo.Channel);
- twitchClient.OnMessageReceived += TwitchClient_OnMessageReceived;
- twitchClient.OnWhisperReceived += TwitchClient_OnWhisperReceived;
- twitchClient.OnUserJoined += TwitchClient_OnUserJoined;
- twitchClient.OnChatCommandReceived += TwitchClient_OnChatCommandReceived;
- twitchClient.Connect();
- }
- private static async Task ExampleCallsAsync()
- {
- //Checks subscription for a specific user and the channel specified.
- Subscription subscription = await twitchAPI.Channels.v5.CheckChannelSubscriptionByUserAsync(TwitchInfo.Channel, "stribog45");
- //Gets a list of all the subscritions of the specified channel.
- //var allSubscriptions = await twitchAPI.Channels.v5.GetAllSubscribersAsync(TwitchInfo.Channel);
- //Get channels a specified user follows.
- //GetUsersFollowsResponse userFollows = await twitchAPI.Users.helix.GetUsersFollowsAsync("stribog45");
- //Get Spedicified Channel Follows
- //var channelFollowers = await twitchAPI.Channels.v5.GetChannelFollowersAsync(TwitchInfo.ClientId);
- //Return bool if channel is online/offline.
- bool isStreaming = await twitchAPI.Streams.v5.BroadcasterOnlineAsync(TwitchInfo.Channel);
- //Update Channel Title/Game
- //await twitchAPI.Channels.v5.UpdateChannelAsync("channel_id", "New stream title", "Stronghold Crusader");
- }
Add Comment
Please, Sign In to add comment