{"id":15112456,"url":"https://github.com/maks11060/discord-interactions","last_synced_at":"2026-02-09T22:31:12.091Z","repository":{"id":234454267,"uuid":"788929170","full_name":"MAKS11060/discord-interactions","owner":"MAKS11060","description":"Discord interactions handler","archived":false,"fork":false,"pushed_at":"2025-06-02T10:39:22.000Z","size":172,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T02:09:43.336Z","etag":null,"topics":["deno","discord","discord-api","discord-interactions","discordapp","typescript"],"latest_commit_sha":null,"homepage":"https://jsr.io/@maks11060/discord-interactions","language":"TypeScript","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/MAKS11060.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":"2024-04-19T11:15:42.000Z","updated_at":"2025-04-27T09:56:13.000Z","dependencies_parsed_at":"2024-05-01T07:39:25.358Z","dependency_job_id":"ec73e097-9ce7-48c0-9cc8-e5f8b3e48301","html_url":"https://github.com/MAKS11060/discord-interactions","commit_stats":null,"previous_names":["maks11060/hono-discord-interaction","maks11060/discord-interaction","maks11060/discord-interactions"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/MAKS11060/discord-interactions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MAKS11060%2Fdiscord-interactions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MAKS11060%2Fdiscord-interactions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MAKS11060%2Fdiscord-interactions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MAKS11060%2Fdiscord-interactions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MAKS11060","download_url":"https://codeload.github.com/MAKS11060/discord-interactions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MAKS11060%2Fdiscord-interactions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271274096,"owners_count":24730928,"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-20T02:00:09.606Z","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":["deno","discord","discord-api","discord-interactions","discordapp","typescript"],"created_at":"2024-09-26T01:00:29.646Z","updated_at":"2026-02-09T22:31:12.085Z","avatar_url":"https://github.com/MAKS11060.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eDiscord Interactions\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://jsr.io/@maks11060/discord-interactions\"\u003e\n    \u003cimg src=\"https://jsr.io/badges/@maks11060/discord-interactions\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/MAKS11060/discord-interactions/actions/workflows/ci.yml\"\u003e\n    \u003cimg src=\"https://github.com/MAKS11060/discord-interactions/actions/workflows/ci.yml/badge.svg\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\n### Library for handling **Discord Interactions**.\nHandle slash command, user and chat command. [Overview of Interactions](https://discord.com/developers/docs/interactions/overview)\n\n## Quick Start\n\n1. Create a new application on the [Discord Developer Portal](https://discord.com/developers/applications).\n2. Add your application to your Discord server by visiting the following URL and replacing `your_client_id` with your actual client ID:\n   - `https://discord.com/oauth2/authorize?client_id=your_client_id`\n3. Copy the `PUBLIC KEY` from your application's settings page and add it to your `.env` file.\n4. Copy the `CLIENT_ID` and `CLIENT_SECRET` from the OAuth2 page of your application's settings and add them to your `.env` file.\n\n### `.env` file:\n```env\n# Discord application settings\n# CLIENT_ID=        # Required for deploying commands\n# CLIENT_SECRET=    # Required for deploying commands\nCLIENT_PUBLIC_KEY=  # Required for verifying requests\n```\n\n## Install from [JSR](https://jsr.io/@maks11060/discord-interactions)\n```powershell\ndeno add @maks11060/discord-interactions\ndeno add npm:discord-api-types\n```\n\n## Install CLI\n```powershell\ndeno install -Arfgn deploy-discord --unstable-kv jsr:@maks11060/discord-interactions/cli\n```\n\n## Usage\n\nDefine commands:\n```ts\n// ./src/commands.ts\nimport {defineCommand, Format} from '@maks11060/discord-interactions'\n\nconst hello = defineCommand({\n  name: 'hello',\n  description: 'says hi',\n}).createHandler({\n  hello: () =\u003e ({\n    command: (c) =\u003e {\n      return c.reply({\n        content: `Hello ${Format.user(c.user.id)}`,\n      });\n    },\n  }),\n})\n\nexport const commands = [hello]\n\n// or use\n// export default [hello]\n```\n\nRun **[CLI](#install-cli)**:\n```powershell\ndeploy-discord ./src/commands.ts\n# or use help\ndeploy-discord -h\n```\n\n### Use [Hono](https://hono.dev)\n\n```ts\n// main.ts\nimport {Hono} from 'hono'\nimport {importKeyRaw, discordInteraction} from '@maks11060/discord-interactions/hono'\nimport {commands} from './src/commands.ts'\n\nconst app = new Hono()\nconst key = await importKeyRaw(Deno.env.get('CLIENT_PUBLIC_KEY')!)\n\napp.post('/interaction', ...await discordInteraction(key, commands))\n\nDeno.serve(app.fetch)\n```\n\n### Use web standards api\n```ts\n// main.ts\nimport {importKeyRaw, discordInteraction} from '@maks11060/discord-interactions'\nimport {commands} from './src/commands.ts'\n\nconst key = await importKeyRaw(Deno.env.get('CLIENT_PUBLIC_KEY')!)\nconst interaction = await discordInteraction(key, commands)\n\nDeno.serve(req =\u003e {\n  const uri = new URL(req.url)\n  if (req.method === 'POST' \u0026\u0026 uri.pathname === '/interaction') {\n    return interaction(req)\n  }\n  return new Response('404 Not found', {status: 404})\n})\n```\n\n## Features\n  - [x] ApplicationCommandContext\n    - [x] getter for options\n    - [x] reply/replyUpdate\n    - [x] deferredReply\n  - [x] ApplicationCommandAutocompleteContext\n    - [x] get[string/integer/number]\n    - [x] autocomplete()\n    - [x] pass() return empty autocomplete\n  - [x] MessageComponentContext\n    - [x] getter(type/customId)\n    - [x] deferredReplyUpdate (DeferredMessageUpdate)\n    - [x] optional response support\n    - [x] optional. Support for manual call handling\n  - [x] ModalContext\n    - [x] reply\n    - [x] deferredReply\n  - [x] MenuCommandContext\n    - [x] reply\n    - [x] UserMenuCommandContext\n      - [x] getUser\n      - [x] getMember(guild only)\n    - [x] MessageMenuCommandContext\n      - [x] getMessage\n  - [x] CLI\n    - [x] resolve imports in deno.json[c]\n    - [ ] * resolve deps in package.json\n\n\\* Maybe it works\n\n### Problems\n1. Run the application to cache types from `discord-api-types/v10`\n```ts\n// ./src/commands.ts\nimport {defineCommand} from '@maks11060/discord-interactions' // or 'jsr:@maks11060/discord-interactions'\nimport {ApplicationCommandType} from 'discord-api-types/v10' // or 'npm:discord-api-types/v10'\n\nconst test = defineCommand({\n  type: ApplicationCommandType.ChatInput,\n  name: 'test',\n  description: 'autocomplete',\n}).createHandler({\n  test: () =\u003e ({\n    command(c) {\n      return c.reply({content: 'ok'})\n    },\n  }),\n})\n```\n\n|                         Supported Runtime                         |                        Tested                        |\n| :---------------------------------------------------------------: | :--------------------------------------------------: |\n|                        Deno / Deno Deploy                         |                          ✓                           |\n|                         CloudFlare worker                         |                          ?                           |\n|                                Bun                                | x / [bug](https://github.com/oven-sh/bun/pull/12473) |\n| Node + [@hono/node-server](https://github.com/honojs/node-server) |                          ?                           |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaks11060%2Fdiscord-interactions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaks11060%2Fdiscord-interactions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaks11060%2Fdiscord-interactions/lists"}