Getting Started
-
Create a new project
discord-hono is recommended to be used in a TypeScript environment.
Terminal window npm create cloudflare@latestcd YOUR_PROJECTnpm i discord-hononpm i -D discord-api-types# npm i -D tsx @types/node # Node/TS environmentCopy the linked files.
Directorysrc
- .env.example Rename file to .env
- package.json
- …
Add to
package.jsonscripts.package.json "scripts": {"register": "tsx --env-file=.env src/register.ts",}, -
Setup discord bot - Discord Docs
Create a New Application from Dashboard.
Copy yourAPPLICATION ID,PUBLIC KEYandTOKEN, and put them.envfile.Storing secrets.
Terminal window npx wrangler secret bulk .envRegister commands and deploy.
Terminal window npm run registernpm run deploySet endpoint url.
Enter
https://YOUR_PROJECT.YOUR_DOMAIN.workers.devin the INTERACTIONS ENDPOINT URL. -
Invite bot
Create an invite URL from the Dashboard.
YOUR_APP>OAuth2tab >OAuth2 URL Generator> Check SCOPES:bot> URLCopy
Paste the URL into the browser.