{"id":17855561,"url":"https://github.com/iam4x/diskord","last_synced_at":"2026-04-21T10:03:17.536Z","repository":{"id":72141586,"uuid":"128125211","full_name":"iam4x/diskord","owner":"iam4x","description":"JavaScript library to simply create a Discord bot","archived":false,"fork":false,"pushed_at":"2018-04-04T21:44:09.000Z","size":962,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T17:51:35.329Z","etag":null,"topics":["bot","discord","javascrit","library"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/iam4x.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-04T21:38:39.000Z","updated_at":"2024-06-19T09:52:51.000Z","dependencies_parsed_at":"2023-05-11T07:30:22.425Z","dependency_job_id":null,"html_url":"https://github.com/iam4x/diskord","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iam4x/diskord","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam4x%2Fdiskord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam4x%2Fdiskord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam4x%2Fdiskord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam4x%2Fdiskord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iam4x","download_url":"https://codeload.github.com/iam4x/diskord/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam4x%2Fdiskord/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271737349,"owners_count":24812094,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"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":["bot","discord","javascrit","library"],"created_at":"2024-10-28T02:23:32.124Z","updated_at":"2026-04-21T10:03:17.486Z","avatar_url":"https://github.com/iam4x.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Diskord 🤖\n\n\u003e JavaScript/Node.js library to create simple answer bots for [Discord](https://discordapp.com/) messaging app\n\u003e\n\u003e **This library is not production bullet-proof ready, use at your own risk**\n\n![Simple Discord Bot](./example.gif)\n\n* `$ npm install -S diskord` OR\n* `$ yarn add diskord`\n\n## Requirements\n\n* Nodejs v6\n* A discord bot token ([guide how to get one](https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-\u0026-getting-a-token))\n\n## Usage\n\n### Create your bot instance\n\nFirst, you will need to create your bot instance aka login to the bot.\n\n```js\nconst Diskord = require('diskord');\nconst bot = new Diskord({ token: 'XXXX' });\n```\n\n### Register a simple answer\n\nThen you can create actions, theses actions will react to a message sent by a user. You can filter actions to trigger them only on a specified channel or a server.\n\nLet's create a simple action, the ping request:\n\n```js\nbot.registerAction({\n  trigger: 'ping',\n  action: 'pong'\n});\n```\n\n\u003e Writing `ping` or `!ping` in the channel where the bot is present will trigger the action.\n\n### Register an action with a function\n\nFor more complex operations you can register a function to your action:\n\n```js\nbot.registerAction({\n  trigger: 'hi',\n  action: function(params) {\n    // params = {\n    //   author: {},\n    //   args: string[],\n    //   reply: Function\n    // }\n    reply(`Welcome ${params.author.username}! How are you?`);\n  }\n});\n```\n\n### Register an action accepting arguments\n\nMost of the time you want user to interact with the bot by providing options, it's easy to do it:\n\n```js\nbot.registerAction({\n  trigger: 'weather',\n  action: function(params) {\n    const city = params.args[0];\n    if (!city) return reply('Usage: !weather Paris');\n\n    [...]\n\n    reply(`The temperature in ${city} is ...`);\n  }\n});\n```\n\n## API\n\n### `new Diskord(SimpleBotOptions)`\n\n```js\nSimpleBotOptions = {\n  token: 'XXXX' // Secret bot token\n}\n```\n\n### `registerAction(Action)`\n\n```js\nAction = {\n  trigger: string // Message (with or without prefix '!') to match\n  action: string | ActionFunction // Action to start on when trigger match\n}\n\nActionFunction = function(params) {\n  // params = {\n  //   author: { username: string },\n  //   args: string[],\n  //   reply: Function\n  // }\n}\n```\n\n## TODO\n\n* [ ] Spam protection\n* [ ] Documentation on how to make great messages\n* [ ] Support of attachment in answers\n* [ ] Ideas? Create an issue!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiam4x%2Fdiskord","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiam4x%2Fdiskord","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiam4x%2Fdiskord/lists"}