Package: python-twitch-irc
python-twitch-ircpython-twitch-ircis a layer of logic which takes thePydlepackage and provides (or modifies existing) logic to handle Twitch IRC pecularities.Installationpython-twitch-irccan be installed viapip install python-twitch-ircUsagepython-twitch-ircis a layer which sits abovePydleso if documentation is lacking, refer toPydledocumentation.  Twitch IRC is not fully compliant with RFC1459 and later, so some behaviors may not function as expected (such as who/whois, nick, etc).TwitchUtilizing this library requires a Twitch account and a token generated for that account.  A token can be generated viaTwitchApps.  Note that the generated token has the prefix 'oauth' which should be removed before use.Rate LimitingTwitchIrcdoes not provide rate limiting.  To see rates and limits, seeTwitch Irc Guide.Basic UsageTwitchIrcis expected to be used as a base class.frompython_twitch_ircimportTwitchIrc# Simple echo bot.classMyOwnBot(TwitchIrc):defon_connect(self):self.join('#best_streamer')# Override from base classdefon_message(self,timestamp,tags,channel,user,message):self.message(channel,message)client=MyOwnBot('MyBot','MyTwitchOAuthToken').start()client.handle_forever()Pydle IRC FunctionalityMost of the Basic IRC functionality can be found viaPydle Documentation.  It shold be noted that not all functionality provided byPydleis compatible with Twitch IRC.Twitch IRC functionalityTwitchIrcprovides the following additional functionality.  These functions may or may not require permissioning per channel.defstart(self):# Starts the connection the Twitch IRC serversdefstop(self):# Stops connection to Twitch IRC serversdefwhisper(self,user,message):# Sends a whisper to a userdefmessage(self,target,message):# Sends a message to a channel or whisper to a userdefaction(self,target,message):# Performs the IRC '<username> ACTION'# * John slaps Jim around a bit with a large troutdeftimeout(self,channel,user,seconds,reason=None):# Times a user out for specified seconds from a channeldefban(self,channel,user,reason=None):# Permanently bans a user from a channeldefunban(self,channel,user):# Unbans a user from a channeldefslow(self,channel,seconds):# Sets the message rate of a channel to specified secondsdefslow_off(self,channel):# Turns off slowmodedeffollowers(self,channel,restrict):# Sets a channel to follower mode only.  Restrict should be set to values as# defined here: https://help.twitch.tv/customer/portal/articles/659095-chat-moderation-commandsdeffollowers_off(self,channel):# Turns off follower mode in a channeldefsubscribers(self,channel):# Turns on subscriber mode in a channeldefsubscribers_off(self,channel):# Turns off subscriber mode in a channeldefclear(self,channel):# Clears the chat history in a channeldefr9kbeta(self,channel):# Turns on r9kbeta mode in a channeldefr9kbeta_off(self,channel):# Turns off r9kbeta mode in a channeldefemoteonly(self,channel):# Turns on emote only mode in a channeldefemoteonly_off(self,channel):# Turns off emote only mode in a channeldefcommercial(self,channel,seconds=30):# Runs a commercial in the channel.  Seconds should be an appropriate value# defined here: https://help.twitch.tv/customer/portal/articles/659095-chat-moderation-commandsdefhost(self,channel,target):# Hosts a channeldefunhost(self,channel):# Stops hosting a channeldefmod(self,channel,user):# Gives moderation powers to user in channeldefunmod(self,channel,user):# Removes moderation powers from user in channelTwitch IRC CallbacksTwitchIRCprovides callbacks which can be overriden.  Their purpose/meaning can be divined fromTwitch Irc Guide.defon_cleared_chat(self,timestamp,tags,channel):passdefon_channel_ban(self,timestamp,tags,channel,user):passdefon_hosting(self,timestamp,host,hostee,viewers):passdefon_stop_hosting(self,timestamp,host,viewers):passdefon_notice(self,timestamp,tags,channel,message):passdefon_reconnect_cmd(self,timestamp):passdefon_roomstate(self,timestamp,tags,channel):passdefon_usernotice(self,timestamp,tags,channel,message):passdefon_userstate(self,timestamp,tags,channel):passdefon_whisper(self,timestamp,tags,user,message):passdefon_message(self,timestamp,tags,channel,user,message):passCapabilitiesBy default, capabilities are enabled.  To disable capabilities, override the following functions and returnFalse:defon_capability_twitch_tv_membership_available(self,value):defon_capability_twitch_tv_tags_available(self,value):defon_capability_twitch_tv_commands_available(self,value):DevelopmentDevelopment environment utilizesdockeranddocker-composefor building and testing the library.BuildingThepython_twitch_irclibrary can be build via./build.shTestingThe unit tests can be run via./test.sh.  Local changes can be tested without rebuilding the test container via./test-dev.shbut requires that the initial test container be built.