The KISS Twitch bot
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

README.md 7.2 KiB

il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 configure 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. You can have an interface to create and validate your config file ![here](https://json-editor.github.io/json-editor/?data=N4Ig9gDgLglmB2BnEAuUMDGCA2MBGqIAZglAIYDuApomALZUCsIANOHgFZUZQD62ZAJ5gArlELwwAJzplsrEIgwALKrNSgAJEtXqUIZVCgREKAPRmOteAFodasgDppAczMATKWSJQzAJgAGQJsARj8ze3U2TRh3QkNjUwt3KhEVSSl3RyIpMygKMmtHSKcrBAVYKGwqQgAVAusFFKUpGGg4eEIAQQACLHgiGBceweqR6R6oVUmKGCgVHrwwKB76wvK2KEEIGv0wTm5xNggpSCopWBoNEHhMAGt4MgZr5oxW9vL9WunbjAenqg9MBEHrCERSRbLCrbXaKKCteAuEAAXzYKjI8HgVHkaBAr3esE+IG+gMeDCBILBEPRmOx0J2hEQ8JgiJRaPosng7l4JyogwAHi8aG82oTOvoAApSPkwfl9DkY9wU0GiFZLI4gLYM/RMhFI1EGbEQIUtUUdQgAYQxKpEPTIPBgADcyFBAVNAapsBB5XROUqAPz02FLMDVDFskBYX2K5C4/FmokAGRgTOVVJ9fqDhDIUi8ggUczUsdAWth+y4PAUJzOFxgV1xZN2oHjH3FIAAcgDle6M4qszrmayDXIYIV683hQTzfourmhMqR4VxtSFVz+yAc3mC666MXNTDGYP9QaGIhEGQXE28ZOE22ALI0c+X5VRzObA8DvUog3SgCOIhgaU4hQABtG4AQURdECuNhTyfGoAF0DREW5/yoABJHdY01KQRBqA1YAYKQTRFVtuncJVpQwDBwSoeAVkVO0xHoF1MB6OCLxqd9tXYCsNWrHZa3HEA8CofIqDo65S0IctDirU5BMuPdCKvaT9HgEQ6FE4i2CofkMGwERECdKg7xZGA6E01AAhPR9OOUj8QBZV1Lx0kA9IMoyTLM25LLoazkR/Kh/0AqhgLAlSFA4y9kCQthdRdKgXHzOMbzI/QAFVoKBLEegSlzBEmMAehOZz2LsmL111FkkV0jT/NAkBThQ9wbFOPAWQURBlBEIgiGqEA4pACAwFDEipyTFMVmBG0V2jNduNhTchG3IspMc2TK2OBTziU65G3G29CE7ckZp7V8+0Ww8v2HXAxz3FsxW6OdCpmqDl17Bb9x45b8zYQtd3WnjqqHWyz04w70pAB9wefGaLq+tS4RuoKQqA1AwIOtgoJgkBosQ5DULwzC1v0eE8O/Ng/wA9HGtE8TJPi+FEuSqtRvkJDUZpsKMZue4scjZQMSxeR2Xm7leQFBRPWNIburACheHOU4pGw5zzntJ7Nl0YNRqgBKIAAFm/IA=).
  30. Below is the complete configuration reference:
  31. ```json5
  32. {
  33. "nickname": "yourbot", // the Twitch name of your bot
  34. "channel": "yourchannel", // the channel the bot must follow
  35. "command_prefix": "!", // the prefix the commands will have (defaults to '!')
  36. "help": true, // if true, a help command will be automatically generated (defaults to true)
  37. "commands": [ // a list of commands that your bot will recognize and respond to (empty by default)
  38. {
  39. "name": "ping", // the command name - spaces are not recommended here (even though they are technically accepted)
  40. "aliases": ["pong"],
  41. "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)
  42. }
  43. ],
  44. "timer": { // the configuration of the automatically sent messages
  45. "between": {
  46. "time": 10, // the minimum time that must have passed between two messages (defaults to 10)
  47. "messages": 10 // the minimum number of messages that the chat members must have sent between two messages (defaults to 10)
  48. },
  49. "strategy": "round-robin", // the strategy used to send the messages: "round-robin" or "shuffle" (defaults to "round-robin")
  50. // the messages are actually commands with the same options as above
  51. "pool": [ // a list of commands to send (empty by default)
  52. {
  53. "name": "hello",
  54. "aliases": ["hi"],
  55. "message": "Hello World! HeyGuys"
  56. }
  57. ]
  58. },
  59. "moderator": {
  60. // The configuration of the moderator (see bellow for more information)
  61. }
  62. }
  63. ```
  64. ### The Moderator
  65. Twason has features to help you moderate your chat automatically against most of the nuisance that streamers may face to.
  66. Any moderation feature has to be activated in the configuration in the `moderator` section of the `config.json` file, and have the same options:
  67. ```json5
  68. {
  69. "moderation-feature": { // replace the name with the moderation feature name
  70. "activate": false, // set this to true to activate the feature
  71. "decision": "delete", // the action to take: "delete" or "timeout"
  72. "duration": 5, // if decision is timeout, the duration of the ban, in seconds
  73. "message": "Calm down, {author}" // this message will be sent in the chat when a member becomes a pain in the ass
  74. }
  75. }
  76. ```
  77. Some moderation features may include more options. In this case, they have to be included in the same way.
  78. The available moderation features are the following:
  79. - `caps-lock`: moderate the messages written in CAPS LOCK
  80. Additional options:
  81. - `min-size`: the minimum size of the message to moderate
  82. - `threshold`: the percentage of capital letters that will trigger the moderation
  83. - `flood`: prevent the members of the chat to flood in your chat
  84. Additional options:
  85. - `max-word-length`: the maximum length of a word
  86. - `ignore-hashtags`: if `true`, don't moderate the hashtags (defaults to `false`)
  87. - to moderate the unwanted repetition of messages, you will need to add these two options:
  88. - `max-msg-occurrences`: the number of times a message can be repeated before it gets moderated
  89. - `min-time-between-occurrence`: the time in which a message is counted, in seconds
  90. a member will be moderated if they send `max-msg-occurrences` in `min-time-between-occurrence` seconds
  91. - `raid-cooldown`: when a raid happens, the time in minutes of cooldown in which the flood is authorized