@arox/framework 0.1.0 → 0.1.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ import { SlashCommandBuilder, RESTPostAPIChatInputApplicationCommandsJSONBody } from "discord.js";
2
+ import { Client } from "../core";
3
+ export interface ApplicationJSONBody extends RESTPostAPIChatInputApplicationCommandsJSONBody {
4
+ prefix_support: boolean;
5
+ slash_support: boolean;
6
+ aliases: string[];
7
+ }
8
+ export declare class ApplicationCommandBuilder extends SlashCommandBuilder {
9
+ constructor();
10
+ protected prefix_support: boolean;
11
+ protected slash_support: boolean;
12
+ protected aliases: string[];
13
+ setAliases(...alias: string[]): this;
14
+ addAliases(...alias: string[]): this;
15
+ setPrefixSupport(support: boolean): this;
16
+ setSlashSupport(support: boolean): this;
17
+ toJSON(): ApplicationJSONBody;
18
+ toClientJSON(_client: Client): ReturnType<ApplicationCommandBuilder["toJSON"]>;
19
+ }
@@ -0,0 +1,21 @@
1
+ import { ChatInputCommandInteraction, Message } from "discord.js";
2
+ import { Context, Client } from "../index";
3
+ import { MaybePromise } from "#types/extra.js";
4
+ import { Logger } from "../../utils/index";
5
+ import { ApplicationCommandBuilder } from "./Builder";
6
+ type MessageContext = NonNullable<ReturnType<Context<Message>["toJSON"]>>;
7
+ type InteractionContext = NonNullable<ReturnType<Context<ChatInputCommandInteraction>["toJSON"]>>;
8
+ export declare class CommandBuilder {
9
+ #private;
10
+ readonly data: ApplicationCommandBuilder;
11
+ readonly client: Client;
12
+ readonly logger: Logger;
13
+ _onMessage?: (ctx: MessageContext) => MaybePromise<void>;
14
+ _onInteraction?: (ctx: InteractionContext) => MaybePromise<void>;
15
+ get supportsSlash(): false | ((ctx: InteractionContext) => MaybePromise<void>) | undefined;
16
+ get supportsPrefix(): false | ((ctx: MessageContext) => MaybePromise<void>) | undefined;
17
+ constructor(data: ApplicationCommandBuilder);
18
+ onMessage(func: (ctx: MessageContext) => MaybePromise<void>): this;
19
+ onInteraction(func: (ctx: InteractionContext) => MaybePromise<void>): this;
20
+ }
21
+ export {};
@@ -1,5 +1,6 @@
1
- import { Message, User, ChatInputCommandInteraction } from "discord.js";
2
- import { Client } from "../structures/Client";
1
+ import { Message, User, ChatInputCommandInteraction, Locale } from "discord.js";
2
+ import { Client } from "../index";
3
+ import { TOptions } from "i18next";
3
4
  type ContextPayload<T extends ChatInputCommandInteraction | Message> = T extends ChatInputCommandInteraction ? {
4
5
  interaction: T;
5
6
  args?: string[];
@@ -11,14 +12,19 @@ export declare class Context<T extends ChatInputCommandInteraction | Message> {
11
12
  readonly client: Client;
12
13
  readonly args: string[];
13
14
  readonly data: T;
15
+ locale?: `${Locale}`;
14
16
  constructor(client: Client, payload: ContextPayload<T>);
15
17
  isInteraction(): this is Context<ChatInputCommandInteraction>;
16
18
  isMessage(): this is Context<Message>;
17
19
  get author(): User | null;
20
+ t(key: string, options?: TOptions & {
21
+ defaultValue?: string;
22
+ }): string;
18
23
  toJSON(): {
19
24
  kind: "interaction";
20
25
  interaction: T;
21
26
  author: User | null;
27
+ t: any;
22
28
  message?: undefined;
23
29
  args?: undefined;
24
30
  } | {
@@ -26,6 +32,7 @@ export declare class Context<T extends ChatInputCommandInteraction | Message> {
26
32
  message: Message;
27
33
  args: string[];
28
34
  author: User | null;
35
+ t: any;
29
36
  interaction?: undefined;
30
37
  };
31
38
  }
@@ -1,19 +1,16 @@
1
1
  import { ClientEvents } from "discord.js";
2
2
  import { MaybePromise } from "#types/extra.js";
3
- import { Client } from "./Client";
4
- import { Logger } from "../utils/logger/Logger";
3
+ import { Client } from "../index";
4
+ import { Logger } from "../../utils/index";
5
5
  type EventArgs<K extends keyof ClientEvents> = ClientEvents[K];
6
6
  type EventHandler<K extends keyof ClientEvents> = (context: EventBuilder<K>, ...args: EventArgs<K>) => MaybePromise<void>;
7
7
  export declare class EventBuilder<K extends keyof ClientEvents> {
8
+ #private;
8
9
  readonly name: K;
9
10
  readonly once: boolean;
10
11
  readonly client: Client;
11
12
  readonly logger: Logger;
12
- private handler?;
13
- private bound;
14
- private readonly listener;
15
13
  constructor(name: K, once?: boolean, _handler?: EventHandler<K>);
16
- private register;
17
14
  onExecute(func: EventHandler<K>): this;
18
15
  }
19
16
  export {};
@@ -0,0 +1,4 @@
1
+ export * from "./Command";
2
+ export * from "./Context";
3
+ export * from "./Event";
4
+ export * from "./Builder";
@@ -1,17 +1,19 @@
1
1
  import { Client as DiscordClient, Collection, IntentsBitField } from "discord.js";
2
- import { CommandBuilder } from "./Command";
2
+ import { CommandBuilder } from "../index";
3
+ import { Logger } from "../../utils";
3
4
  import { FrameworkOptions } from "#types/client.js";
4
- import { Logger } from "../utils/logger/Logger";
5
+ import { i18n } from "i18next";
5
6
  export declare class Client<Ready extends boolean = boolean> extends DiscordClient<Ready> {
7
+ #private;
6
8
  readonly logger: Logger;
7
9
  commands: Collection<string, CommandBuilder>;
8
10
  aliases: Collection<string, Set<string>>;
9
11
  readonly prefix: string | false;
12
+ i18n: i18n | undefined;
10
13
  options: Omit<FrameworkOptions, "intents"> & {
11
14
  intents: IntentsBitField;
12
15
  };
13
16
  constructor(opts: FrameworkOptions);
14
- loadFiles(dir: string): Promise<void>;
15
- loadFile(file: string): Promise<void>;
17
+ login(token?: string): Promise<string>;
16
18
  registerCommands(): Promise<void>;
17
19
  }
@@ -0,0 +1 @@
1
+ export * from "./Client";
@@ -0,0 +1,2 @@
1
+ export * from "./core";
2
+ export * from "./builder";
@@ -0,0 +1,3 @@
1
+ export * from "./util";
2
+ export * from "./Files";
3
+ export * from "./logger/Logger";
@@ -3,6 +3,8 @@ import type { Color } from "colorette";
3
3
  import { Timestamp } from "@sapphire/timestamp";
4
4
  import type { ILogger } from "./ILogger";
5
5
  import { LogLevel } from "./ILogger";
6
+ import { LoggerModule } from "i18next";
7
+ export { LogLevel } from "./ILogger";
6
8
  export declare class Logger implements ILogger {
7
9
  level: LogLevel;
8
10
  readonly formats: Map<LogLevel, LoggerLevel>;
@@ -140,3 +142,11 @@ export declare enum LoggerStyleBackground {
140
142
  CyanBright = "bgCyanBright",
141
143
  WhiteBright = "bgWhiteBright"
142
144
  }
145
+ export declare class I18nLoggerAdapter implements LoggerModule {
146
+ private readonly logger;
147
+ readonly type = "logger";
148
+ constructor(logger: Logger);
149
+ log(...args: unknown[]): void;
150
+ warn(...args: unknown[]): void;
151
+ error(...args: unknown[]): void;
152
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Normalizes data that is a rest parameter or an array into an array with a depth of 1.
3
+ *
4
+ * @typeParam ItemType - The data that must satisfy {@link RestOrArray}.
5
+ * @param arr - The (possibly variadic) data to normalize
6
+ */
7
+ export declare function normalizeArray<ItemType>(arr: RestOrArray<ItemType>): ItemType[];
8
+ /**
9
+ * Represents data that may be an array or came from a rest parameter.
10
+ *
11
+ * @remarks
12
+ * This type is used throughout builders to ensure both an array and variadic arguments
13
+ * may be used. It is normalized with {@link normalizeArray}.
14
+ */
15
+ export type RestOrArray<Type> = Type[] | [Type[]];
@@ -1,4 +1,4 @@
1
1
  import { PrefixOptions } from "#types/client.js";
2
2
  import { InteractionResponse, Message } from "discord.js";
3
- export declare function deleteMessage(message: Message | InteractionResponse, time?: number): Promise<void>;
3
+ export declare function deleteMessageAfterSent(message: Message | InteractionResponse, time?: number): Promise<void>;
4
4
  export declare function getPrefix(opts: PrefixOptions): string | false;
package/package.json CHANGED
@@ -1,57 +1 @@
1
- {
2
- "name": "@arox/framework",
3
- "version": "0.1.0",
4
- "description": "",
5
- "keywords": [
6
- "discord.js",
7
- "framework"
8
- ],
9
- "homepage": "https://github.com/AroxBot/framework#readme",
10
- "bugs": {
11
- "url": "https://github.com/AroxBot/framework/issues"
12
- },
13
- "license": "Apache-2.0",
14
- "author": "vrdons",
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/AroxBot/framework.git"
18
- },
19
- "type": "commonjs",
20
- "main": "dist/index.js",
21
- "types": "dist/index.d.ts",
22
- "imports": {
23
- "#types/*": "./types/*"
24
- },
25
- "scripts": {
26
- "prepare": "node scripts/prepareHusky.js",
27
- "test": "echo \"Error: no test specified\" && exit 1",
28
- "check": "oxfmt --check && oxlint --type-aware --type-check",
29
- "format": "oxfmt",
30
- "build:js": "swc src -d dist --strip-leading-paths --copy-files",
31
- "build:dts": "tsc --emitDeclarationOnly",
32
- "build": "npm run build:js && node ./scripts/actions/patch.js && npm run build:dts",
33
- "release:git": "node scripts/actions/github.js",
34
- "release:npm": "node scripts/actions/npm.js"
35
- },
36
- "dependencies": {
37
- "@sapphire/timestamp": "^1.0.5",
38
- "@swc/helpers": "^0.5.18",
39
- "colorette": "^2.0.20",
40
- "fast-glob": "^3.3.3",
41
- "lodash": "^4.17.21"
42
- },
43
- "devDependencies": {
44
- "@swc/cli": "^0.7.10",
45
- "@types/lodash": "^4.17.23",
46
- "@types/node": "^25.0.8",
47
- "husky": "^9.1.7",
48
- "libnpmpack": "^9.0.12",
49
- "oxfmt": "^0.24.0",
50
- "oxlint": "^1.39.0",
51
- "oxlint-tsgolint": "^0.11.0",
52
- "typescript": "^5.9.3"
53
- },
54
- "peerDependencies": {
55
- "discord.js": ">=14.25.1"
56
- }
57
- }
1
+ {"name":"@arox/framework","version":"0.1.2-beta.1","description":"","keywords":["arox","discord.js","framework"],"homepage":"https://github.com/AroxBot/framework#readme","bugs":{"url":"https://github.com/AroxBot/framework/issues"},"license":"Apache-2.0","author":"vrdons","contributors":["fhyrox"],"repository":{"type":"git","url":"git+https://github.com/AroxBot/framework.git"},"type":"commonjs","main":"dist/index.js","types":"dist/index.d.ts","imports":{"#types/*":"./types/*"},"dependencies":{"@sapphire/timestamp":"^1.0.5","colorette":"^2.0.20","fast-glob":"^3.3.3","i18next":"^25.8.0"},"peerDependencies":{"discord.js":">=14.25.1"}}
package/types/client.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { ClientOptions } from "discord.js";
2
2
  import { LoggerOptions } from "../src/utils/logger/Logger";
3
+ import { i18n } from "i18next";
3
4
 
4
5
  export interface FrameworkPaths {
5
6
  events?: string;
6
7
  commands?: string;
8
+ locales?: string;
7
9
  }
8
10
 
9
11
  export type PrefixOptions =
@@ -14,6 +16,7 @@ export type PrefixOptions =
14
16
  export interface FrameworkOptions extends ClientOptions {
15
17
  logger?: LoggerOptions;
16
18
  prefix?: PrefixOptions;
17
- paths?: FrameworkPaths;
18
19
  autoRegisterCommands?: boolean;
20
+ includePaths: string[];
21
+ i18n?: i18n;
19
22
  }
package/cliff.toml DELETED
@@ -1,48 +0,0 @@
1
- [changelog]
2
- header = """
3
- # Changelog\n
4
- All notable changes to this project will be documented in this file.\n
5
- """
6
- body = """
7
- {% if version %}
8
- ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}\
9
- {% else %}\
10
- ## Unreleased\
11
- {% endif %}
12
-
13
- {% for group, commits in commits | group_by(attribute="group") %}\
14
- ### {{ group | upper_first }}
15
- {% for commit in commits %}
16
- - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }} {% if commit.author.username %}by [@{{ commit.author.username }}](https://github.com/{{ commit.author.username }}){% else %}by {{ commit.author.name }}{% endif %} {% if commit.url %}([{{ commit.id | truncate(length=7, end="") }}]({{ commit.url }})){% else %}({{ commit.id | truncate(length=7, end="") }}){% endif %}\
17
- {% endfor %}\n
18
- {% endfor %}
19
- """
20
- trim = true
21
- footer = """
22
- <!-- generated by git-cliff -->
23
- """
24
-
25
- [git]
26
- conventional_commits = true
27
- filter_unconventional = true
28
- split_commits = false
29
- commit_preprocessors = [
30
- { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/vrdons/zKitap2Pdf/pull/${2}))" },
31
- ]
32
- commit_parsers = [
33
- { message = "^feat", group = "Features" },
34
- { message = "^fix", group = "Bug Fixes" },
35
- { message = "^doc", group = "Documentation" },
36
- { message = "^perf", group = "Performance" },
37
- { message = "^refactor", group = "Refactor" },
38
- { message = "^style", group = "Styling" },
39
- { message = "^test", group = "Testing" },
40
- { message = "^chore\\(release\\): prepare for", skip = true },
41
- { message = "^chore", group = "Miscellaneous Tasks" },
42
- { body = ".*security", group = "Security" },
43
-
44
- { message = "^deps|^build", group = "Dependencies" },
45
- { message = "^Merge pull request", group = "Pull Requests" },
46
- { message = "^Merge branch", group = "Merges" },
47
- { message = "^Revert", group = "Reverts" },
48
- ]
package/dist/context.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: Object.getOwnPropertyDescriptor(all, name).get
9
- });
10
- }
11
- _export(exports, {
12
- get clearClient () {
13
- return clearClient;
14
- },
15
- get currentClient () {
16
- return currentClient;
17
- },
18
- get setClient () {
19
- return setClient;
20
- }
21
- });
22
- let currentClient = null;
23
- function setClient(client) {
24
- currentClient = client;
25
- }
26
- function clearClient() {
27
- currentClient = null;
28
- }
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _discord = require("discord.js");
6
- const _Event = require("../structures/Event");
7
- const _Context = require("../structures/Context");
8
- new _Event.EventBuilder(_discord.Events.InteractionCreate, false).onExecute(async function(context, interaction) {
9
- if (!interaction.isChatInputCommand()) return;
10
- const command = context.client.commands.get(interaction.commandName);
11
- if (!command || !command.supportsSlash) {
12
- await interaction.reply({
13
- content: "Command not found or disabled.",
14
- ephemeral: true
15
- });
16
- return;
17
- }
18
- try {
19
- const ctx = new _Context.Context(context.client, {
20
- interaction
21
- });
22
- if (command._onInteraction) await command._onInteraction(ctx.toJSON());
23
- } catch (error) {
24
- context.client.logger.error(`Error executing command ${command.name}:`, error);
25
- if (interaction.replied || interaction.deferred) {
26
- await interaction.followUp({
27
- content: "There was an error while executing this command!",
28
- ephemeral: true
29
- });
30
- } else {
31
- await interaction.reply({
32
- content: "There was an error while executing this command!",
33
- ephemeral: true
34
- });
35
- }
36
- }
37
- });
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _discord = require("discord.js");
6
- const _Event = require("../structures/Event");
7
- const _Context = require("../structures/Context");
8
- const _util = require("../utils/util");
9
- new _Event.EventBuilder(_discord.Events.MessageCreate, false, async function(context, message) {
10
- if (message.author.bot) return;
11
- const prefix = context.client.prefix;
12
- if (typeof prefix !== "string" || prefix.length === 0 || !message.content.startsWith(prefix)) return;
13
- const args = message.content.slice(prefix.length).trim().split(/ +/);
14
- const commandName = args.shift()?.toLowerCase();
15
- if (!commandName) return;
16
- const commandAlias = context.client.aliases.findKey((cmd)=>cmd.has(commandName));
17
- let command = context.client.commands.get(commandAlias ?? commandName);
18
- if (!command || !command.supportsPrefix) {
19
- await message.reply({
20
- content: "Command not found or disabled.",
21
- allowedMentions: {
22
- repliedUser: false
23
- }
24
- }).then(_util.deleteMessage);
25
- return;
26
- }
27
- try {
28
- const ctx = new _Context.Context(context.client, {
29
- message,
30
- args
31
- });
32
- context.logger.debug(`${ctx.author?.tag ?? "Unknown"} used ${command.name}(message)`);
33
- if (command._onMessage) await command._onMessage(ctx.toJSON());
34
- } catch (error) {
35
- context.client.logger.error(`Error executing command ${command.name}:`, error);
36
- }
37
- });
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _discord = require("discord.js");
6
- const _Event = require("../structures/Event");
7
- new _Event.EventBuilder(_discord.Events.ClientReady).onExecute(async function(context) {
8
- if (context.client.options.autoRegisterCommands) {
9
- await context.client.registerCommands();
10
- }
11
- });
@@ -1,22 +0,0 @@
1
- import { ApplicationCommandOptionData, ApplicationCommandOptionType } from "discord.js";
2
- export declare class Argument {
3
- readonly name: string;
4
- readonly description: string;
5
- readonly type: ApplicationCommandOptionType;
6
- readonly required: boolean;
7
- readonly choices?: {
8
- name: string;
9
- value: string | number;
10
- }[];
11
- constructor(data: {
12
- name: string;
13
- description: string;
14
- type: ApplicationCommandOptionType;
15
- required?: boolean;
16
- choices?: {
17
- name: string;
18
- value: string | number;
19
- }[];
20
- });
21
- toJSON(): ApplicationCommandOptionData;
22
- }
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "Argument", {
6
- enumerable: true,
7
- get: function() {
8
- return Argument;
9
- }
10
- });
11
- class Argument {
12
- name;
13
- description;
14
- type;
15
- required;
16
- choices;
17
- constructor(data){
18
- this.name = data.name;
19
- this.description = data.description;
20
- this.type = data.type;
21
- this.required = data.required ?? false;
22
- this.choices = data.choices;
23
- }
24
- toJSON() {
25
- return {
26
- name: this.name,
27
- description: this.description,
28
- type: this.type,
29
- required: this.required,
30
- choices: this.choices
31
- };
32
- }
33
- }
@@ -1,99 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "Client", {
6
- enumerable: true,
7
- get: function() {
8
- return Client;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _discord = require("discord.js");
13
- const _path = /*#__PURE__*/ _interop_require_default._(require("path"));
14
- const _Files = require("../utils/Files");
15
- const _lodash = require("lodash");
16
- const _context = require("../context");
17
- const _util = require("../utils/util");
18
- const _Logger = require("../utils/logger/Logger");
19
- const defaultOpts = {
20
- paths: {
21
- events: "events",
22
- commands: "commands"
23
- },
24
- autoRegisterCommands: true
25
- };
26
- class Client extends _discord.Client {
27
- logger;
28
- commands;
29
- aliases;
30
- prefix;
31
- constructor(opts){
32
- super((0, _lodash.merge)({}, defaultOpts, opts));
33
- this.logger = new _Logger.Logger(opts.logger);
34
- this.commands = new _discord.Collection();
35
- this.aliases = new _discord.Collection();
36
- this.prefix = (0, _util.getPrefix)(this.options.prefix ?? {
37
- enabled: false
38
- });
39
- if (this.options.paths?.events) {
40
- this.loadFiles(_path.default.join((0, _Files.getProjectRoot)(), this.options.paths?.events)).catch((error)=>this.logger.error("Error loading events:", error));
41
- }
42
- (0, _context.setClient)(this);
43
- try {
44
- require("../events/ready");
45
- require("../events/interaction");
46
- if (this.prefix) require("../events/message");
47
- } finally{
48
- (0, _context.clearClient)();
49
- }
50
- }
51
- async loadFiles(dir) {
52
- if (!require("fs").existsSync(dir)) {
53
- this.logger.warn(`Directory not found: ${dir}`);
54
- return;
55
- }
56
- const files = (0, _Files.getFiles)(dir);
57
- for (const file of files){
58
- await this.loadFile(file);
59
- }
60
- }
61
- async loadFile(file) {
62
- try {
63
- delete require.cache[require.resolve(file)];
64
- (0, _context.setClient)(this);
65
- require(file);
66
- } catch (error) {
67
- this.logger.error(`Error loading file ${file}:`, error);
68
- } finally{
69
- (0, _context.clearClient)();
70
- }
71
- }
72
- async registerCommands() {
73
- if (!this.token) {
74
- this.logger.warn("registerCommands skipped: client token is not set.");
75
- return;
76
- }
77
- if (!this.application) {
78
- this.logger.warn("registerCommands skipped: client application is not ready.");
79
- return;
80
- }
81
- const slashCommands = this.commands.filter((cmd)=>cmd.supportsSlash).map((cmd)=>({
82
- name: cmd.name,
83
- description: cmd.description,
84
- options: cmd.options
85
- }));
86
- const rest = new _discord.REST({
87
- version: "10"
88
- }).setToken(this.token);
89
- try {
90
- this.logger.debug(`Started refreshing ${slashCommands.length} application (/) commands.`);
91
- await rest.put(_discord.Routes.applicationCommands(this.application.id), {
92
- body: slashCommands
93
- });
94
- this.logger.info(`Loaded ${slashCommands.length} application (/) commands.`);
95
- } catch (error) {
96
- this.logger.error("Failed to register commands:", error);
97
- }
98
- }
99
- }
@@ -1,31 +0,0 @@
1
- import { ApplicationCommandOptionData, ChatInputCommandInteraction, Message } from "discord.js";
2
- import { Context } from "./Context";
3
- import { Client } from "./Client";
4
- import { Argument } from "./Argument";
5
- import { MaybePromise } from "#types/extra.js";
6
- import { Logger } from "../utils/logger/Logger";
7
- export interface CommandOptions {
8
- name: string;
9
- description: string;
10
- aliases?: string[];
11
- options?: (ApplicationCommandOptionData | Argument)[];
12
- slash?: boolean;
13
- prefix?: boolean;
14
- }
15
- export declare class CommandBuilder {
16
- readonly client: Client;
17
- readonly logger: Logger;
18
- readonly name: string;
19
- readonly description: string;
20
- readonly aliases: string[];
21
- readonly options: ApplicationCommandOptionData[];
22
- private _supportsSlash;
23
- private _supportsPrefix;
24
- _onMessage?: (ctx: NonNullable<ReturnType<Context<Message>["toJSON"]>>) => MaybePromise<void>;
25
- _onInteraction?: (ctx: NonNullable<ReturnType<Context<ChatInputCommandInteraction>["toJSON"]>>) => MaybePromise<void>;
26
- get supportsSlash(): false | ((ctx: NonNullable<ReturnType<Context<ChatInputCommandInteraction>["toJSON"]>>) => MaybePromise<void>) | undefined;
27
- get supportsPrefix(): false | ((ctx: NonNullable<ReturnType<Context<Message>["toJSON"]>>) => MaybePromise<void>) | undefined;
28
- constructor(options: CommandOptions);
29
- onMessage(func: (ctx: NonNullable<ReturnType<Context<Message>["toJSON"]>>) => MaybePromise<void>): this;
30
- onInteraction(func: (ctx: NonNullable<ReturnType<Context<ChatInputCommandInteraction>["toJSON"]>>) => MaybePromise<void>): this;
31
- }