seyfert
Version:
The most advanced framework for discord bots
67 lines (66 loc) • 5.28 kB
TypeScript
import { Command, type CommandAutocompleteOption, CommandContext, type CommandOption, type ContextMenuCommand, type ContextOptionsResolved, type EntryPointCommand, EntryPointContext, MenuCommandContext, type MessageCommandOptionErrors, SubCommand, type UsingClient } from '.';
import { type MessageStructure, type OptionResolverStructure, Transformers } from '../client/transformers';
import type { MakeRequired } from '../common';
import { AutocompleteInteraction, type ChatInputCommandInteraction, type ComponentInteraction, type EntryPointInteraction, type MessageCommandInteraction, type ModalSubmitInteraction, type UserCommandInteraction, type __InternalReplyFunction } from '../structures';
import type { PermissionsBitField } from '../structures/extra/Permissions';
import { type APIApplicationCommandInteraction, type APIApplicationCommandInteractionDataOption, type APIInteraction, ApplicationCommandOptionType, type GatewayMessageCreateDispatchData } from '../types';
export type CommandOptionWithType = CommandOption & {
type: ApplicationCommandOptionType;
};
export interface CommandFromContent {
command?: Command | SubCommand;
parent?: Command;
fullCommandName: string;
}
export declare class HandleCommand {
client: UsingClient;
constructor(client: UsingClient);
autocomplete(interaction: AutocompleteInteraction, optionsResolver: OptionResolverStructure, command?: CommandAutocompleteOption): Promise<void>;
contextMenu(command: ContextMenuCommand, interaction: MessageCommandInteraction | UserCommandInteraction, context: MenuCommandContext<MessageCommandInteraction | UserCommandInteraction>): Promise<any>;
contextMenuMessage(command: ContextMenuCommand, interaction: MessageCommandInteraction, context: MenuCommandContext<MessageCommandInteraction>): Promise<any>;
contextMenuUser(command: ContextMenuCommand, interaction: UserCommandInteraction, context: MenuCommandContext<UserCommandInteraction>): Promise<any>;
entryPoint(command: EntryPointCommand, interaction: EntryPointInteraction, context: EntryPointContext): Promise<any>;
chatInput(command: Command | SubCommand, interaction: ChatInputCommandInteraction, resolver: OptionResolverStructure, context: CommandContext): Promise<any>;
modal(interaction: ModalSubmitInteraction): Promise<void>;
messageComponent(interaction: ComponentInteraction): Promise<void>;
interaction(body: APIInteraction, shardId: number, __reply?: __InternalReplyFunction): Promise<void>;
message(rawMessage: GatewayMessageCreateDispatchData, shardId: number): Promise<any>;
argsParser(content: string, _command: SubCommand | Command, _message: MessageStructure): Record<string, string>;
resolveCommandFromContent(content: string, _prefix: string, _message: GatewayMessageCreateDispatchData): CommandFromContent & {
argsContent?: string;
};
getCommandFromContent(commandRaw: string[]): CommandFromContent;
makeResolver(...args: Parameters<(typeof Transformers)['OptionResolver']>): OptionResolverStructure;
getParentMessageCommand(rawParentName: string): Command | ContextMenuCommand | undefined;
getCommand<T extends Command | ContextMenuCommand | EntryPointCommand>(data: {
guild_id?: string;
name: string;
}): T | undefined;
checkPermissions(app: PermissionsBitField, bot: bigint): import("../common").PermissionStrings | undefined;
fetchChannel(_option: CommandOptionWithType, query: string): Promise<import("../types").APIChannel> | null;
fetchUser(_option: CommandOptionWithType, query: string): Promise<import("../types").APIUser> | null;
fetchMember(_option: CommandOptionWithType, query: string, guildId: string): Promise<import("../types").APIGuildMember> | null;
fetchRole(_option: CommandOptionWithType, query: string, guildId?: string): Promise<import("../types").APIRole> | null;
runGlobalMiddlewares(command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext): Promise<false | {
error?: string;
pass?: boolean;
}>;
runMiddlewares(command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext): Promise<false | {
error?: string;
pass?: boolean;
}>;
makeMenuCommand(body: APIApplicationCommandInteraction, shardId: number, __reply?: __InternalReplyFunction): void | {
command: ContextMenuCommand;
interaction: UserCommandInteraction<boolean> | MessageCommandInteraction<boolean>;
context: MenuCommandContext<UserCommandInteraction<boolean> | MessageCommandInteraction<boolean>, never>;
};
runOptions(command: Command | SubCommand, context: CommandContext, resolver: OptionResolverStructure): Promise<boolean>;
argsOptionsParser(command: Command | SubCommand, message: GatewayMessageCreateDispatchData, args: Record<string, string>, resolved: MakeRequired<ContextOptionsResolved>): Promise<{
errors: {
name: string;
error: string;
fullError: MessageCommandOptionErrors;
}[];
options: APIApplicationCommandInteractionDataOption[];
}>;
}