Skip to content

Commit 2a2e1f6

Browse files
authored
Allow commands to run in user-installed context (#89)
* Update discord-api-types + workers-discord * Allow user-install for all commands * Add notes to README for user-install commands * Improve command registration debugging * Add new invite for user-install * Don't scope staging to a specific guild
1 parent 727cb5f commit 2a2e1f6

File tree

17 files changed

+573
-493
lines changed

17 files changed

+573
-493
lines changed

.github/workflows/deployment-staging.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ jobs:
5757
CLIENT_ID: ${{ secrets.STAGING_CLIENT_ID }}
5858
CLIENT_SECRET: ${{ secrets.STAGING_CLIENT_SECRET }}
5959
CLIENT_PUBLIC_KEY: ${{ secrets.STAGING_CLIENT_PUBLIC_KEY }}
60-
TEST_GUILD_ID: ${{ secrets.STAGING_TEST_GUILD_ID }}
6160
SENTRY_AUTH_TOKEN: ${{ secrets.STAGING_SENTRY_AUTH_TOKEN }}
6261
SENTRY_ORG: ${{ secrets.STAGING_SENTRY_ORG }}
6362
SENTRY_PROJECT: ${{ secrets.STAGING_SENTRY_PROJECT }}

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
---
88

9-
1.1.1.1 works from a Discord server, thanks to the 1.1.1.1 bot. [Invite the bot to your Discord server](https://dns-over-discord.v4.wtf/invite) to start using DNS over Discord.
9+
1.1.1.1 works from a Discord server, thanks to the 1.1.1.1 bot. [Invite the bot to your Discord server](https://dns-over-discord.v4.wtf/invite) to start using DNS over Discord. Or, [add the bot to your Discord account](https://dns-over-discord.v4.wtf/invite/user) to use it anywhere in Discord.
1010

1111
## Perform DNS lookups
1212

@@ -301,8 +301,9 @@ Example:
301301

302302
### `invite` command
303303

304-
The `/invite` command provides the user with a quick link to invite the 1.1.1.1 DNS over Discord bot to another Discord server.
304+
The `/invite` command provides the user with a quick link to invite the 1.1.1.1 DNS over Discord bot to another Discord server, or to add it to a Discord account.
305305
The bot can be invited at any time with [https://dns-over-discord.v4.wtf/invite](https://dns-over-discord.v4.wtf/invite).
306+
The bot can also be added to accounts with [https://dns-over-discord.v4.wtf/invite/user](https://dns-over-discord.v4.wtf/invite/user).
306307

307308
```txt
308309
/invite
@@ -361,6 +362,16 @@ node
361362
5. Develop with the worker by running `npm run dev`.
362363
6. (Optional) Start an HTTP tunnel to your local development server by running `npm run tunnel`, using [cloudflared](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/run-tunnel/trycloudflare).
363364

365+
### User-installed commands
366+
367+
To test the user-installed commands functionality, you'll need to make sure your Discord application has the User Install option enabled.
368+
369+
You'll then need to make sure that the `TEST_GUILD_ID` in `development.env` is commented out, as user-installed commands need to be registered globally.
370+
371+
After that, start the worker as usual with `npm run dev`, install the application to your Discord user, and test the commands.
372+
373+
If you no longer wish to have the commands registered globally, leave `TEST_GUILD_ID` commented and update `webpack.config.js` to pass an empty array to the `registerCommands` call, then start the worker again to remove the global commands.
374+
364375
## Deployments
365376

366377
`wrangler.toml` and this repository is currently designed for a staging deployment and a production deployment.

0 commit comments

Comments
 (0)