{"id":13758375,"url":"https://github.com/tsoding/HyperNerd","last_synced_at":"2025-05-10T08:30:23.448Z","repository":{"id":91698204,"uuid":"119269073","full_name":"tsoding/HyperNerd","owner":"tsoding","description":" Total Surveillance Automatic Ban Machine for Twitch and Discord","archived":false,"fork":false,"pushed_at":"2020-10-19T11:17:32.000Z","size":1170,"stargazers_count":148,"open_issues_count":196,"forks_count":15,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-29T12:19:20.417Z","etag":null,"topics":["chatbot","hacktoberfest","hacktoberfest2020","haskell","irc","irc-bot","stream","tsoding-streams","twitch","twitch-api"],"latest_commit_sha":null,"homepage":"https://www.twitch.tv/tsoding","language":"Haskell","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/tsoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2018-01-28T15:11:12.000Z","updated_at":"2025-03-04T17:58:20.000Z","dependencies_parsed_at":"2024-01-15T03:42:52.807Z","dependency_job_id":null,"html_url":"https://github.com/tsoding/HyperNerd","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/tsoding%2FHyperNerd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2FHyperNerd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2FHyperNerd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2FHyperNerd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsoding","download_url":"https://codeload.github.com/tsoding/HyperNerd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253389376,"owners_count":21900749,"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":["chatbot","hacktoberfest","hacktoberfest2020","haskell","irc","irc-bot","stream","tsoding-streams","twitch","twitch-api"],"created_at":"2024-08-03T13:00:28.780Z","updated_at":"2025-05-10T08:30:23.195Z","avatar_url":"https://github.com/tsoding.png","language":"Haskell","funding_links":["https://www.patreon.com/tsoding"],"categories":["Libraries"],"sub_categories":["Haskel"],"readme":"[![Tsoding](https://img.shields.io/badge/twitch.tv-tsoding-purple?logo=twitch\u0026style=for-the-badge)](https://www.twitch.tv/tsoding)\n# HyperNerd\n\n[![Build Status](https://travis-ci.org/tsoding/HyperNerd.svg?branch=master)](https://travis-ci.org/tsoding/HyperNerd)\n[![Good For Stream](https://img.shields.io/github/issues/tsoding/HyperNerd/good%20for%20stream.svg)](https://github.com/tsoding/hypernerd/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+for+stream%22)\n\n![HyperNerd](https://i.imgur.com/07Ymbi6.png)\n\nSecond iteration of [Tsoder][tsoder]. Chat bot for [Tsoding][tsoding] streams.\n\n## Quick Start\n\n### NixOS\n\nKeep in mind that we are not using any Haskell packages from nixpkgs. All of the dependencies are supposed to be downloaded by cabal or stack during the build.\n\n#### Cabal v1-build\n\n```console\n$ nix-shell\n$ cabal sandbox init\n$ cabal install happy-1.19.9\n$ cabal install --only-dependencies --enable-tests\n$ cabal build\n$ cabal test\n$ cabal run HyperNerd secret.ini database.db\n```\n\n#### Cabal v2-build\n\nSee [Nix-style Local Builds](https://www.haskell.org/cabal/users-guide/nix-local-build-overview.html) for more info\n\n```console\n$ nix-shell\n$ cabal v2-build\n$ cabal v2-test\n$ cabal v2-run exe:HyperNerd secret.ini database.db\n```\n\n### Stack\n\nNative dependencies:\n- OpenSSL\n- zlib\n\n```console\n$ stack build\n$ stack exec hlint .\n$ stack exec HyperNerd secret.ini database.db\n```\n\n### Example of a secret.ini file\n\nThe `secret.ini` file consist of three optional sections.\n\n```ini\n[twitch]\nnick = HyperNerd\nchannel = Tsoding\npassword = \u003coauth-token\u003e\nclientId = \u003cclient-id-token\u003e\nowner = \u003cyour-name\u003e\n\n[discord]\nauthToken = \u003cauth-token\u003e\nguild = \u003cguild-id\u003e\nchannels = [\u003cchannel-id-1\u003e, \u003cchannel-id-2\u003e, ... ]\n\n[github]\napiKey = \u003coauth-token\u003e\n```\n\n#### Twitch Config Section\n\n| name       | description                                                                                                      |\n|------------|------------------------------------------------------------------------------------------------------------------|\n| `nick`     | Nickname of the bot.                                                                                             |\n| `owner`    | Owner of the bot. The bot will recognize this name as an authority regardless of not being a mod or broadcaster. |\n| `password` | Password generated by https://twitchapps.com/tmi/. `oauth:` prefix is the part of the password.                  |\n| `channel`  | Channel that the bot will join on start up.                                                                      |\n| `clientId` | Client ID for Twitch API calls.                                                                                  |\n\n#### Discord Config Section\n\n| name        | description                                                                                                                                             |\n|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `authToken` | Authentication Token for the bot: https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-\u0026-getting-a-token                               |\n| `guild`     | The id of the guild the bot listens to                                                                                                                  |\n| `channels`  | The list of ids of channels the bot listens to (the list is parsed as a [Haskell list][haskell-lists-tuples]: `[\u003cchannel-id-1\u003e, \u003cchannel-id-2\u003e, ... ]`) |\n\n\n#### GitHub Config Section\n\n| name       | desc                                                                                      |\n|------------|-------------------------------------------------------------------------------------------|\n| `apiToken` | https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line |\n\n\n## Docker-Compose\nWith secrets existing in volume defined in `docker-compose.yaml`,\n```console\n$ docker-compose up --build\n```\n\n\n## Docker\n\n```console\n$ docker build --target app -t hypernerd .\n$ mkdir hypernerd-state\n$ cp secret.ini hypernerd-state\n$ docker create -v /absolute/path/to/hypernerd-state/:/tmp/hypernerd/ \\\n                --name hypernerd-bot hypernerd\n$ docker start -a hypernerd-bot\n$ docker stop hypernerd-bot\n$ docker exec -it hypernerd-bot sh\n```\n\n## Markov Chain Responses\n\nTo trigger a Markov chain response, just mention the bot in the chat.\n\n### Training the Markov Model\n\nThe Markov model is a csv file that is generated from the logs in the\nbot's database file using the `Markov` CLI utility:\n\n```console\n$ cabal exec Markov train database.db markov.csv\n```\n\nThis command will produce the `markov.csv` file.\n\n### Using the Trained Markov Model with the Bot\n\n```console\n$ cabal exec HyperNerd secret.ini database.db markov.csv\n```\n\nThe `markov.csv` file is not automatically updated. To update the file\nwith the new logs you have to run the `Markov` CLI utility again.\n\n## Command Aliases\n\nYou can assign a command alias to any command:\n\n```\n\u003cuser\u003e !test\n\u003cbot\u003e test\n\u003cuser\u003e !addalias foo test\n\u003cuser\u003e !foo\n\u003cbot\u003e test\n```\n\nThe aliases are \"redirected\" only one level deep meaning that transitive aliases are not supported:\n\n```\n\u003cuser\u003e !addalias bar foo\n\u003cuser\u003e !bar\n*nothing, because !bar is redirected to !foo, but further redirect from !foo to !test does not happen*\n```\n\nMotivation to not support transitive aliases is the following:\n- They are not needed in most of the cases. Generally you just have a\n  main command and a bunch of aliases to it.\n- Support for transitive aliases requires to traverse and maintain a\n  \"tree\" of aliases, which complicates the logic and degrades the\n  performance.\n\n## Quote Database\n\n- `!addquote \u003cquote-text\u003e` -- Add a quote to the quote database. Available only to subs and mods.\n- `!delquote \u003cquote-id\u003e` -- Delete quote by id. Available only to Tsoding.\n- `!quote [quote-id]` -- Query quote from the quote database.\n\n## Support\n\nYou can support my work via\n\n- Twitch channel: https://www.twitch.tv/subs/tsoding\n- Patreon: https://www.patreon.com/tsoding\n\n[tsoder]: http://github.com/tsoding/tsoder\n[tsoding]: https://www.twitch.tv/tsoding\n[haskell-lists-tuples]: https://en.wikibooks.org/wiki/Haskell/Lists_and_tuples\n\n\u003c!-- TODO(#427): Markov training is not automated --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsoding%2FHyperNerd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsoding%2FHyperNerd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsoding%2FHyperNerd/lists"}