Created
June 17, 2021 17:55
-
-
Save rvause/c8db121debcd38bbe2cb96fdb8c1769c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple bot to echo events in a Twitch channel. | |
Need to fill out the data in the commands.Bot() call below to connect. | |
irc_token: You can get a token to use here by connecting your account here: https://twitchapps.com/tmi/ | |
client_id: Register a Twitch app and copy the client_id https://dev.twitch.tv/console/apps/create | |
nick: Your twitch username | |
initial_channels: the channels you wish to watch for events on | |
To run the bot you need Python. | |
$ pip install twitchio | |
$ python echobot.py | |
""" | |
from twitchio.ext import commands | |
bot = commands.Bot( | |
irc_token="", | |
client_id="", | |
nick="", | |
prefix="!", | |
initial_channels=[""], | |
) | |
@bot.event | |
async def event_ready(): | |
print("Bot online!") | |
@bot.event | |
async def event_message(ctx): | |
print(f"{ctx.timestamp} {ctx.author}: {ctx.tags}") | |
print(ctx.raw_data) | |
print("") | |
if __name__ == "__main__": | |
bot.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment