From 1e0d1f3f6b1c064fb4144474cb64a07c41ab6850 Mon Sep 17 00:00:00 2001 From: MARCROCK22 Date: Fri, 13 Dec 2024 00:13:51 -0400 Subject: [PATCH] fix: allowed_mentions types --- .vscode/extensions.json | 4 +++- README.md | 6 ++++++ src/client/base.ts | 15 ++++++--------- src/types/payloads/channel.ts | 2 +- tests/bot.js | 6 +++--- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 70edba8..9f62c81 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,6 +3,8 @@ "biomejs.biome", "orta.vscode-twoslash-queries", "eamodio.gitlens", - "yoavbls.pretty-ts-errors" + "yoavbls.pretty-ts-errors", + "usernamehw.errorlens", + "better-ts-errors.better-ts-errors" ] } diff --git a/README.md b/README.md index 35109dc..12d5c53 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ There are many reasons to use Seyfert, but they dont all fit in this tiny readme pnpm add seyfert ``` +```sh +deno add npm:seyfert +``` + ```sh bun add seyfert ``` @@ -52,3 +56,5 @@ We are open to contributions, fork the repo and make your changes! - [npm - core](https://www.npmjs.com/package/seyfert) - [Website](https://seyfert.dev) - [Documentation](https://docs.seyfert.dev) + +![Seyfert star history](https://api.star-history.com/svg?repos=tiramisulabs/seyfert&type=Date) diff --git a/src/client/base.ts b/src/client/base.ts index 3c3624a..d1ca2db 100644 --- a/src/client/base.ts +++ b/src/client/base.ts @@ -134,7 +134,7 @@ export class BaseClient { permissions, ); }, - onInternalError(client: UsingClient, command, error?: unknown): any { + onInternalError(client: UsingClient, command, error: unknown): any { client.logger.fatal(`${command.name}.`, error); }, }, @@ -147,7 +147,7 @@ export class BaseClient { onMiddlewaresError(context: ComponentContext, error: string): any { context.client.logger.fatal('ComponentCommand.', context.author.id, error); }, - onInternalError(client: UsingClient, error?: unknown): any { + onInternalError(client: UsingClient, error: unknown): any { client.logger.fatal(error); }, }, @@ -155,12 +155,12 @@ export class BaseClient { modals: { defaults: { onRunError(context: ModalContext, error: unknown): any { - context.client.logger.fatal('ComponentCommand.', context.author.id, error); + context.client.logger.fatal('ModalCommand.', context.author.id, error); }, onMiddlewaresError(context: ModalContext, error: string): any { - context.client.logger.fatal('ComponentCommand.', context.author.id, error); + context.client.logger.fatal('ModalCommand.', context.author.id, error); }, - onInternalError(client: UsingClient, error?: unknown): any { + onInternalError(client: UsingClient, error: unknown): any { client.logger.fatal(error); }, }, @@ -471,7 +471,6 @@ export interface BaseClientOptions { defaults?: { onRunError?: (context: MenuCommandContext | CommandContext, error: unknown) => unknown; onPermissionsFail?: Command['onPermissionsFail']; - onBotPermissionsFail?: ( context: MenuCommandContext | CommandContext, permissions: PermissionStrings, @@ -503,9 +502,7 @@ export interface BaseClientOptions { onAfterRun?: ModalCommand['onAfterRun']; }; }; - allowedMentions?: Omit, 'parse'> & { - parse?: ('everyone' | 'roles' | 'users')[]; //nice types, d-api - }; + allowedMentions?: RESTPostAPIChannelMessageJSONBody['allowed_mentions']; getRC?(): Awaitable; } diff --git a/src/types/payloads/channel.ts b/src/types/payloads/channel.ts index a91e504..88fe332 100644 --- a/src/types/payloads/channel.ts +++ b/src/types/payloads/channel.ts @@ -1500,7 +1500,7 @@ export interface APIAllowedMentions { * * See https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types */ - parse?: AllowedMentionsTypes[]; + parse?: `${AllowedMentionsTypes}`[]; /** * Array of role_ids to mention (Max size of 100) */ diff --git a/tests/bot.js b/tests/bot.js index ead193f..0f2d63a 100644 --- a/tests/bot.js +++ b/tests/bot.js @@ -1,4 +1,4 @@ -const { Client } = require('../lib') +const { Client } = require('../lib'); const { GatewayIntentBits } = require('../lib/types'); const token = process.env.BOT_TOKEN; @@ -26,5 +26,5 @@ client.events.onFail = (event, err) => { client.start().then(() => { setTimeout(() => { process.exit(0); - }, 15_000 * client.gateway.totalShards) -}); \ No newline at end of file + }, 15_000 * client.gateway.totalShards); +});