-
-
Notifications
You must be signed in to change notification settings - Fork 10
feat(disploy): buttons #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6c5dffd
feat(disploy): buttons
tristancamejo f0417a7
Merge branch 'Disploy:main' into feat/buttons
tristancamejo 4dd4aa8
feat(Router): message component params
tristancamejo bf75e07
chore: docs
tristancamejo b5b45b6
remove: dev from example
tristancamejo 8effdf8
grammar
tristancamejo 9ab2dab
feat(RouteParams): getUserParam
tristancamejo 716f776
docs
tristancamejo 243b11d
fix
tristancamejo 3d40d10
Update apps/docs/docs/Guide/getting-started/introduction.md
tristancamejo 2af61be
Update apps/example/README.md
tristancamejo dfbdd30
Update apps/docs/docs/Guide/getting-started/introduction.md
tristancamejo 09410f9
Update packages/disploy/README.md
tristancamejo 5c814c6
Update packages/disploy/README.md
tristancamejo 9796a3b
Update packages/disploy/README.md
tristancamejo 2c16218
Update packages/disploy/README.md
tristancamejo 8145667
Update packages/disploy/README.md
tristancamejo b4e59ed
Update packages/disploy/README.md
tristancamejo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,19 @@ | ||
| # `@disploy/example` | ||
|
|
||
| Common code for our example bot. | ||
| This is an example Discord bot made with Disploy to test the library. | ||
|
|
||
| ## Implementations | ||
| ## Usage | ||
|
|
||
| - [Express](https://github.com/Disploy/disploy/blob/main/apps/express-example/src/bot.ts) | ||
| - [Next.js](https://github.com/Disploy/disploy/blob/main/apps/next-example/pages/api/interactions.ts) | ||
| - [Cloudflare worker](https://github.com/Disploy/disploy/blob/main/apps/cf-example) | ||
| You should be already running `yarn dev` in the root of the repository (live transpile TypeScript), then you can deploy this bot to a Cloudflare Worker with: | ||
|
|
||
| ```bash | ||
| yarn disploy deploy | ||
| ``` | ||
|
|
||
| or just run a local dev server with an ngrok tunnel: | ||
|
|
||
| ```bash | ||
| yarn disploy dev | ||
| ``` | ||
|
|
||
| Commands will be automatically registered when running `yarn disploy dev`, but you'll need to manually register them when deploying to a Cloudflare Worker (`yarn disploy sync`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| { | ||
| "prebuild": "yarn run build", | ||
| "watcher": "yarn run dev", | ||
| "root": "dist", | ||
| "target": { | ||
| "type": "cloudflare", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import type { ButtonHandler } from "disploy"; | ||
|
|
||
| export default { | ||
| customId: 'ping-:userId', | ||
|
|
||
| async run(interaction) { | ||
| const originalUser = await interaction.params.getUserParam('userId'); | ||
| const clicker = interaction.user; | ||
|
|
||
| return void interaction.reply({ | ||
| content: `hello world!!!!!!!! (clicked by ${clicker}) [made by ${originalUser}]`, | ||
| }); | ||
| }, | ||
| } satisfies ButtonHandler; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import type { ButtonHandler } from 'disploy'; | ||
|
|
||
| export default { | ||
| customId: 'ping', | ||
|
|
||
| async run(interaction) { | ||
| return void interaction.reply({ | ||
| content: `hello world!!!!!!!! (clicked by ${interaction.user})`, | ||
| }) | ||
| } | ||
|
|
||
| } satisfies ButtonHandler; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/disploy/cli/assets/code/commandArray.js → packages/disploy/cli/assets/code/array.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| {{imports}} | ||
|
|
||
| export const Commands = [ | ||
| export const {{name}} = [ | ||
| {{array}} | ||
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import { App } from 'disploy'; | ||
| import { Commands } from './commands'; | ||
| import { Handlers } from './handlers'; | ||
|
|
||
| const app = new App(); | ||
|
|
||
| export default { app, commands: Commands }; | ||
| export default { app, commands: Commands, handlers: Handlers }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.