Skip to content

Commit

Permalink
fix: move base url client option (#200)
Browse files Browse the repository at this point in the history
* fix: move base url option back

* chore: add changeset
  • Loading branch information
apteryxxyz authored Oct 27, 2024
1 parent 3a93a39 commit e20d29c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/tricky-gifts-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@buape/carbon": patch
"create-carbon": patch
---

fix: move base url option back
4 changes: 4 additions & 0 deletions packages/carbon/src/classes/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import { concatUint8Arrays, subtleCrypto, valueToUint8Array } from "../utils.js"
* The options used for initializing the client
*/
export interface ClientOptions {
/**
* The base URL of the app
*/
baseUrl: string
/**
* The client ID of the app
*/
Expand Down
4 changes: 0 additions & 4 deletions packages/carbon/src/plugins/linked-roles/LinkedRoles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ type Tokens = {

declare module "../../classes/Client.d.ts" {
interface ClientOptions {
/**
* The base URL of the app
*/
baseUrl: string
/**
* The client secret of the app, used for OAuth
*/
Expand Down
5 changes: 2 additions & 3 deletions packages/create-carbon/template/.env.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ path: .env
{{/if}}
---


{{#if plugins.linkedRoles}}
BASE_URL=
{{#if plugins.linkedRoles}}
{{/if}}
DEPLOY_SECRET=
DISCORD_CLIENT_ID=
{{#if plugins.linkedRoles}}
DISCORD_CLIENT_SECRET=
{{/if}}
DISCORD_PUBLIC_KEY=
DISCORD_BOT_TOKEN=
DISCORD_BOT_TOKEN=
2 changes: 2 additions & 0 deletions website/content/classes/client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ A client must be created within your [`createHandle`](/api/index/functions/creat
```ts title="src/index.ts"
const handle = createHandle((env) => {
const client = new Client({
baseUrl: String(env.BASE_URL),
deploySecret: String(env.DEPLOY_SECRET),
clientId: String(env.CLIENT_ID),
publicKey: String(env.PUBLIC_KEY),
Expand All @@ -24,6 +25,7 @@ const handle = createHandle((env) => {

Here we have created a client with the following options:

- `baseUrl`: The relative base URL of your app
- `deploySecret`: The deploy secret of your bot, used as a password for deploying commands and other sensitive matters
- `clientId`: The Discord client ID of your bot
- `publicKey`: The Discord public key of your bot
Expand Down
1 change: 1 addition & 0 deletions website/content/getting-started/basic-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { createHandle, Client } from "@buape/carbon";
const handle = createHandle((env) => {
const client = new Client(
{
baseUrl: String(env.BASE_URL),
deploySecret: String(env.DEPLOY_SECRET),
clientId: String(env.DISCORD_CLIENT_ID),
publicKey: String(env.DISCORD_PUBLIC_KEY),
Expand Down

0 comments on commit e20d29c

Please sign in to comment.