TwitchLib / TwitchLib

C# Twitch Chat, Whisper, API and PubSub Library. Allows for chatting, whispering, stream event subscription and channel/account modification. Supports everything that supports .NETStandard 2.0
https://twitchlib.github.io
MIT License
841 stars 147 forks source link

Unable to sustain a connection between client and Twitch chat #382

Closed RobertHawkes closed 6 years ago

RobertHawkes commented 6 years ago

I don't think this is an actual issue with the repository but probably me being a complete newbie to using it.

What I'm trying to do is get the bot to connect however when the bot is running and printing to the screen, it shows that is is connecting but also shows "unaccounted for" messages and then a "Disconnecting Twitch chat client" message. From there, it doesn't show any messages in the twitch channel. My current code is attached, please ignore the references to "TagBot" as that is a separate bot for Discord. My tokens and other sensitive information is stored outside of the program in a JSON file that is read by the information.cs class.

Program.cs: https://pastebin.com/5U91zPnf TwitchBot.cs: https://pastebin.com/X0fxD7VC Information.cs: https://pastebin.com/FBnU5GYu

Here's the screenshots of the console output: consoleoutput1

consoleoutput2

Any help will be much appreciated (I bet you I'm being super dumb and look silly submitting this issue)

RobertHawkes commented 6 years ago

Ok, so after a little bit of experimenting I found the issue. My main issue was that I was attempting to use "static" however because the bot uses async it would run it but then not continue, hence the Disconnect.

swiftyspiffy commented 6 years ago

Good catch on this, I didn't even think about that. Thanks for the update!