diff --git a/packages/carbon/src/plugins/linked-roles/LinkedRoles.ts b/packages/carbon/src/plugins/linked-roles/LinkedRoles.ts index 70266039..501d89c8 100644 --- a/packages/carbon/src/plugins/linked-roles/LinkedRoles.ts +++ b/packages/carbon/src/plugins/linked-roles/LinkedRoles.ts @@ -24,34 +24,29 @@ type Tokens = { * * @example * ```ts - * import { Client, LinkedRoles } from "@buape/carbon" - * - * const client = new Client({ - * clientId: "12345678901234567890", - * clientSecret: "Bb7aZcvRN-BhrhY2qrUO6QzOK4SeqonG", - * publicKey: "c1a2f941ae8ce6d776f7704d0bb3d46b863e21fda491cdb2bdba6b8bc5fe7269", - * token: "MTA4NjEwNTYxMDUxMDE1NTg1Nw.GNt-U8.OSHy-g-5FlfESnu3Z9MEEMJLHiRthXajiXNwiE" - * }) - * - * const allStaff = ["439223656200273932"] - * - * const linkedRoles = new LinkedRoles(client, { - * baseUrl: "https://example.com", - * metadata: [ - * { - * key: "is_staff", - * name: "Verified Staff", - * description: "Whether the user is a verified staff member", - * type: ApplicationRoleConnectionMetadataType.BooleanEqual - * }, - * ], - * metadataCheckers: { - * is_staff: async (userId) => { - * if (allStaff.includes(userId)) return true - * return false - * } - * } - * }) +* import { createHandle, Client, ApplicationRoleConnectionMetadataType } from "@buape/carbon" +* import { LinkedRoles } from "@buape/carbon/linked-roles" +* +* const handle = createHandle((env) => { +* const client = new Client({ ... }, [ ... ]) +* const linkedRoles = new LinkedRoles(client, { +* metadata: [ +* { +* key: 'is_staff', +* name: 'Verified Staff', +* description: 'Whether the user is a verified staff member', +* type: ApplicationRoleConnectionMetadataType.BooleanEqual +* } +* ], +* metadataCheckers: { +* is_staff: async (userId) => { +* const allStaff = ["439223656200273932"] +* return allStaff.includes(userId) +* } +* } +* }) +* return [client, linkedRoles] +* }) * ``` */ export class LinkedRoles extends Plugin {