Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carlosfdez/pytmi
A simple twitch messaging interface parser
https://github.com/carlosfdez/pytmi
asyncio chatbot framework python python3 twitch twitch-irc
Last synced: 5 days ago
JSON representation
A simple twitch messaging interface parser
- Host: GitHub
- URL: https://github.com/carlosfdez/pytmi
- Owner: CarlosFdez
- License: mit
- Created: 2017-08-17T20:44:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-26T20:45:16.000Z (almost 7 years ago)
- Last Synced: 2024-11-09T18:49:25.586Z (2 months ago)
- Topics: asyncio, chatbot, framework, python, python3, twitch, twitch-irc
- Language: Python
- Homepage: https://carlosfdez.github.io/pytmi/
- Size: 188 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# PyTMI
A python library for communicating in the Twitch Messaging Interface ([docs](https://dev.twitch.tv/docs/v5/guides/irc/))
## Why a new library
Unfortunately, I haven't found a good python library for twitch that was simple, extendable, and scalable. Good libraries exist for Javascript ([tmi.js](https://github.com/tmijs/tmi.js)), but I haven't found something for Python.While Python IRC libraries exist (twitch message interface is a weird IRC), most are too complicated to use, not extendable, don't support asyncio, or are for python 2.
Many of the ideas used in this library came from [discord.py](https://github.com/Rapptz/discord.py), a library for creating bots for discord.
## Example
This is an example of the core functionality.
```py
import pytmiconfig = {
'username': "botname",
'password': "oauthstring",
'channels': ["#channelname"]
}client = pytmi.TwitchClient()
@client.event
async def on_message(message):
print("Received message")client.run_sync(**config)
```This is an example of the bot command functionality.
```py
from pytmi.bot import TwitchBotconfig = {
'username': "botname",
'password': "oauthstring",
'channels': ["#channelname"]
}client = pytmi.TwitchBot(prefix='!')
@bot.command()
async def hello(ctx):
await ctx.reply("Hello " + ctx.author.name)client.run_sync(**config)
```More examples are available in the examples/ folder.