trivious 1.6.18 → 2.0.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.
- package/README.md +57 -68
- package/dist/{core/builders/util.builders.d.ts → features/builders/utility.builders.d.ts} +0 -9
- package/dist/{core/builders/util.builders.js → features/builders/utility.builders.js} +2 -2
- package/dist/features/builders/utility.builders.js.map +1 -0
- package/dist/features/client/client.types.d.ts +85 -0
- package/dist/features/client/client.types.js +3 -0
- package/dist/{shared/typings/client.js.map → features/client/client.types.js.map} +1 -1
- package/dist/features/client/deploy.client.d.ts +7 -0
- package/dist/features/client/deploy.client.js +43 -0
- package/dist/features/client/deploy.client.js.map +1 -0
- package/dist/features/client/trivious.client.d.ts +3 -0
- package/dist/features/client/trivious.client.js +61 -0
- package/dist/features/client/trivious.client.js.map +1 -0
- package/dist/features/commands/commands.types.d.ts +3 -0
- package/dist/features/commands/commands.types.js +3 -0
- package/dist/{shared/typings/commands.js.map → features/commands/commands.types.js.map} +1 -1
- package/dist/features/commands/methods.commands.d.ts +13 -0
- package/dist/features/commands/methods.commands.js +70 -0
- package/dist/features/commands/methods.commands.js.map +1 -0
- package/dist/features/commands/registry.commands.d.ts +7 -0
- package/dist/features/commands/registry.commands.js +90 -0
- package/dist/features/commands/registry.commands.js.map +1 -0
- package/dist/features/components/components.types.d.ts +3 -0
- package/dist/features/components/components.types.js +10 -0
- package/dist/features/components/components.types.js.map +1 -0
- package/dist/features/components/registry.components.d.ts +7 -0
- package/dist/features/components/registry.components.js +23 -0
- package/dist/features/components/registry.components.js.map +1 -0
- package/dist/features/customId/customid.types.d.ts +13 -0
- package/dist/features/customId/customid.types.js +3 -0
- package/dist/features/customId/customid.types.js.map +1 -0
- package/dist/features/customId/methods.customid.d.ts +20 -0
- package/dist/features/customId/methods.customid.js +24 -0
- package/dist/features/customId/methods.customid.js.map +1 -0
- package/dist/features/events/events.types.d.ts +3 -0
- package/dist/features/events/events.types.js +3 -0
- package/dist/{shared/typings/events.js.map → features/events/events.types.js.map} +1 -1
- package/dist/features/events/presets/clientReady.d.ts +11 -0
- package/dist/{core/events → features/events/presets}/clientReady.js +1 -1
- package/dist/features/events/presets/clientReady.js.map +1 -0
- package/dist/features/events/presets/interactionCreate.d.ts +10 -0
- package/dist/features/events/presets/interactionCreate.js +49 -0
- package/dist/features/events/presets/interactionCreate.js.map +1 -0
- package/dist/features/events/registry.events.d.ts +8 -0
- package/dist/features/events/registry.events.js +45 -0
- package/dist/features/events/registry.events.js.map +1 -0
- package/dist/features/modules/modules.types.d.ts +3 -0
- package/dist/features/modules/modules.types.js +3 -0
- package/dist/{shared/typings/module.js.map → features/modules/modules.types.js.map} +1 -1
- package/dist/features/modules/registry.modules.d.ts +8 -0
- package/dist/features/modules/registry.modules.js +30 -0
- package/dist/features/modules/registry.modules.js.map +1 -0
- package/dist/features/structure/index.structure.d.ts +10 -0
- package/dist/features/structure/index.structure.js +51 -0
- package/dist/features/structure/index.structure.js.map +1 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +4 -10
- package/dist/modules.types-4hfuUiCb.d.ts +165 -0
- package/dist/shared/registries.d.ts +26 -0
- package/dist/shared/registries.js +25 -0
- package/dist/shared/registries.js.map +1 -0
- package/dist/shared/typings.d.ts +4 -0
- package/dist/shared/typings.js +9 -0
- package/dist/shared/typings.js.map +1 -0
- package/dist/utility/errors.d.ts +15 -0
- package/dist/utility/errors.js +24 -0
- package/dist/utility/errors.js.map +1 -0
- package/dist/utility/functions.d.ts +4 -0
- package/dist/utility/functions.js +32 -0
- package/dist/utility/functions.js.map +1 -0
- package/package.json +7 -3
- package/dist/core/builders/util.builders.js.map +0 -1
- package/dist/core/client/trivious.client.d.ts +0 -6
- package/dist/core/client/trivious.client.js +0 -115
- package/dist/core/client/trivious.client.js.map +0 -1
- package/dist/core/commands/methods.command.d.ts +0 -6
- package/dist/core/commands/methods.command.js +0 -90
- package/dist/core/commands/methods.command.js.map +0 -1
- package/dist/core/events/clientReady.d.ts +0 -14
- package/dist/core/events/clientReady.js.map +0 -1
- package/dist/core/events/interactionCreate.d.ts +0 -14
- package/dist/core/events/interactionCreate.js +0 -84
- package/dist/core/events/interactionCreate.js.map +0 -1
- package/dist/core/registry/command.registry.d.ts +0 -6
- package/dist/core/registry/command.registry.js +0 -54
- package/dist/core/registry/command.registry.js.map +0 -1
- package/dist/core/registry/component.registry.d.ts +0 -6
- package/dist/core/registry/component.registry.js +0 -41
- package/dist/core/registry/component.registry.js.map +0 -1
- package/dist/core/registry/event.registry.d.ts +0 -6
- package/dist/core/registry/event.registry.js +0 -71
- package/dist/core/registry/event.registry.js.map +0 -1
- package/dist/core/registry/index.d.ts +0 -22
- package/dist/core/registry/index.js +0 -39
- package/dist/core/registry/index.js.map +0 -1
- package/dist/core/registry/module.registry.d.ts +0 -6
- package/dist/core/registry/module.registry.js +0 -55
- package/dist/core/registry/module.registry.js.map +0 -1
- package/dist/index-DbWA_10I.d.ts +0 -439
- package/dist/shared/typings/client.d.ts +0 -74
- package/dist/shared/typings/client.js +0 -3
- package/dist/shared/typings/commands.d.ts +0 -6
- package/dist/shared/typings/commands.js +0 -3
- package/dist/shared/typings/components.d.ts +0 -6
- package/dist/shared/typings/components.js +0 -10
- package/dist/shared/typings/components.js.map +0 -1
- package/dist/shared/typings/events.d.ts +0 -6
- package/dist/shared/typings/events.js +0 -3
- package/dist/shared/typings/index.d.ts +0 -6
- package/dist/shared/typings/index.js +0 -9
- package/dist/shared/typings/index.js.map +0 -1
- package/dist/shared/typings/module.d.ts +0 -6
- package/dist/shared/typings/module.js +0 -3
- package/dist/shared/typings/permissions.d.ts +0 -16
- package/dist/shared/typings/permissions.js +0 -13
- package/dist/shared/typings/permissions.js.map +0 -1
- package/dist/shared/typings/registry.d.ts +0 -51
- package/dist/shared/typings/registry.js +0 -61
- package/dist/shared/typings/registry.js.map +0 -1
- package/dist/shared/utility/components.utility.d.ts +0 -6
- package/dist/shared/utility/components.utility.js +0 -17
- package/dist/shared/utility/components.utility.js.map +0 -1
- package/dist/shared/utility/functions.d.ts +0 -60
- package/dist/shared/utility/functions.js +0 -81
- package/dist/shared/utility/functions.js.map +0 -1
- package/dist/shared/utility/permissions.utility.d.ts +0 -6
- package/dist/shared/utility/permissions.utility.js +0 -12
- package/dist/shared/utility/permissions.utility.js.map +0 -1
package/dist/index-DbWA_10I.d.ts
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
import { PermissionLevel } from './shared/typings/permissions.js';
|
|
2
|
-
import { BaseRegistry } from './shared/typings/registry.js';
|
|
3
|
-
import { TriviousClientOptions } from './shared/typings/client.js';
|
|
4
|
-
import { AnySelectMenuInteraction, CacheType, ButtonInteraction as ButtonInteraction$1, ModalSubmitInteraction as ModalSubmitInteraction$1, SlashCommandBuilder, SlashCommandOptionsOnlyBuilder, Collection, SlashCommandSubcommandBuilder, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, ClientEvents, Client, Interaction, MessagePayload, InteractionEditReplyOptions, InteractionReplyOptions, ChatInputCommandInteraction as ChatInputCommandInteraction$1, GuildMember, StringSelectMenuInteraction as StringSelectMenuInteraction$1, ContextMenuCommandInteraction as ContextMenuCommandInteraction$1 } from 'discord.js';
|
|
5
|
-
import './core/builders/util.builders.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Base component interface.
|
|
9
|
-
*
|
|
10
|
-
* @export
|
|
11
|
-
* @interface Component
|
|
12
|
-
* @typedef {Component}
|
|
13
|
-
*/
|
|
14
|
-
interface Component {
|
|
15
|
-
component: ComponentType;
|
|
16
|
-
permission: PermissionLevel;
|
|
17
|
-
/**
|
|
18
|
-
* The full constructed customId.
|
|
19
|
-
*
|
|
20
|
-
* @type {?string}
|
|
21
|
-
*/
|
|
22
|
-
customId?: string;
|
|
23
|
-
/**
|
|
24
|
-
* The 'data' part of a constructed customId.
|
|
25
|
-
*
|
|
26
|
-
* @type {?string}
|
|
27
|
-
*/
|
|
28
|
-
customIdData?: string;
|
|
29
|
-
ephemeralReply?: boolean;
|
|
30
|
-
execute: (client: TriviousClient, interaction: ComponentInteraction) => Promise<void> | void;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Tags for component customIds.
|
|
34
|
-
*
|
|
35
|
-
* @export
|
|
36
|
-
* @typedef {ComponentCustomIdTag}
|
|
37
|
-
*/
|
|
38
|
-
type ComponentCustomIdTag = "awaited";
|
|
39
|
-
/**
|
|
40
|
-
* Interaction types for components.
|
|
41
|
-
*
|
|
42
|
-
* @export
|
|
43
|
-
* @typedef {ComponentInteraction}
|
|
44
|
-
*/
|
|
45
|
-
type ComponentInteraction = AnySelectMenuInteraction<CacheType> | ButtonInteraction$1<CacheType> | ModalSubmitInteraction$1<CacheType>;
|
|
46
|
-
/**
|
|
47
|
-
* What type of component is the componenty.
|
|
48
|
-
*
|
|
49
|
-
* @export
|
|
50
|
-
* @enum {number}
|
|
51
|
-
*/
|
|
52
|
-
declare enum ComponentType {
|
|
53
|
-
Button = "button",
|
|
54
|
-
SelectMenu = "select",
|
|
55
|
-
Modal = "modal"
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Component customId construct options.
|
|
59
|
-
*
|
|
60
|
-
* @export
|
|
61
|
-
* @typedef {CustomIdConstructOptions}
|
|
62
|
-
*/
|
|
63
|
-
type CustomIdConstructOptions = {
|
|
64
|
-
compType: ComponentType;
|
|
65
|
-
data: string;
|
|
66
|
-
tags?: ComponentCustomIdTag[];
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Base command interface.
|
|
71
|
-
*
|
|
72
|
-
* @export
|
|
73
|
-
* @interface Command
|
|
74
|
-
* @typedef {Command}
|
|
75
|
-
*/
|
|
76
|
-
interface Command {
|
|
77
|
-
readonly context: CommandContext;
|
|
78
|
-
readonly active: boolean;
|
|
79
|
-
readonly flags?: CommandFlags[];
|
|
80
|
-
readonly permission?: PermissionLevel;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Slash command interface.
|
|
84
|
-
*
|
|
85
|
-
* @export
|
|
86
|
-
* @interface SlashCommand
|
|
87
|
-
* @typedef {SlashCommand}
|
|
88
|
-
* @extends {Command}
|
|
89
|
-
*/
|
|
90
|
-
interface SlashCommand extends Command {
|
|
91
|
-
readonly context: "SlashCommand";
|
|
92
|
-
readonly data: SlashCommandBuilder | SlashCommandOptionsOnlyBuilder;
|
|
93
|
-
subcommands?: Collection<string, Command>;
|
|
94
|
-
readonly run?: (client: TriviousClient, interaction: ChatInputCommandInteraction) => Promise<void>;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Slash command subcommand interface.
|
|
98
|
-
*
|
|
99
|
-
* @export
|
|
100
|
-
* @interface SlashSubcommand
|
|
101
|
-
* @typedef {SlashSubcommand}
|
|
102
|
-
* @extends {Command}
|
|
103
|
-
*/
|
|
104
|
-
interface SlashSubcommand extends Command {
|
|
105
|
-
readonly context: "SlashSubcommand";
|
|
106
|
-
readonly data: SlashCommandSubcommandBuilder;
|
|
107
|
-
readonly execute: (client: TriviousClient, interaction: ChatInputCommandInteraction) => Promise<void>;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Context menu command interface.
|
|
111
|
-
*
|
|
112
|
-
* @export
|
|
113
|
-
* @interface ContextMenuCommand
|
|
114
|
-
* @typedef {ContextMenuCommand}
|
|
115
|
-
* @extends {Command}
|
|
116
|
-
*/
|
|
117
|
-
interface ContextMenuCommand extends Command {
|
|
118
|
-
readonly context: "ContextMenu";
|
|
119
|
-
readonly data: ContextMenuCommandBuilder;
|
|
120
|
-
readonly execute: (client: TriviousClient, interaction: MessageContextMenuCommandInteraction<CacheType> | UserContextMenuCommandInteraction<CacheType>) => Promise<void>;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Literal type for possible CommandInteractions.
|
|
124
|
-
*
|
|
125
|
-
* @export
|
|
126
|
-
* @typedef {CommandInteraction}
|
|
127
|
-
*/
|
|
128
|
-
type CommandInteraction = ChatInputCommandInteraction | ContextMenuCommandInteraction;
|
|
129
|
-
/**
|
|
130
|
-
* Flags attached to a command.
|
|
131
|
-
*
|
|
132
|
-
* @export
|
|
133
|
-
* @typedef {CommandFlags}
|
|
134
|
-
*/
|
|
135
|
-
type CommandFlags = "GuildOnly" | "OwnerOnly" | "EphemeralReply" | "DeferReply" | "ModalResponse";
|
|
136
|
-
/**
|
|
137
|
-
* What type of command.
|
|
138
|
-
*
|
|
139
|
-
* @export
|
|
140
|
-
* @typedef {CommandContext}
|
|
141
|
-
*/
|
|
142
|
-
type CommandContext = "SlashCommand" | "SlashSubcommand" | "ContextMenu";
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Base Event.
|
|
146
|
-
*
|
|
147
|
-
* @export
|
|
148
|
-
* @interface Event
|
|
149
|
-
* @typedef {Event}
|
|
150
|
-
* @template {keyof ClientEvents} [K=keyof ClientEvents]
|
|
151
|
-
*/
|
|
152
|
-
interface Event<K extends keyof ClientEvents = keyof ClientEvents> {
|
|
153
|
-
/**
|
|
154
|
-
* Name of the ClientEvent.
|
|
155
|
-
*
|
|
156
|
-
* @type {K}
|
|
157
|
-
*/
|
|
158
|
-
name: K;
|
|
159
|
-
/**
|
|
160
|
-
* Whether the event is once.
|
|
161
|
-
*
|
|
162
|
-
* @type {?boolean}
|
|
163
|
-
*/
|
|
164
|
-
once?: boolean;
|
|
165
|
-
/**
|
|
166
|
-
* Execute the event.
|
|
167
|
-
*
|
|
168
|
-
* @type {(client: TriviousClient, ...args: ClientEvents[K]) => Promise<void> | void}
|
|
169
|
-
*/
|
|
170
|
-
execute: (client: TriviousClient, ...args: ClientEvents[K]) => Promise<void> | void;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Base Module.
|
|
175
|
-
*
|
|
176
|
-
* @export
|
|
177
|
-
* @interface Module
|
|
178
|
-
* @typedef {Module}
|
|
179
|
-
*/
|
|
180
|
-
interface Module {
|
|
181
|
-
/**
|
|
182
|
-
* The name of the Module.
|
|
183
|
-
*
|
|
184
|
-
* @type {string}
|
|
185
|
-
*/
|
|
186
|
-
name: string;
|
|
187
|
-
/**
|
|
188
|
-
* The events the module is listening for.
|
|
189
|
-
*
|
|
190
|
-
* @type {{
|
|
191
|
-
* [K in keyof ClientEvents]?: (
|
|
192
|
-
* client: TriviousClient,
|
|
193
|
-
* ...args: ClientEvents[K]
|
|
194
|
-
* ) => Promise<void> | void;
|
|
195
|
-
* }}
|
|
196
|
-
*/
|
|
197
|
-
events?: {
|
|
198
|
-
[K in keyof ClientEvents]?: (client: TriviousClient, ...args: ClientEvents[K]) => Promise<void> | void;
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Registry to load, get and bind modules.
|
|
204
|
-
*
|
|
205
|
-
* @export
|
|
206
|
-
* @class ModuleRegistry
|
|
207
|
-
* @typedef {ModuleRegistry}
|
|
208
|
-
* @extends {BaseRegistry<Module>}
|
|
209
|
-
*/
|
|
210
|
-
declare class ModuleRegistry extends BaseRegistry<Module> {
|
|
211
|
-
protected items: Collection<string, Module>;
|
|
212
|
-
/**
|
|
213
|
-
* Load all modules.
|
|
214
|
-
*
|
|
215
|
-
* @async
|
|
216
|
-
* @param {string} [directory=getCorePath({ coreDirectory: "module" })]
|
|
217
|
-
* @returns {Promise<this>}
|
|
218
|
-
*/
|
|
219
|
-
load(directory?: string): Promise<this>;
|
|
220
|
-
/**
|
|
221
|
-
* Bind all loaded modules to their client event respectively.
|
|
222
|
-
*
|
|
223
|
-
* @param {TriviousClient} client
|
|
224
|
-
*/
|
|
225
|
-
bind(client: TriviousClient): void;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Registry to load, get and bind events.
|
|
230
|
-
*
|
|
231
|
-
* @export
|
|
232
|
-
* @class EventRegistry
|
|
233
|
-
* @typedef {EventRegistry}
|
|
234
|
-
* @extends {BaseRegistry<Event>}
|
|
235
|
-
*/
|
|
236
|
-
declare class EventRegistry extends BaseRegistry<Event> {
|
|
237
|
-
protected items: Collection<string, Event<keyof ClientEvents>>;
|
|
238
|
-
/**
|
|
239
|
-
* Load all preset events, can be overridden by user-provided events.
|
|
240
|
-
*
|
|
241
|
-
* @async
|
|
242
|
-
* @protected
|
|
243
|
-
* @returns {Promise<this>}
|
|
244
|
-
*/
|
|
245
|
-
protected loadPresetEvents(): Promise<this | undefined>;
|
|
246
|
-
/**
|
|
247
|
-
* Load all events.
|
|
248
|
-
*
|
|
249
|
-
* @async
|
|
250
|
-
* @param {string} [directory=getCorePath({ coreDirectory: "events" })]
|
|
251
|
-
* @returns {Promise<this>}
|
|
252
|
-
*/
|
|
253
|
-
load(directory?: string): Promise<this>;
|
|
254
|
-
/**
|
|
255
|
-
* Bind loaded events to their client events respectively.
|
|
256
|
-
*
|
|
257
|
-
* @param {TriviousClient} client
|
|
258
|
-
*/
|
|
259
|
-
bind(client: TriviousClient): void;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Registry to load and get all components.
|
|
264
|
-
*
|
|
265
|
-
* @export
|
|
266
|
-
* @class ComponentRegistry
|
|
267
|
-
* @typedef {ComponentRegistry}
|
|
268
|
-
* @extends {BaseRegistry<Component>}
|
|
269
|
-
*/
|
|
270
|
-
declare class ComponentRegistry extends BaseRegistry<Component> {
|
|
271
|
-
protected items: Collection<string, Component>;
|
|
272
|
-
/**
|
|
273
|
-
* Load all components.
|
|
274
|
-
*
|
|
275
|
-
* @async
|
|
276
|
-
* @param {string} [directory=getCorePath({ coreDirectory: "components" })]
|
|
277
|
-
* @returns {Promise<this>}
|
|
278
|
-
*/
|
|
279
|
-
load(directory?: string): Promise<this>;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Registry to load and get all commands.
|
|
284
|
-
*
|
|
285
|
-
* @export
|
|
286
|
-
* @class CommandRegistry
|
|
287
|
-
* @typedef {CommandRegistry}
|
|
288
|
-
* @extends {BaseRegistry<AnyCommand>}
|
|
289
|
-
*/
|
|
290
|
-
declare class CommandRegistry extends BaseRegistry<Command> {
|
|
291
|
-
protected items: Collection<string, Command>;
|
|
292
|
-
/**
|
|
293
|
-
* Load all commands and their subcommands
|
|
294
|
-
*
|
|
295
|
-
* @async
|
|
296
|
-
* @param {string} [directory=getCorePath({ coreDirectory: "commands" })]
|
|
297
|
-
* @returns {unknown}
|
|
298
|
-
*/
|
|
299
|
-
load(directory?: string): Promise<this>;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Trivious base client.
|
|
304
|
-
*
|
|
305
|
-
* @export
|
|
306
|
-
* @class TriviousClient
|
|
307
|
-
* @typedef {TriviousClient}
|
|
308
|
-
* @extends {Client}
|
|
309
|
-
*/
|
|
310
|
-
declare class TriviousClient extends Client {
|
|
311
|
-
/**
|
|
312
|
-
* Client registries.
|
|
313
|
-
*
|
|
314
|
-
* @public
|
|
315
|
-
* @readonly
|
|
316
|
-
* @type {*}
|
|
317
|
-
*/
|
|
318
|
-
readonly registries: {
|
|
319
|
-
commands: CommandRegistry;
|
|
320
|
-
components: ComponentRegistry;
|
|
321
|
-
events: EventRegistry;
|
|
322
|
-
modules: ModuleRegistry;
|
|
323
|
-
loadAll(options: TriviousClientOptions): Promise<void>;
|
|
324
|
-
bind(client: TriviousClient): void;
|
|
325
|
-
};
|
|
326
|
-
/**
|
|
327
|
-
* Client copy of the constructor options.
|
|
328
|
-
*
|
|
329
|
-
* @private
|
|
330
|
-
* @type {TriviousClientOptions}
|
|
331
|
-
*/
|
|
332
|
-
readonly _options: TriviousClientOptions;
|
|
333
|
-
/**
|
|
334
|
-
* Creates an instance of TriviousClient.
|
|
335
|
-
*
|
|
336
|
-
* @constructor
|
|
337
|
-
* @param {TriviousClientOptions} options
|
|
338
|
-
*/
|
|
339
|
-
constructor(options: TriviousClientOptions);
|
|
340
|
-
/**
|
|
341
|
-
* Load all registries.
|
|
342
|
-
*
|
|
343
|
-
* @async
|
|
344
|
-
* @returns {*}
|
|
345
|
-
*/
|
|
346
|
-
register(): Promise<void>;
|
|
347
|
-
/**
|
|
348
|
-
* Login and start the bot.
|
|
349
|
-
*
|
|
350
|
-
* @async
|
|
351
|
-
* @returns {*}
|
|
352
|
-
*/
|
|
353
|
-
start(): Promise<void>;
|
|
354
|
-
/**
|
|
355
|
-
* Deploy all commands.
|
|
356
|
-
*
|
|
357
|
-
* @async
|
|
358
|
-
* @returns {*}
|
|
359
|
-
*/
|
|
360
|
-
deploy(): Promise<void>;
|
|
361
|
-
/**
|
|
362
|
-
* Set the roles tied to a permission level.
|
|
363
|
-
*
|
|
364
|
-
* @param {Record<string, PermissionLevel>} roles
|
|
365
|
-
*/
|
|
366
|
-
setRolePermissions(roles: Record<string, PermissionLevel>): void;
|
|
367
|
-
get rolePermissions(): Record<string, PermissionLevel>;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Reply to a command, respecting whether it has been deferred or already replied to.
|
|
372
|
-
*
|
|
373
|
-
* @export
|
|
374
|
-
* @async
|
|
375
|
-
* @param {Command} command
|
|
376
|
-
* @param {ChatInputCommandInteraction | ContextMenuCommandInteraction} interaction
|
|
377
|
-
* @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options
|
|
378
|
-
* @returns {*}
|
|
379
|
-
*/
|
|
380
|
-
declare function interactionReply(data: {
|
|
381
|
-
flags?: ("ClearAll" | "FollowUp" | CommandFlags)[];
|
|
382
|
-
interaction: Interaction<CacheType>;
|
|
383
|
-
options: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions;
|
|
384
|
-
}): Promise<void>;
|
|
385
|
-
/**
|
|
386
|
-
* Compare a permission level to the guild member's permission level.
|
|
387
|
-
*
|
|
388
|
-
* @export
|
|
389
|
-
* @async
|
|
390
|
-
* @param {TriviousClient} client
|
|
391
|
-
* @param {ChatInputCommandInteraction | ContextMenuCommandInteraction} interaction
|
|
392
|
-
* @param {Command} command
|
|
393
|
-
* @param {PermissionLevel} requiredPermission
|
|
394
|
-
* @param {boolean} [doReply=true]
|
|
395
|
-
* @returns {unknown}
|
|
396
|
-
*/
|
|
397
|
-
declare function verifyGuildPermission(client: TriviousClient, interaction: Interaction<CacheType>, command: Command, requiredPermission: PermissionLevel, doReply?: boolean): Promise<boolean>;
|
|
398
|
-
/**
|
|
399
|
-
* Handle execution of a slash command.
|
|
400
|
-
*
|
|
401
|
-
* @export
|
|
402
|
-
* @async
|
|
403
|
-
* @param {TriviousClient} client
|
|
404
|
-
* @param {(SlashCommand | SlashSubcommand)} command
|
|
405
|
-
* @param {ChatInputCommandInteraction} interaction
|
|
406
|
-
* @returns {*}
|
|
407
|
-
*/
|
|
408
|
-
declare function handleSlashCommand(client: TriviousClient, command: SlashCommand, interaction: ChatInputCommandInteraction$1): Promise<void>;
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Deconstruct a component customId into its parts.
|
|
412
|
-
*
|
|
413
|
-
* @param {string} customId
|
|
414
|
-
* @returns {CustomIdConstructOptions}
|
|
415
|
-
*/
|
|
416
|
-
declare const deconstructCustomId: (customId: string) => CustomIdConstructOptions;
|
|
417
|
-
/**
|
|
418
|
-
* Construct a component customId.
|
|
419
|
-
*
|
|
420
|
-
* @param {CustomIdConstructOptions} options
|
|
421
|
-
* @returns {string}
|
|
422
|
-
*/
|
|
423
|
-
declare const constructCustomId: (options: CustomIdConstructOptions) => string;
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Get the permission level of a user.
|
|
427
|
-
*
|
|
428
|
-
* @param {GuildMember} member
|
|
429
|
-
* @returns {*}
|
|
430
|
-
*/
|
|
431
|
-
declare const getPermissionLevel: (client: TriviousClient, member: GuildMember) => PermissionLevel;
|
|
432
|
-
|
|
433
|
-
type ChatInputCommandInteraction = ChatInputCommandInteraction$1<CacheType>;
|
|
434
|
-
type ButtonInteraction = ButtonInteraction$1<CacheType>;
|
|
435
|
-
type StringSelectMenuInteraction = StringSelectMenuInteraction$1<CacheType>;
|
|
436
|
-
type ModalSubmitInteraction = ModalSubmitInteraction$1<CacheType>;
|
|
437
|
-
type ContextMenuCommandInteraction = ContextMenuCommandInteraction$1<CacheType>;
|
|
438
|
-
|
|
439
|
-
export { type ButtonInteraction as B, CommandRegistry as C, EventRegistry as E, ModuleRegistry as M, type SlashCommand as S, TriviousClient as T, ComponentRegistry as a, type Component as b, type ComponentCustomIdTag as c, type ComponentInteraction as d, ComponentType as e, type CustomIdConstructOptions as f, type Command as g, type SlashSubcommand as h, type ContextMenuCommand as i, type CommandInteraction as j, type CommandFlags as k, type CommandContext as l, type Event as m, type Module as n, interactionReply as o, handleSlashCommand as p, deconstructCustomId as q, constructCustomId as r, getPermissionLevel as s, type ChatInputCommandInteraction as t, type StringSelectMenuInteraction as u, verifyGuildPermission as v, type ModalSubmitInteraction as w, type ContextMenuCommandInteraction as x };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ClientOptions } from 'discord.js';
|
|
2
|
-
import { PermissionLevel } from './permissions.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Client options for the TriviousClient
|
|
6
|
-
*
|
|
7
|
-
* @export
|
|
8
|
-
* @interface TriviousClientOptions
|
|
9
|
-
* @typedef {TriviousClientOptions}
|
|
10
|
-
* @extends {ClientOptions}
|
|
11
|
-
*/
|
|
12
|
-
interface TriviousClientOptions extends ClientOptions {
|
|
13
|
-
/**
|
|
14
|
-
* Environment variable for the bot token.
|
|
15
|
-
*
|
|
16
|
-
* @type {string}
|
|
17
|
-
*/
|
|
18
|
-
tokenReference: string;
|
|
19
|
-
/**
|
|
20
|
-
* Environment variable for the client id.
|
|
21
|
-
*
|
|
22
|
-
* @type {string}
|
|
23
|
-
*/
|
|
24
|
-
clientIdReference: string;
|
|
25
|
-
/**
|
|
26
|
-
* Set core paths for where the registries should look.
|
|
27
|
-
*
|
|
28
|
-
* @type {?{
|
|
29
|
-
* commandsPath?: string;
|
|
30
|
-
* componentsPath?: string;
|
|
31
|
-
* eventsPath?: string;
|
|
32
|
-
* modulesPath?: string;
|
|
33
|
-
* }}
|
|
34
|
-
*/
|
|
35
|
-
corePaths?: {
|
|
36
|
-
commandsPath?: string;
|
|
37
|
-
componentsPath?: string;
|
|
38
|
-
eventsPath?: string;
|
|
39
|
-
modulesPath?: string;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Set base core path, only use if you aren't defining corePaths. This is intended for the case where all your registry folders are in the same directory.
|
|
43
|
-
*
|
|
44
|
-
* @type {?string}
|
|
45
|
-
*/
|
|
46
|
-
corePath?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Roles tied to a PermissionLevel.
|
|
49
|
-
*
|
|
50
|
-
* @type {Record<string, PermissionLevel>}
|
|
51
|
-
*/
|
|
52
|
-
rolePermissions?: Record<string, PermissionLevel>;
|
|
53
|
-
/**
|
|
54
|
-
* Discord user Ids of the bot owner(s)
|
|
55
|
-
*
|
|
56
|
-
* @type {string[]}
|
|
57
|
-
*/
|
|
58
|
-
botOwnerIds?: string[];
|
|
59
|
-
/**
|
|
60
|
-
* Configuration for auto-command deployment based on hashes
|
|
61
|
-
* i.e. commands are only deployed if changes to the builders are detected.
|
|
62
|
-
*
|
|
63
|
-
* @type {{
|
|
64
|
-
* enabled: boolean;
|
|
65
|
-
* filePath: string;
|
|
66
|
-
* }}
|
|
67
|
-
*/
|
|
68
|
-
commandHashConfig?: {
|
|
69
|
-
enabled: boolean;
|
|
70
|
-
filePath: string;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export type { TriviousClientOptions };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import './permissions.js';
|
|
2
|
-
import 'discord.js';
|
|
3
|
-
export { g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, i as ContextMenuCommand, S as SlashCommand, h as SlashSubcommand } from '../../index-DbWA_10I.js';
|
|
4
|
-
import './registry.js';
|
|
5
|
-
import './client.js';
|
|
6
|
-
import '../../core/builders/util.builders.js';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import 'discord.js';
|
|
2
|
-
import './permissions.js';
|
|
3
|
-
export { b as Component, c as ComponentCustomIdTag, d as ComponentInteraction, e as ComponentType, f as CustomIdConstructOptions } from '../../index-DbWA_10I.js';
|
|
4
|
-
import './registry.js';
|
|
5
|
-
import './client.js';
|
|
6
|
-
import '../../core/builders/util.builders.js';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var ComponentType = /* @__PURE__ */ ((ComponentType2) => {
|
|
2
|
-
ComponentType2["Button"] = "button";
|
|
3
|
-
ComponentType2["SelectMenu"] = "select";
|
|
4
|
-
ComponentType2["Modal"] = "modal";
|
|
5
|
-
return ComponentType2;
|
|
6
|
-
})(ComponentType || {});
|
|
7
|
-
|
|
8
|
-
export { ComponentType };
|
|
9
|
-
//# sourceMappingURL=components.js.map
|
|
10
|
-
//# sourceMappingURL=components.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/typings/components.ts"],"names":["ComponentType"],"mappings":"AA0DO,IAAK,aAAA,qBAAAA,cAAAA,KAAL;AACN,EAAAA,eAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,eAAA,YAAA,CAAA,GAAa,QAAA;AACb,EAAAA,eAAA,OAAA,CAAA,GAAQ,OAAA;AAHG,EAAA,OAAAA,cAAAA;AAAA,CAAA,EAAA,aAAA,IAAA,EAAA","file":"components.js","sourcesContent":["import {\n\tAnySelectMenuInteraction,\n\tButtonInteraction,\n\tCacheType,\n\tModalSubmitInteraction,\n} from \"discord.js\";\nimport { PermissionLevel } from \"./permissions.js\";\nimport TriviousClient from \"src/core/client/trivious.client.js\";\n\n/**\n * Base component interface.\n *\n * @export\n * @interface Component\n * @typedef {Component}\n */\nexport interface Component {\n\tcomponent: ComponentType;\n\tpermission: PermissionLevel;\n\t/**\n\t * The full constructed customId.\n\t *\n\t * @type {?string}\n\t */\n\tcustomId?: string;\n\t/**\n\t * The 'data' part of a constructed customId.\n\t *\n\t * @type {?string}\n\t */\n\tcustomIdData?: string;\n\tephemeralReply?: boolean;\n\texecute: (client: TriviousClient, interaction: ComponentInteraction) => Promise<void> | void;\n}\n\n/**\n * Tags for component customIds.\n *\n * @export\n * @typedef {ComponentCustomIdTag}\n */\nexport type ComponentCustomIdTag = \"awaited\";\n/**\n * Interaction types for components.\n *\n * @export\n * @typedef {ComponentInteraction}\n */\nexport type ComponentInteraction =\n\t| AnySelectMenuInteraction<CacheType>\n\t| ButtonInteraction<CacheType>\n\t| ModalSubmitInteraction<CacheType>;\n/**\n * What type of component is the componenty.\n *\n * @export\n * @enum {number}\n */\nexport enum ComponentType {\n\tButton = \"button\",\n\tSelectMenu = \"select\",\n\tModal = \"modal\",\n}\n\n/**\n * Component customId construct options.\n *\n * @export\n * @typedef {CustomIdConstructOptions}\n */\nexport type CustomIdConstructOptions = {\n\tcompType: ComponentType;\n\tdata: string;\n\ttags?: ComponentCustomIdTag[];\n};\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { PermissionLevel } from './permissions.js';
|
|
2
|
-
export { BaseRegistry } from './registry.js';
|
|
3
|
-
export { g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, b as Component, c as ComponentCustomIdTag, d as ComponentInteraction, e as ComponentType, i as ContextMenuCommand, f as CustomIdConstructOptions, m as Event, n as Module, S as SlashCommand, h as SlashSubcommand } from '../../index-DbWA_10I.js';
|
|
4
|
-
export { TriviousClientOptions } from './client.js';
|
|
5
|
-
import 'discord.js';
|
|
6
|
-
import '../../core/builders/util.builders.js';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './permissions.js';
|
|
2
|
-
export * from './registry.js';
|
|
3
|
-
export * from './components.js';
|
|
4
|
-
export * from './commands.js';
|
|
5
|
-
export * from './client.js';
|
|
6
|
-
export * from './events.js';
|
|
7
|
-
export * from './module.js';
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User permission level enums
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
* @enum {number}
|
|
6
|
-
*/
|
|
7
|
-
declare enum PermissionLevel {
|
|
8
|
-
USER = 0,
|
|
9
|
-
GUILD_STAFF = 1,
|
|
10
|
-
GUILD_MODERATOR = 2,
|
|
11
|
-
GUILD_ADMINISTRATOR = 3,
|
|
12
|
-
GUILD_OWNER = 4,
|
|
13
|
-
BOT_OWNER = 5
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { PermissionLevel };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var PermissionLevel = /* @__PURE__ */ ((PermissionLevel2) => {
|
|
2
|
-
PermissionLevel2[PermissionLevel2["USER"] = 0] = "USER";
|
|
3
|
-
PermissionLevel2[PermissionLevel2["GUILD_STAFF"] = 1] = "GUILD_STAFF";
|
|
4
|
-
PermissionLevel2[PermissionLevel2["GUILD_MODERATOR"] = 2] = "GUILD_MODERATOR";
|
|
5
|
-
PermissionLevel2[PermissionLevel2["GUILD_ADMINISTRATOR"] = 3] = "GUILD_ADMINISTRATOR";
|
|
6
|
-
PermissionLevel2[PermissionLevel2["GUILD_OWNER"] = 4] = "GUILD_OWNER";
|
|
7
|
-
PermissionLevel2[PermissionLevel2["BOT_OWNER"] = 5] = "BOT_OWNER";
|
|
8
|
-
return PermissionLevel2;
|
|
9
|
-
})(PermissionLevel || {});
|
|
10
|
-
|
|
11
|
-
export { PermissionLevel };
|
|
12
|
-
//# sourceMappingURL=permissions.js.map
|
|
13
|
-
//# sourceMappingURL=permissions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/typings/permissions.ts"],"names":["PermissionLevel"],"mappings":"AAMO,IAAK,eAAA,qBAAAA,gBAAAA,KAAL;AACN,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,UAAO,CAAA,CAAA,GAAP,MAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,iBAAc,CAAA,CAAA,GAAd,aAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,qBAAkB,CAAA,CAAA,GAAlB,iBAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,yBAAsB,CAAA,CAAA,GAAtB,qBAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,iBAAc,CAAA,CAAA,GAAd,aAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,eAAY,CAAA,CAAA,GAAZ,WAAA;AANW,EAAA,OAAAA,gBAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA","file":"permissions.js","sourcesContent":["/**\n * User permission level enums\n *\n * @export\n * @enum {number}\n */\nexport enum PermissionLevel {\n\tUSER = 0,\n\tGUILD_STAFF = 1,\n\tGUILD_MODERATOR = 2,\n\tGUILD_ADMINISTRATOR = 3,\n\tGUILD_OWNER = 4,\n\tBOT_OWNER = 5,\n}\n"]}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Collection } from 'discord.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Base registry for loading, getting and binding core events and functions.
|
|
5
|
-
*
|
|
6
|
-
* @export
|
|
7
|
-
* @abstract
|
|
8
|
-
* @class BaseRegistry
|
|
9
|
-
* @typedef {BaseRegistry}
|
|
10
|
-
* @template T
|
|
11
|
-
*/
|
|
12
|
-
declare abstract class BaseRegistry<T> {
|
|
13
|
-
protected abstract items: Collection<string, T>;
|
|
14
|
-
/**
|
|
15
|
-
* Load all of T
|
|
16
|
-
*
|
|
17
|
-
* @protected
|
|
18
|
-
* @abstract
|
|
19
|
-
* @param {string} directory
|
|
20
|
-
* @returns {Promise<this>}
|
|
21
|
-
*/
|
|
22
|
-
protected abstract load(directory: string): Promise<this>;
|
|
23
|
-
/**
|
|
24
|
-
* Get all of loaded T
|
|
25
|
-
*
|
|
26
|
-
* @returns {Collection<string, T>}
|
|
27
|
-
*/
|
|
28
|
-
get(): Collection<string, T>;
|
|
29
|
-
/**
|
|
30
|
-
* Import a file from a path to be loaded.
|
|
31
|
-
*
|
|
32
|
-
* @protected
|
|
33
|
-
* @async
|
|
34
|
-
* @template T
|
|
35
|
-
* @param {string} filePath
|
|
36
|
-
* @returns {Promise<T | null>}
|
|
37
|
-
*/
|
|
38
|
-
protected importFile<T>(filePath: string): Promise<T | null>;
|
|
39
|
-
/**
|
|
40
|
-
* Clear file path cache.
|
|
41
|
-
* Does not run in production environment.
|
|
42
|
-
*
|
|
43
|
-
* @protected
|
|
44
|
-
* @async
|
|
45
|
-
* @param {string} filePath
|
|
46
|
-
* @returns {*}
|
|
47
|
-
*/
|
|
48
|
-
protected clearCache(filePath: string): Promise<void>;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { BaseRegistry };
|