{"id":13338846,"url":"https://github.com/tomaarsen/TwitchRandomRecipe","last_synced_at":"2025-03-11T10:32:08.952Z","repository":{"id":109767107,"uuid":"251565088","full_name":"tomaarsen/TwitchRandomRecipe","owner":"tomaarsen","description":"Allow chat to generate some horrible recipes","archived":false,"fork":false,"pushed_at":"2021-06-01T16:03:23.000Z","size":75,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T00:05:28.484Z","etag":null,"topics":["bot","generator","python","recipe","recipe-generator","twitch","twitch-bot","twitchbot"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomaarsen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-31T10:03:25.000Z","updated_at":"2022-01-23T17:36:10.000Z","dependencies_parsed_at":"2023-06-11T16:31:07.229Z","dependency_job_id":null,"html_url":"https://github.com/tomaarsen/TwitchRandomRecipe","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomaarsen%2FTwitchRandomRecipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomaarsen%2FTwitchRandomRecipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomaarsen%2FTwitchRandomRecipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomaarsen%2FTwitchRandomRecipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomaarsen","download_url":"https://codeload.github.com/tomaarsen/TwitchRandomRecipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243015495,"owners_count":20222087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","generator","python","recipe","recipe-generator","twitch","twitch-bot","twitchbot"],"created_at":"2024-07-29T19:17:22.424Z","updated_at":"2025-03-11T10:32:08.929Z","avatar_url":"https://github.com/tomaarsen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TwitchRandomRecipe\n Allow chat to generate some horrible recipes\n\n---\n\n# Explanation\nWhen the bot has started, it will start listening to chat messages in the channel listed in the `settings.json` file. Whenever such a chat message starts with `!recipe`, the bot will randomly pick a message format like `Boil {amount} {measurement} of {ingredient} together with {amount} {measurement} of {vegetable}, with some fried {vegetable}` and replace all sections wrapped in curly braces with some randomly picked phrase of that type.\n\nA possible output is:\n\u003cpre\u003e\n\u003cb\u003eBoil 5/8 jars of dr pepper together with 13 fluid ounces of watermelon, with some fried radish.\u003c/b\u003e\n\u003c/pre\u003e\nDoesn't that sound just delicious?\n\n---\n\n## How it works\nAlongside the `TwitchRandomRecipe.py` that controls it all, is a `corpus` directory, containing all text to be generated. The file `formats.txt` must always exist within this `corpus` directory. This file contains all text formats to be filled in.\u003cbr\u003e\nSome examples are:\n\u003cpre\u003e\nTry {amount} {measurement} of {ingredient} with {amount} {measurement} of {vegetable}, topped with {herb} and {herb}.\nHow about {amount} {measurement} of {ingredient}, together with {amount} {measurement} of {ingredient}, and seasoned with some {herb}.\nMix some {vegetable} with {amount} {measurement} of {ingredient}, served ontop of {ingredient}.\n\u003c/pre\u003e\nAs you can see, these formats contain words within curly brackets, also known as *tags*. When generating a recipe using one of these formats, a tag `{amount}` will be replaced with a random item in `corpus/amount.txt`.\u003cbr\u003e\nSimilarly, the tag `{measurement}` will be replaced with a random item from `corpus/measurement.txt`, and so on.\n\nThis means that if you wanted to add or change some formats to include fruits, you can make the file `fruit.txt` in the `corpus` directory, and add the `{fruit}` tag to your formats.\u003cbr\u003e\nThis file `fruit.txt` might look like:\n\u003cpre\u003e\napple\napricot\navocado\nbanana\nbell pepper\nbilberry\nlackberry\nblackcurrant\nblood orange\nblueberry\n...\n\u003c/pre\u003e\nThe majority of the existing files within `corpus.txt` are from [schollz](https://github.com/schollz)'s [ingredients](https://github.com/schollz/ingredients/tree/master/corpus) repository. I thank him for providing an open sourced list of ingredients, vegetables, fruits and more.\n\nBecause of the flexibility of this system, it is even possible to make formats with tags and corresponding text files that are completely unrelated to recipes. You could make formats about games:\u003cbr\u003e\n\u003cpre\u003eDid you see that {streamer} beat {proplayer} in {game} last night?\u003c/pre\u003e\nor art inspiration:\u003cbr\u003e\n\u003cpre\u003eYou should {artform} a {jobtitle} riding a {creature}.\u003c/pre\u003e\nor even sport predictions:\u003cbr\u003e\n\u003cpre\u003e{nhlteam} will beat {nhlteam} {score} to {score}.\u003c/pre\u003e\n\n---\n### Cooldown\n\nTo prevent spam, a cooldown between `!recipe` uses is implemented. To further reduce spam, whenever a user hits such a cooldown, they are whispered the time until the cooldown expires, rather than being told so in chat. Users can whisper the bot `!nopm` to disable these cooldown whispers, and `!yespm` to (re)enable the cooldown private messages.\n\nThe length of this cooldown in seconds can be modified in the `settings.json` file. For more information, see the [Settings](#settings) section below.\n\n---\n\n# Settings\nThis bot is controlled by a settings.txt file, which looks like:\n```json\n{\n    \"Host\": \"irc.chat.twitch.tv\",\n    \"Port\": 6667,\n    \"Channel\": \"#\u003cchannel\u003e\",\n    \"Nickname\": \"\u003cname\u003e\",\n    \"Authentication\": \"oauth:\u003cauth\u003e\",\n    \"Cooldown\": 20,\n}\n```\n\n| **Parameter**        | **Meaning** | **Example** |\n| -------------------- | ----------- | ----------- |\n| Host                 | The URL that will be used. Do not change.                         | \"irc.chat.twitch.tv\" |\n| Port                 | The Port that will be used. Do not change.                        | 6667 |\n| Channel              | The Channel that will be connected to.                            | \"#CubieDev\" |\n| Nickname             | The Username of the bot account.                                  | \"CubieB0T\" |\n| Authentication       | The OAuth token for the bot account.                              | \"oauth:pivogip8ybletucqdz4pkhag6itbax\" |\n| Cooldown | A cooldown in seconds between generations. | 20 |\n\n*Note that the example OAuth token is not an actual token, but merely a generated string to give an indication what it might look like.*\n\nI got my real OAuth token from https://twitchapps.com/tmi/.\n\n---\n\n# Requirements\n* [Python 3.6+](https://www.python.org/downloads/)\n* [Module requirements](requirements.txt)\u003cbr\u003e\nInstall these modules using `pip install -r requirements.txt` in the commandline.\n\nAmong these modules is my own [TwitchWebsocket](https://github.com/CubieDev/TwitchWebsocket) wrapper, which makes making a Twitch chat bot a lot easier.\nThis repository can be seen as an implementation using this wrapper.\n\n---\n\n# Other Twitch Bots\n\n* [TwitchMarkovChain](https://github.com/CubieDev/TwitchMarkovChain)\n* [TwitchAIDungeon](https://github.com/CubieDev/TwitchAIDungeon)\n* [TwitchGoogleTranslate](https://github.com/CubieDev/TwitchGoogleTranslate)\n* [TwitchCubieBotGUI](https://github.com/CubieDev/TwitchCubieBotGUI)\n* [TwitchCubieBot](https://github.com/CubieDev/TwitchCubieBot)\n* [TwitchRandomRecipe](https://github.com/CubieDev/TwitchRandomRecipe)\n* [TwitchUrbanDictionary](https://github.com/CubieDev/TwitchUrbanDictionary)\n* [TwitchRhymeBot](https://github.com/CubieDev/TwitchRhymeBot)\n* [TwitchWeather](https://github.com/CubieDev/TwitchWeather)\n* [TwitchDeathCounter](https://github.com/CubieDev/TwitchDeathCounter)\n* [TwitchSuggestDinner](https://github.com/CubieDev/TwitchSuggestDinner)\n* [TwitchPickUser](https://github.com/CubieDev/TwitchPickUser)\n* [TwitchSaveMessages](https://github.com/CubieDev/TwitchSaveMessages)\n* [TwitchMMLevelPickerGUI](https://github.com/CubieDev/TwitchMMLevelPickerGUI) (Mario Maker 2 specific bot)\n* [TwitchMMLevelQueueGUI](https://github.com/CubieDev/TwitchMMLevelQueueGUI) (Mario Maker 2 specific bot)\n* [TwitchPackCounter](https://github.com/CubieDev/TwitchPackCounter) (Streamer specific bot)\n* [TwitchDialCheck](https://github.com/CubieDev/TwitchDialCheck) (Streamer specific bot)\n* [TwitchSendMessage](https://github.com/CubieDev/TwitchSendMessage) (Meant for debugging purposes)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomaarsen%2FTwitchRandomRecipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomaarsen%2FTwitchRandomRecipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomaarsen%2FTwitchRandomRecipe/lists"}