Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jazzpi/sirc

Easy-to-use IRC library with focus on the Twitch.TV IRC interface
https://github.com/jazzpi/sirc

Last synced: 11 days ago
JSON representation

Easy-to-use IRC library with focus on the Twitch.TV IRC interface

Awesome Lists containing this project

README

        

# Simply IRC

This is a easy-to-use IRC library mainly focused on the Twitch.TV IRC interface
based on asynchat. To use it, simply create a class and make it inherit from
`IRCConnection` or `TwitchIRCClient`:

```python
class MyTwitchBot(TwitchIRCClient):

def __init__(self, *args, **kwargs):
# Call the __init__ method in the superclass to initialize the
# connection
super().__init__(*args, **kwargs)
self.join_channel("#twitchusername")

def handle_privmsg(self, channel, user, msg):
# Overwrite this method to handle chat messages
if msg.lower().startswith("!hello"):
self.queue_message(channel, "Hello {}! I'm a bot!".format(user))

def handle_join(self, channel, user):
# Overwrite this method to handle users joining the chat
super().handle_join(channel, user)
self.queue_message(channel, "Welcome {} to the chat :)".format(user))

def handle_part(self, channel, user):
super().handle_part(channel, user)
self.queue_message(channel, "Goobye {} :(".format(user))
```

For more information on the methods, look into the source code and the
docstrings.

## Dependencies

This library depends on the `asynchat` and `schedule` libraries.