{"id":13558664,"url":"https://github.com/4nd3r/tiny-matrix-bot","last_synced_at":"2025-02-27T11:31:10.792Z","repository":{"id":43921701,"uuid":"77070799","full_name":"4nd3r/tiny-matrix-bot","owner":"4nd3r","description":"matrix.org bot based on matrix-nio","archived":true,"fork":false,"pushed_at":"2024-01-27T14:43:14.000Z","size":211,"stargazers_count":78,"open_issues_count":0,"forks_count":16,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-12-20T00:30:23.356Z","etag":null,"topics":["bot","matrix","matrix-nio","matrix-org","python","shell-scripts"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/4nd3r.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":"2016-12-21T17:04:13.000Z","updated_at":"2024-12-11T02:32:34.000Z","dependencies_parsed_at":"2024-10-16T07:40:41.113Z","dependency_job_id":"fd52dc02-0b25-4282-acd0-92e84a3834fc","html_url":"https://github.com/4nd3r/tiny-matrix-bot","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/4nd3r%2Ftiny-matrix-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4nd3r%2Ftiny-matrix-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4nd3r%2Ftiny-matrix-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4nd3r%2Ftiny-matrix-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/4nd3r","download_url":"https://codeload.github.com/4nd3r/tiny-matrix-bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241007411,"owners_count":19893004,"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","matrix","matrix-nio","matrix-org","python","shell-scripts"],"created_at":"2024-08-01T12:05:05.317Z","updated_at":"2025-02-27T11:31:10.389Z","avatar_url":"https://github.com/4nd3r.png","language":"Shell","funding_links":[],"categories":["Shell","bot"],"sub_categories":[],"readme":"# tiny-matrix-bot\n\nSimple (and tiny!) [Matrix](https://matrix.org) bot based on [matrix-nio](https://github.com/poljar/matrix-nio).\n\nBot triggers on messages matching regular expressions, runs corresponding script and sends output to room.\n\nThat's it.\n\nSans E2EE support, I consider this bot feature complete, but not bug free.\n\nPRs are welcome, but no promises are given. You might be better off with fork.\n\n## Installation\n\nIt goes roughly like this:\n\n```\nsudo pip3 install matrix-nio\ngit clone https://github.com/4nd3r/tiny-matrix-bot\ncd tiny-matrix-bot/scripts-enabled/\nfind ../scripts-available/ -type f -exec ln -s {} \\;\ncd ..\ncp tiny-matrix-bot.env.sample tiny-matrix-bot.env\nvim tiny-matrix-bot.env\n./tiny-matrix-bot.sh\n```\n\n## Configuration\n\nRequired environment variables:\n\n* `TMB_HOMESERVER` = `https://example.com`\n* `TMB_ACCESS_TOKEN` = `ABCDEFGH`\n* `TMB_USER_ID` = `@bot:example.com`\n\nOptional environment variables:\n\n* `TMB_SCRIPTS_PATH` = `scripts-enabled` (this value is used when unset)\n* `TMB_ACCEPT_INVITES` = `:example\\.com$` (derived from `TMB_USER_ID` when unset)\n* `TMB_PROXY` = `http://proxy.example.com:3128` (this value is an example, see [matrix-nio documentation](https://matrix-nio.readthedocs.io/en/latest/nio.html?highlight=proxy#nio.AsyncClient))\n\n## Scripts\n\nScripts can be written in any language and they MUST have `+x` bit set.\n\n### Setting the trigger\n\nBot sets an environment variable `CONFIG` and runs the script.\n\nManual example:\n\n```\n$ CONFIG=1 scripts-available/ping\n^!?ping(!|\\?)?$\n```\n\nStandard output MUST contain [Python compatible regular expression](https://docs.python.org/3.7/library/re.html#regular-expression-syntax).\n\nMatching is case-insensitive.\n\n### Running triggered scripts\n\nFollowing environment variables are set:\n\n* `TMB_ROOM_ID`\n* `TMB_SENDER`\n* `TMB_BODY`\n\nManual example:\n\n```\n$ TMB_BODY='1Ms 1:1' scripts-available/piibel \nAlguses lõi Jumal taeva ja maa.\n```\n\nNon-empty standard output (if exit code is zero) will be sent to room as plain text.\n\nEmpty line between non-empty lines will separate messages.\n\nTo mimic interaction, messages are sent with small delay.\n\n## Running with systemd\n\nBot itself don't need to write persistent data, so read-only system access for\nlong running service is reasonable thing to have, hence `ProtectSystem=strict`\nand friends.\n\nHowever, if script wants to write persistent data, then write path MUST be\nallowed using `ReadWritePaths=` in systemd unit `[Service]` section. See\n[systemd documentation](https://www.freedesktop.org/software/systemd/man/systemd.exec.html)\nfor details.\n\n## Previous versions\n\n* [0c7c79e146970f19693b37b84df35a501513ff99](https://github.com/4nd3r/tiny-matrix-bot/tree/0c7c79e146970f19693b37b84df35a501513ff99)\n* [3e6fa5978492020876e8a70feac12663d6530bcd](https://github.com/4nd3r/tiny-matrix-bot/tree/3e6fa5978492020876e8a70feac12663d6530bcd)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4nd3r%2Ftiny-matrix-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F4nd3r%2Ftiny-matrix-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4nd3r%2Ftiny-matrix-bot/lists"}