A hackety chat bot I wrote for my twitch stream. I wanted to learn asyncio and this felt like a decent project to dive in on.
-
Set up a configuration file
{ "username": "...", "channel": "...", "oauth_token": "...", "client_id": "..." }
-
Use python3.7 or newer and install
aiohttp
virtualenv venv -ppython3.7 venv/bin/pip install aiohttp
-
Run!
venv/bin/python bot.py
List all the currently supported commands
anthonywritescode: !help
anthonywritescodebot: possible commands: !help, !ohai, !uptime
Greet yo self
anthonywritescode: !ohai
anthonywritescodebot: ohai, anthonywritescode!
Show how long the stream has been running for
anthonywritescode: !uptime
anthonywritescodebot: streaming for: 3 hours, 57 minutes, 17 seconds
Replies PONG
to whatever you say
anthonywritescode: PING
anthonywritescodebot: PONG
anthonywritescode: PING hello
anthonywritescodebot: PONG hello
Show the discord url
anthonywritescode: !discord
anthonywritescodebot: We do have Discord, you are welcome to join: https://discord.gg/HxpQ3px
Show how long you or a user you specified have been following the channel
not_cool_user: !followage
anthonywritescodebot: not_cool_user is not a follower!
cool_user: !followage
anthonywritescodebot: cool_user has been following for 3 hours!
some_user: !followage another_user
anthonywritescodebot: another_user has been following for 5 years!
Get a joke
anthonywritescode: !joke
anthonywritescodebot: The best thing about a Boolean is even if you are wrong, you are only off by a bit.