The KISS Twitch bot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.7 KiB

2 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # ![Twason - The KISS Twitch bot](logo.svg)
  2. Twason is an opinionated Twitch chatbot created with the [KISS principle](https://en.wikipedia.org/wiki/KISS_principle) in mind.
  3. It is based on the [IRC](https://en.wikipedia.org/wiki/Internet_Relay_Chat) protocol and is configurable in just one JSON file.
  4. ## What the hell is that name!?
  5. Twason is a portmanteau based on two words: _Twitch_ (the platform the bot is designed for) and _Jason_ (as the JSON file that you use to wonfigure it).
  6. ## What features does it provide?
  7. Currently, Twason has the following features:
  8. - **Commands:** automatically answer to messages that start with a given command
  9. - Customizable commands prefix (useful if you're using multiple bots)
  10. - Mention the user who invoked the command in the answer
  11. - Help command auto-generation
  12. - **Timer:** automatically send pre-defined messages
  13. - Only one timer to keep the bot from spamming in the chat
  14. - Configurable time and number of messages between each automatic message
  15. - Two strategies available:
  16. - _round-robin_: send the messages in the same order they have been set in the configuration file
  17. - _shuffle_: send the messages in a random order
  18. More features will be available in the future.
  19. ## How do I use it?
  20. Twason is currently in development and may contain bugs, but it is globally usable. Actually, I'm using it on [my Twitch channel](https://twitch.tv/jdeuchnord).
  21. The simplest (and safest) way to use it is to use the Docker image: [`deuchnord/twason`](https://hub.docker.com/r/deuchnord/twason).
  22. A Docker-Compose file is also available for facility.
  23. ### About the Twitch token
  24. To enable the bot to connect to Twitch chat, you will need to generate a token. Head to the [Twitch Chat OAuth Password Generator](https://twitchapps.com/tmi/) and follow the instructions to generate it.
  25. Then, you will need to give it to the bot through the `TWITCH_TOKEN` environment variable.
  26. ### The JSON configuration file
  27. To configure the bot, you will need to create a JSON file in `config/config.json` as defined in the `docker-compose.yml` file.
  28. You can find a minimal configuration in the `config.json.dist` file in this repository.
  29. Below is the complete configuration reference:
  30. ```json5
  31. {
  32. "nickname": "yourbot", // the Twitch name of your bot
  33. "channel": "yourchannel", // the channel the bot must follow
  34. "command_prefix": "!", // the prefix the commands will have (defaults to '!')
  35. "help": true, // if true, a help command will be automatically generated (defaults to true)
  36. "commands": [ // a list of commands that your bot will recognize and respond to (empty by default)
  37. {
  38. "name": "ping", // the command name - spaces are not recommended here (even though they are technically accepted)
  39. "message": "Pong @{author} Kappa" // the message the bot must send when someone invokes this command ('{author}' will be replaced with the user who invoked the command)
  40. }
  41. ],
  42. "timer": { // the configuration of the automatically sent messages
  43. "between": {
  44. "time": 10, // the minimum time that must have passed between two messages (defaults to 10)
  45. "messages": 10 // the minimum number of messages that the chat members must have sent between two messages (defaults to 10)
  46. },
  47. "strategy": "round-robin", // the strategy used to send the messages: "round-robin" or "shuffle" (defaults to "round-robin")
  48. "messages": [ // the list of messages to send (empty by default)
  49. "Hello World! HeyGuys",
  50. ]
  51. }
  52. }
  53. ```