{"id":15789820,"url":"https://github.com/danielgtaylor/injectobot","last_synced_at":"2026-07-11T20:31:40.070Z","repository":{"id":12571224,"uuid":"15241751","full_name":"danielgtaylor/injectobot","owner":"danielgtaylor","description":"Developer-friendly programmable IRC bot","archived":false,"fork":false,"pushed_at":"2013-12-21T23:21:10.000Z","size":128,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-25T09:46:33.132Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielgtaylor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-17T01:12:32.000Z","updated_at":"2013-12-21T23:21:11.000Z","dependencies_parsed_at":"2022-09-23T08:10:50.369Z","dependency_job_id":null,"html_url":"https://github.com/danielgtaylor/injectobot","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/danielgtaylor/injectobot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgtaylor%2Finjectobot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgtaylor%2Finjectobot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgtaylor%2Finjectobot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgtaylor%2Finjectobot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielgtaylor","download_url":"https://codeload.github.com/danielgtaylor/injectobot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgtaylor%2Finjectobot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35375152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-04T22:03:51.747Z","updated_at":"2026-07-11T20:31:40.051Z","avatar_url":"https://github.com/danielgtaylor.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Inject-o-bot Documentation\nThis developer-friendly IRC bot provides an API to inject code as plugins so that teams of developers can add their own functionality. Each plugin runs as an unprivileged user in its own `chroot` sandbox and communicates via sockets with a master process that allows it to interact with the IRC server, channels and users. The plugins themselves are run in a context which provides some commonly used modules and a nice API to interact with the master process. This means you can:\n\n* Generate messages for users and channels\n* Call out to web APIs via `request`\n* Access the chrooted filesystem with `fs`\n* Access built-in modules like `crypto`, `fs`, `http`, `net`, `path`\n* Access common modules like `_`, `async`, `cheerio`, `coffee`, `glob`, `marked`, `moment`, `npm`, `q`\n\nBecause of the chroot, you _cannot_ call shell scripts or any typical system-installed libraries or commands, nor can you modify other scripts or modules.\n\n## Installation \u0026 Usage\nThe bot can be installed via npm (may require `sudo`):\n\n```bash\nnpm install -g injectobot\n```\n\nExamples throughout this document use [HTTPie](https://github.com/jkbr/httpie), which you can install via `pip install httpie`.\n\nOnce installed, it can be run via the `injectobot` command, which requires `sudo` in order to create the plugin chroot jails. Unless a `--host` is passed, it will not connect to an IRC channel and instead will dump all messages to the terminal, which is useful for testing plugins locally.\n\n```bash\n# Run the bot, connecting to IRC\nsudo injectobot --host chat.freenode.org --name 'mybot'\n\n# Start the bot for testing locally (no IRC)\nsudo injectobot --name 'mybot' --listen 8000\n\n# Simulate an incoming IRC message\nhttp localhost:8000/test message=='mybot: help'\n```\n\n## Basic Plugin Example\nA very basic plugin which listens to a command `echo` and replies back to the sender or room any text that follows the command would look like this (both CoffeeScript and Javascript are supported):\n\n```coffeescript\nbot.command 'echo', (from, to, args) -\u003e\n    bot.reply from, to, args\n```\n\n## Displaying Help\nYou can listen to the `help` command to display information about your plugin. For example:\n\n```coffeescript\nbot.command 'help', (from, to, args) -\u003e\n    switch args\n        when ''\n            bot.reply from, to, 'echo [message]: say a message back to you'\n        when 'echo'\n            bot.reply from, to, 'Echo a message back to the sender or channel'\n\n```\n\n## Bot Plugin API\nThe bot's plugin API provides a layer above the interprocess communication mechanism to make interacting with the master process more like typical programming. The API is accessed via the `bot` variable.\n\n### Attributes\n\n| Attribute | Description            |\n| --------- | ---------------------- |\n| name      | The bot's IRC nickname |\n\n### Methods\n\n#### bot.use (handler)\nRegister a handler `(from, to, message)` that gets invoked each time a message is received, including any message sent to any channel that the bot is in. It is up to you to filter out the messages you care about.\n\n```coffeescript\nbot.use (from, to, message) -\u003e\n    # Do stuff here!\n```\n\n#### bot.command (cmd, handler)\nRegister a handler `(from, to, args)` that gets invoked each time a command is sent to the bot, either via a private message or via the bot's name in a channel (e.g. `botname command ...`). `args` will contain all text after the command as a single string.\n\n```coffeescript\nbot.command 'help', (from, to, args) -\u003e\n    # Do stuff here!\n```\n\n#### bot.interval (milliseconds, handler)\nRun a function at an interval in milliseconds. This is a shortcut for `setInterval` that flips the parameter order to make it easier to use with CoffeeScript.\n\n```coffeescript\nbot.interval 5000, -\u003e\n    # Do stuff here every five seconds!\n```\n\n#### bot.say (to, message)\nSay a message to a user or channel. Channels must include the `#` character.\n\n```coffeescript\nbot.say '#mychannel', 'Hello, world!'\n```\n\n#### bot.reply (from, to, message)\nReply to a message. This is like `say`, except contains logic to either reply to a private message or reply into the channel, which is why you need to pass both `from` and `to` into it.\n\n```coffeescript\nbot.reply from, to, 'Hello, world!'\n```\n\n## Uploading a Plugin\nYou can upload a plugin by doing an `HTTP PUT` to this server. You must set a `Content-Type` header and the body of the request must be the plugin text as utf-8. __Warning__: there are currently zero access controls. It may be a good idea to prefix your plugins with a unique name to prevent clashes with other team members.\n\nIf a plugin requires a secret such as an API token then it should be set in a variable that ends in `TOKEN` or `SECRET`, for example `MY_TOKEN = 'some-secret-string'`. When reading plugins this string will be replaced to prevent leaking of secrets.\n\n```http\nPUT http://localhost:3000/plugins/:name HTTP/1.1\nContent-Type: application/coffeescript\n\n\nbot.command 'echo', (from, to, args) -\u003e\n    bot.reply from, to, args\n```\n\n### Parameters\n| Name   | Description                  |\n| ------ | ---------------------------- |\n| `name` | The plugin name (in the URL) |\n\n### Headers\n| Name           | Description                                                   |\n| -------------- | ------------------------------------------------------------- |\n| `Content-Type` | Either `application/javascript` or `application/coffeescript` |\n\n#### HTTPie Example\n```bash\nhttp put localhost:3000/plugins/test Content-Type:application/javascript \u003cmyscript.js\n```\n\n## Listing All Plugins\nYou can list all installed plugin names (including extension type) with an `HTTP GET` call to the server. A list of strings is returned.\n\n```http\nGET http://localhost:3000/plugins HTTP/1.1\n```\n\n#### HTTPie Example\n```bash\nhttp localhost:3000/plugins\n```\n\n## Reading a Plugin\nYou can read a plugin's source code, minus any secrets, with an `HTTP GET` call to the server.\n\n```http\nGET http://localhost:3000/plugins/:name HTTP/1.1\n```\n\n### Parameters\n| Name     | Description                  |\n| -------- | ---------------------------- |\n| `name`   | The plugin name (in the URL) |\n\n#### HTTPie Example\n```bash\nhttp localhost:3000/plugins/test\n```\n\n## Deleting a Plugin\nYou can delete a plugin by doing an `HTTP DELETE` to this server. __Warning__: there are currently zero access controls, so please be responsible.\n\n```http\nDELETE http://localhost:3000/plugins/:name HTTP/1.1\n```\n\n#### HTTPie Example\n```bash\nhttp delete localhost:3000/plugins/test\n```\n\n## Advanced Usage\nThe following sections describe advanced behavior.\n\n### Basic Security\nThis bot has very little security built-in, and is intended for small teams of developers who want to allow members to quickly write fun little plugins for the team. Some ideas for locking it down:\n\n* Limit who can PUT/DELETE via `iptables` whitelists\n* Require a password as an argument to plugin commands\n* Modify commands to require channel op status\n\n### Custom Dependencies\nBuilt-in modules are described at the top of this document, but sometimes there may be a module you wish to use that isn't included. You can install custom dependencies for your script programmatically via the `npm` module. __Note__: only pure javascript modules are supported. C/C++ extensions are prohibited because they could contain inline assembly and potentially wreak havoc. Here is an example:\n\n```coffeescript\nnpm.load {}, (err) -\u003e\n    if err then # ...\n\n    npm.commands.install ['module1', 'module2'], (err) -\u003e\n        if err then # ...\n\n        # Now you can load your modules!\n        module1 = require 'module1'\n        module2 = reuqire 'module2'\n```\n\n## License\nCopyright \u0026copy; 2013 Daniel G. Taylor\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgtaylor%2Finjectobot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielgtaylor%2Finjectobot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgtaylor%2Finjectobot/lists"}