Skip to content

Getting Started

  1. Create a new project

    discord-hono is recommended to be used in a TypeScript environment.

    Terminal window
    npm create cloudflare@latest
    cd YOUR_PROJECT
    npm i discord-hono
    npm i -D discord-api-types
    # npm i -D tsx @types/node # Node/TS environment

    Copy the linked files.

    Add to package.json scripts.

    package.json
    "scripts": {
    "register": "tsx --env-file=.env src/register.ts",
    },
  2. Setup discord bot - Discord Docs

    Create a New Application from Dashboard.
    Copy your APPLICATION ID, PUBLIC KEY and TOKEN, and put them .env file.

    Storing secrets.

    Terminal window
    npx wrangler secret bulk .env

    Register commands and deploy.

    Terminal window
    npm run register
    npm run deploy

    Set endpoint url.

    Enter https://YOUR_PROJECT.YOUR_DOMAIN.workers.dev in the INTERACTIONS ENDPOINT URL.

  3. Invite bot

    Create an invite URL from the Dashboard.
    YOUR_APP > OAuth2 tab > OAuth2 URL Generator > Check SCOPES: bot > URL Copy
    Paste the URL into the browser.