@biskyjs/framework
Version:
67 lines • 2.31 kB
TypeScript
/// <reference types="node" />
import type { ArgumentError } from "../../errors/argument";
import type { UserError } from "../../errors/user";
import type { Args } from "../parsers/args";
import type { IArgument } from "../structures/argument";
import type { Command } from "../structures/command";
import type { CommandRunContext } from "./command";
import type { DiscordMessage } from "@biscuitland/api-types";
import type { APIChannel, APIDMChannel, APIGroupDMChannel, APIGuildChannel, APIGuildMember, APIUser, ChannelType } from "@biscuitland/common";
import type { AliasPieceOptions } from "@sapphire/pieces";
import type { Option, Result } from "@sapphire/result";
export interface ArgumentOptions extends AliasPieceOptions {
}
export interface ArgumentContext<T = unknown> extends Record<PropertyKey, unknown> {
argument: IArgument<T>;
args: Args;
message: DiscordMessage;
command: Command;
commandContext: CommandRunContext;
minimum?: number;
maximum?: number;
inclusive?: boolean;
}
export interface ArgType {
boolean: boolean;
channel: APIChannel;
dmChannel: APIDMChannel;
groupChannel: APIGroupDMChannel;
guildChannel: APIGuildChannel<ChannelType.GuildText>;
guildTextChannel: APIGuildChannel<ChannelType.GuildText>;
guildVoiceChannel: APIGuildChannel<ChannelType.GuildVoice>;
enum: string;
float: number;
hyperlink: URL;
integer: number;
message: DiscordMessage;
member: APIGuildMember;
number: number;
string: string;
user: APIUser;
}
export interface ArgOptions extends Omit<ArgumentContext, "message" | "command"> {
}
export interface RepeatArgOptions extends ArgOptions {
/**
* The maximum amount of times the argument can be repeated.
* @default Infinity
*/
times?: number;
}
/**
* The callback used for {@link Args.nextMaybe} and {@link Args.next}.
*/
export interface ArgsNextCallback<T> {
/**
* The value to be mapped.
*/
(value: string): Option<T>;
}
export type ResultType<T> = Result<T, UserError | ArgumentError<T>>;
export type ArrayResultType<T> = Result<T[], UserError | ArgumentError<T>>;
export interface ArgsJson {
message: DiscordMessage;
command: Command;
commandContext: CommandRunContext;
}
//# sourceMappingURL=arguments.d.ts.map