-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: `Plugin` class and `createHandle` method * feat: initial node adapter, remove nodejs package * feat: initial cloudflare adapter * feat: initial bun adapter * feat: initial nextjs adapter * refactor: use handlebars templates in create carbon package * chore: formatting and clean up * chore: use consistent indentation style in template * refactor: remove need to pass client to linked roles plugin * Update packages/create-carbon/package.json Co-authored-by: Shadow <william.shadow@outlook.com> * Revert "refactor: remove need to pass client to linked roles plugin" This reverts commit cf924be. * chore: add jsdocs * chore: add jsdocs to adapters * feat: add ability to protect routes * refactor: improve carbon template * feat: add ability to disable routes * chore: formatting * feat: add deploy linked roles route * refactor: move internal error handling to handle * fix: add client secret as a default to env template * fix: env not being loaded in node.js template * fix: typescript import issues in template * fix: some routes not correctly responding with content * refactor: replace `autoRegister` client option with `disableAutoRegister` * refactor: move relative path resolution to use base url * fix: trim and clean template output content * refactor: change linked roles routes connect segment to verify-user * fix: incorrect linked roles put metadata endpoint * refactor: use tsc-watch in node.js template for dev script * refactor: minor changes * fix: next.js template issues * fix: req url host issue related to proxy tunnel * fix: more incorrect endpoints in linked roles plugin * fix: carbon template linked roles checker key * fix: cloudflare template missing files and dev flow * refactor: update template readme * refactor: rename nextjs to next in template plus minor fixes * refactor: use separate secret for deploy endpoints * refactor: new docs * refactor: instead link to docs in readme template * chore: update demo apps to use new carbon * fix: some old href paths * chore: add changeset * chore: update linked roles plugin example --------- Co-authored-by: Shadow <shadow@buape.com>
- Loading branch information
1 parent
7797395
commit 8b489db
Showing
195 changed files
with
3,416 additions
and
3,395 deletions.
There are no files selected for viewing
This file contains 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,6 @@ | ||
--- | ||
"create-carbon": minor | ||
"@buape/carbon": minor | ||
--- | ||
|
||
New Architecture |
This file contains 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 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,6 @@ | ||
BASE_URL= | ||
DEPLOY_SECRET= | ||
DISCORD_CLIENT_ID= | ||
DISCORD_CLIENT_SECRET= | ||
DISCORD_PUBLIC_KEY= | ||
DISCORD_BOT_TOKEN= |
This file contains 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,3 @@ | ||
node_modules/ | ||
.wrangler/ | ||
.dev.vars |
This file contains 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,3 +1,7 @@ | ||
# Cloudo | ||
## cloudo | ||
|
||
Cloudo is our test bot that runs on CF workers, to test that Carbon functions correctly. | ||
This is a [Discord](https://discord.dev) app made with [Carbon](https://carbon.buape.com) and generated with the [`create-carbon`](https://npmjs.com/create-carbon) tool. | ||
|
||
To learn how to get started in development, deploy to production, or add commands, head over to the [documentation](https://carbon.buape.com/adapters/cloudflare) for your runtime. | ||
|
||
If you need any assistance, you can join our [Discord](https://go.buape.com/carbon) and ask in the [`#support`](https://discord.com/channels/1280628625904894072/1280630704308486174) channel. |
This file contains 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,19 +1,19 @@ | ||
{ | ||
"name": "demo-cloudo", | ||
"type": "module", | ||
"main": "./dist/src/index.js", | ||
"private": true, | ||
"type": "module", | ||
"main": "./src/index.ts", | ||
"scripts": { | ||
"build": "wrangler deploy --dry-run", | ||
"dev": "wrangler dev --port 3000", | ||
"deploy": "wrangler deploy", | ||
"dev": "wrangler deploy && wrangler tail" | ||
"wrangler": "wrangler" | ||
}, | ||
"dependencies": { | ||
"@buape/carbon": "workspace:*" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@cloudflare/workers-types": "4.20241004.0", | ||
"wrangler": "3.80.1" | ||
"@cloudflare/workers-types": "4.20241011.0", | ||
"typescript": "5.6.3", | ||
"wrangler": "3.81.0" | ||
} | ||
} |
This file contains 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 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 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,35 @@ | ||
import { | ||
Command, | ||
type CommandInteraction, | ||
CommandWithSubcommands | ||
} from "@buape/carbon" | ||
|
||
class EphemeralNoDefer extends Command { | ||
name = "no-defer" | ||
description = "Ephemeral test" | ||
ephemeral = true | ||
defer = false | ||
|
||
async run(interaction: CommandInteraction): Promise<void> { | ||
await interaction.reply({ content: "Ephemeral no defer" }) | ||
} | ||
} | ||
|
||
class EphemeralDefer extends Command { | ||
name = "defer" | ||
description = "Ephemeral test" | ||
ephemeral = true | ||
defer = true | ||
|
||
async run(interaction: CommandInteraction): Promise<void> { | ||
await interaction.reply({ content: "Ephemeral defer" }) | ||
} | ||
} | ||
|
||
export default class EphemeralCommand extends CommandWithSubcommands { | ||
name = "ephemeral" | ||
description = "Ephemeral test" | ||
ephemeral = true | ||
|
||
subcommands = [new EphemeralNoDefer(), new EphemeralDefer()] | ||
} |
This file contains 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 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 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 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,27 +1,99 @@ | ||
import { | ||
type APIApplicationCommandBasicOption, | ||
ApplicationCommandOptionType, | ||
type AutocompleteInteraction, | ||
Command, | ||
type CommandInteraction | ||
type CommandInteraction, | ||
type CommandOptions | ||
} from "@buape/carbon" | ||
|
||
export default class Options extends Command { | ||
export default class OptionsCommand extends Command { | ||
name = "options" | ||
description = "Options test" | ||
defer = true | ||
|
||
options: APIApplicationCommandBasicOption[] = [ | ||
options: CommandOptions = [ | ||
{ | ||
name: "str", | ||
type: ApplicationCommandOptionType.String, | ||
description: "DESCRIPTION", | ||
required: true | ||
required: false | ||
}, | ||
{ | ||
name: "int", | ||
type: ApplicationCommandOptionType.Integer, | ||
description: "DESCRIPTION", | ||
required: false | ||
}, | ||
{ | ||
name: "num", | ||
type: ApplicationCommandOptionType.Number, | ||
description: "DESCRIPTION", | ||
required: false | ||
}, | ||
{ | ||
name: "bool", | ||
type: ApplicationCommandOptionType.Boolean, | ||
description: "DESCRIPTION", | ||
required: false | ||
}, | ||
{ | ||
name: "user", | ||
type: ApplicationCommandOptionType.User, | ||
description: "DESCRIPTION", | ||
required: false | ||
}, | ||
{ | ||
name: "channel", | ||
type: ApplicationCommandOptionType.Channel, | ||
description: "DESCRIPTION", | ||
required: false | ||
}, | ||
{ | ||
name: "role", | ||
type: ApplicationCommandOptionType.Role, | ||
description: "DESCRIPTION", | ||
required: false | ||
}, | ||
{ | ||
name: "mentionable", | ||
type: ApplicationCommandOptionType.Mentionable, | ||
description: "DESCRIPTION", | ||
required: false | ||
}, | ||
{ | ||
name: "autocomplete", | ||
type: ApplicationCommandOptionType.String, | ||
description: "DESCRIPTION", | ||
required: false, | ||
autocomplete: true | ||
} | ||
] | ||
|
||
async autocomplete(interaction: AutocompleteInteraction) { | ||
await interaction.respond([ | ||
{ | ||
name: "That thing you said", | ||
value: String(interaction.options.getFocused()) || "No focused option" | ||
}, | ||
{ | ||
name: "That thing you said but with a prefix", | ||
value: `Prefix: ${String(interaction.options.getFocused())}` | ||
} | ||
]) | ||
} | ||
|
||
async run(interaction: CommandInteraction) { | ||
interaction.reply({ | ||
content: `${interaction.options.getString("str")}` | ||
}) | ||
const str = interaction.options.getString("str") | ||
const int = interaction.options.getInteger("int") | ||
const num = interaction.options.getNumber("num") | ||
const bool = interaction.options.getBoolean("bool") | ||
const user = interaction.options.getUser("user") | ||
const channel = await interaction.options.getChannel("channel") | ||
const role = interaction.options.getRole("role") | ||
const mentionable = await interaction.options.getMentionable("mentionable") | ||
|
||
await interaction.reply( | ||
`You provided the following options:\n str: ${str}\n int: ${int}\n num: ${num}\n bool: ${bool}\n user: ${user?.id}\n channel: ${channel?.id}\n role: ${role?.id}\n mentionable: ${mentionable?.id}` | ||
) | ||
} | ||
} |
Oops, something went wrong.