mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
fix: use d-api enum instead
This commit is contained in:
parent
c9b4078a60
commit
2e680f557f
@ -21,7 +21,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"chokidar": "^3.6.0",
|
||||
"discord-api-types": "^0.37.83",
|
||||
"discord-api-types": "^0.37.84",
|
||||
"magic-bytes.js": "^1.10.0",
|
||||
"ts-mixer": "^6.0.4",
|
||||
"ws": "^8.16.0"
|
||||
|
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
@ -12,8 +12,8 @@ importers:
|
||||
specifier: ^3.6.0
|
||||
version: 3.6.0
|
||||
discord-api-types:
|
||||
specifier: ^0.37.83
|
||||
version: 0.37.83
|
||||
specifier: ^0.37.84
|
||||
version: 0.37.84
|
||||
magic-bytes.js:
|
||||
specifier: ^1.10.0
|
||||
version: 1.10.0
|
||||
@ -362,8 +362,8 @@ packages:
|
||||
resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==}
|
||||
engines: {node: '>=0.10'}
|
||||
|
||||
discord-api-types@0.37.83:
|
||||
resolution: {integrity: sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==}
|
||||
discord-api-types@0.37.84:
|
||||
resolution: {integrity: sha512-NngmTBW8vermlbO0qNtaS7SHCWB/R96ICqflTwM/cV7zsxyQGd38E2bBlwaxLbXgb2YTF3+Yx6+qGs/3sXedCw==}
|
||||
|
||||
dot-prop@5.3.0:
|
||||
resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==}
|
||||
@ -1191,7 +1191,7 @@ snapshots:
|
||||
denque@2.1.0:
|
||||
optional: true
|
||||
|
||||
discord-api-types@0.37.83: {}
|
||||
discord-api-types@0.37.84: {}
|
||||
|
||||
dot-prop@5.3.0:
|
||||
dependencies:
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {
|
||||
ApplicationCommandOptionType,
|
||||
ChannelType,
|
||||
InteractionContextType,
|
||||
type APIApplicationCommandInteractionDataOption,
|
||||
type GatewayMessageCreateDispatchData,
|
||||
} from 'discord-api-types/v10';
|
||||
@ -8,7 +9,6 @@ import {
|
||||
Command,
|
||||
CommandContext,
|
||||
IgnoreCommand,
|
||||
InteractionContextTypes,
|
||||
OptionResolver,
|
||||
SubCommand,
|
||||
User,
|
||||
@ -103,7 +103,7 @@ export async function onMessageCreate(
|
||||
if (!command) return;
|
||||
if (!command.run) return self.logger.warn(`${fullCommandName} command does not have 'run' callback`);
|
||||
|
||||
if (!command.contexts?.includes(InteractionContextTypes.BOT_DM) && !message.guildId) return;
|
||||
if (!command.contexts?.includes(InteractionContextType.BotDM) && !message.guildId) return;
|
||||
if (command.guildId && !command.guildId?.includes(message.guildId!)) return;
|
||||
|
||||
const resolved: MakeRequired<ContextOptionsResolved> = {
|
||||
|
@ -1,6 +1,8 @@
|
||||
import {
|
||||
ApplicationCommandOptionType,
|
||||
ApplicationCommandType,
|
||||
type ApplicationIntegrationType,
|
||||
type InteractionContextType,
|
||||
type APIApplicationCommandBasicOption,
|
||||
type APIApplicationCommandOption,
|
||||
type APIApplicationCommandSubcommandGroupOption,
|
||||
@ -17,7 +19,7 @@ import type {
|
||||
import type { Attachment } from '../../builders';
|
||||
import { magicImport, type FlatObjectKeys } from '../../common';
|
||||
import type { AllChannels, AutocompleteInteraction, GuildRole, InteractionGuildMember, User } from '../../structures';
|
||||
import type { Groups, IntegrationTypes, InteractionContextTypes, RegisteredMiddlewares } from '../decorators';
|
||||
import type { Groups, RegisteredMiddlewares } from '../decorators';
|
||||
import type { OptionResolver } from '../optionresolver';
|
||||
import type { CommandContext } from './chatcontext';
|
||||
import type {
|
||||
@ -123,8 +125,8 @@ export class BaseCommand {
|
||||
nsfw?: boolean;
|
||||
description!: string;
|
||||
defaultMemberPermissions?: bigint;
|
||||
integrationTypes?: IntegrationTypes[];
|
||||
contexts?: InteractionContextTypes[];
|
||||
integrationTypes?: ApplicationIntegrationType[];
|
||||
contexts?: InteractionContextType[];
|
||||
botPermissions?: bigint;
|
||||
name_localizations?: Partial<Record<LocaleString, string>>;
|
||||
description_localizations?: Partial<Record<LocaleString, string>>;
|
||||
|
@ -1,6 +1,11 @@
|
||||
import type { ApplicationCommandType, LocaleString } from 'discord-api-types/v10';
|
||||
import type {
|
||||
ApplicationCommandType,
|
||||
ApplicationIntegrationType,
|
||||
InteractionContextType,
|
||||
LocaleString,
|
||||
} from 'discord-api-types/v10';
|
||||
import { magicImport, type PermissionStrings } from '../../common';
|
||||
import type { IntegrationTypes, InteractionContextTypes, RegisteredMiddlewares } from '../decorators';
|
||||
import type { RegisteredMiddlewares } from '../decorators';
|
||||
import type { MenuCommandContext } from './menucontext';
|
||||
import type { UsingClient } from './shared';
|
||||
|
||||
@ -14,8 +19,8 @@ export abstract class ContextMenuCommand {
|
||||
name!: string;
|
||||
type!: ApplicationCommandType.User | ApplicationCommandType.Message;
|
||||
nsfw?: boolean;
|
||||
integrationTypes?: IntegrationTypes[];
|
||||
contexts?: InteractionContextTypes[];
|
||||
integrationTypes?: ApplicationIntegrationType[];
|
||||
contexts?: InteractionContextType[];
|
||||
description!: string;
|
||||
defaultMemberPermissions?: bigint;
|
||||
botPermissions?: bigint;
|
||||
|
@ -1,20 +1,16 @@
|
||||
import { ApplicationCommandType, PermissionFlagsBits, type LocaleString } from 'discord-api-types/v10';
|
||||
import {
|
||||
ApplicationCommandType,
|
||||
ApplicationIntegrationType,
|
||||
InteractionContextType,
|
||||
PermissionFlagsBits,
|
||||
type LocaleString,
|
||||
} from 'discord-api-types/v10';
|
||||
import type { FlatObjectKeys, PermissionStrings } from '../common';
|
||||
import type { CommandOption, OptionsRecord, SubCommand } from './applications/chat';
|
||||
import type { DefaultLocale, IgnoreCommand, MiddlewareContext } from './applications/shared';
|
||||
|
||||
export interface RegisteredMiddlewares {}
|
||||
|
||||
export enum IntegrationTypes {
|
||||
GUILD_INSTALL = 0,
|
||||
USER_INSTALL = 1,
|
||||
}
|
||||
export enum InteractionContextTypes {
|
||||
GUILD = 0,
|
||||
BOT_DM = 1,
|
||||
PRIVATE_CHANNEL = 2,
|
||||
}
|
||||
|
||||
type DeclareOptions =
|
||||
| {
|
||||
name: string;
|
||||
@ -23,8 +19,8 @@ type DeclareOptions =
|
||||
defaultMemberPermissions?: PermissionStrings | bigint;
|
||||
guildId?: string[];
|
||||
nsfw?: boolean;
|
||||
integrationTypes?: (keyof typeof IntegrationTypes)[];
|
||||
contexts?: (keyof typeof InteractionContextTypes)[];
|
||||
integrationTypes?: (keyof typeof ApplicationIntegrationType)[];
|
||||
contexts?: (keyof typeof InteractionContextType)[];
|
||||
ignore?: IgnoreCommand;
|
||||
aliases?: string[];
|
||||
}
|
||||
@ -36,8 +32,8 @@ type DeclareOptions =
|
||||
defaultMemberPermissions?: PermissionStrings | bigint;
|
||||
guildId?: string[];
|
||||
nsfw?: boolean;
|
||||
integrationTypes?: (keyof typeof IntegrationTypes)[];
|
||||
contexts?: (keyof typeof InteractionContextTypes)[];
|
||||
integrationTypes?: (keyof typeof ApplicationIntegrationType)[];
|
||||
contexts?: (keyof typeof InteractionContextType)[];
|
||||
},
|
||||
'type' | 'description'
|
||||
> & {
|
||||
@ -161,8 +157,8 @@ export function Declare(declare: DeclareOptions) {
|
||||
class extends target {
|
||||
name = declare.name;
|
||||
nsfw = declare.nsfw;
|
||||
contexts = declare.contexts?.map(i => InteractionContextTypes[i]);
|
||||
integrationTypes = declare.integrationTypes?.map(i => IntegrationTypes[i]);
|
||||
contexts = declare.contexts?.map(i => InteractionContextType[i]);
|
||||
integrationTypes = declare.integrationTypes?.map(i => ApplicationIntegrationType[i]);
|
||||
defaultMemberPermissions = Array.isArray(declare.defaultMemberPermissions)
|
||||
? declare.defaultMemberPermissions?.reduce((acc, prev) => acc | PermissionFlagsBits[prev], BigInt(0))
|
||||
: declare.defaultMemberPermissions;
|
||||
|
Loading…
x
Reference in New Issue
Block a user