gralonium 0.2.0 → 0.3.0
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/lib/classes/Client.d.ts +6 -10
- package/lib/classes/Client.js +9 -12
- package/lib/classes/Context.d.ts +3 -3
- package/lib/classes/Context.js +1 -1
- package/lib/classes/Cooldowns.d.ts +3 -3
- package/lib/classes/Cooldowns.js +3 -8
- package/lib/classes/Loader.d.ts +15 -11
- package/lib/classes/Loader.js +1 -3
- package/lib/classes/Utils.d.ts +4 -5
- package/lib/classes/Utils.js +2 -10
- package/lib/classes/builders/ComponentsV2Builder.js +0 -2
- package/lib/classes/experiments/Confirmator.d.ts +3 -26
- package/lib/classes/experiments/Paginator.d.ts +3 -29
- package/lib/main.d.ts +0 -3
- package/lib/main.js +2 -5
- package/package.json +4 -15
- package/lib/events/interactionCreate.d.ts +0 -4
- package/lib/events/interactionCreate.js +0 -17
- package/lib/events/messageCreate.d.ts +0 -4
- package/lib/events/messageCreate.js +0 -17
- package/lib/events/messageUpdate.d.ts +0 -4
- package/lib/events/messageUpdate.js +0 -17
package/lib/classes/Client.d.ts
CHANGED
|
@@ -4,14 +4,14 @@ import { Loader, Plugin } from "./Loader.js";
|
|
|
4
4
|
import { HelpCommand } from "./HelpCommand.js";
|
|
5
5
|
import { Cooldowns } from "./Cooldowns.js";
|
|
6
6
|
|
|
7
|
-
export interface
|
|
7
|
+
export interface GraloniumRestrictions {
|
|
8
8
|
userIDs: Set<Snowflake>;
|
|
9
9
|
guildIDs: Set<Snowflake>;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
type MaybePromise<T> = T | Promise<T>;
|
|
13
13
|
|
|
14
|
-
export interface
|
|
14
|
+
export interface GraloniumOptions extends ClientOptions {
|
|
15
15
|
autoSync?: boolean;
|
|
16
16
|
context?: typeof Context;
|
|
17
17
|
guildOnly?: boolean;
|
|
@@ -19,17 +19,17 @@ export interface EnireOptions extends ClientOptions {
|
|
|
19
19
|
prefix: string | string[] | ((ctx: Context) => MaybePromise<string | string[]>);
|
|
20
20
|
replyOnEdit?: boolean;
|
|
21
21
|
helpCommand?: typeof HelpCommand;
|
|
22
|
-
restrictions?:
|
|
22
|
+
restrictions?: GraloniumRestrictions;
|
|
23
23
|
debug?: boolean;
|
|
24
24
|
bindProcessHandlers?: boolean;
|
|
25
25
|
retryOnRateLimit?: boolean;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export declare class
|
|
28
|
+
export declare class Gralonium extends Client {
|
|
29
29
|
cooldowns: Cooldowns;
|
|
30
30
|
loader: Loader;
|
|
31
|
-
ops:
|
|
32
|
-
constructor(options:
|
|
31
|
+
ops: GraloniumOptions;
|
|
32
|
+
constructor(options: GraloniumOptions);
|
|
33
33
|
addGlobalPlugins(plugins: Plugin[]): this;
|
|
34
34
|
getContext(data: CommandInteraction | Message): Context;
|
|
35
35
|
load(dir: string, reload?: boolean): Promise<import("./Loader.js").ModuleData<import("./builders/InteractionBuilder.js").InteractionBuilder | import("./builders/CommandBuilder.js").CommandBuilder | import("./builders/EventBuilder.js").EventBuilder | import("./builders/GroupBuilder.js").GroupBuilder, any[]>[]>;
|
|
@@ -38,7 +38,3 @@ export declare class RedBot extends Client {
|
|
|
38
38
|
login(token: string): Promise<string>;
|
|
39
39
|
destroy(): this;
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
export { RedBot as Enire };
|
|
43
|
-
export { RedBot as Erine };
|
|
44
|
-
export { RedBot as Gralonium };
|
package/lib/classes/Client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Gralonium =
|
|
3
|
+
exports.Gralonium = void 0;
|
|
4
4
|
|
|
5
5
|
const discord_js_1 = require("discord.js");
|
|
6
6
|
const Context_js_1 = require("./Context.js");
|
|
@@ -8,7 +8,7 @@ const Loader_js_1 = require("./Loader.js");
|
|
|
8
8
|
const Cooldowns_js_1 = require("./Cooldowns.js");
|
|
9
9
|
const Utils_js_1 = require("./Utils.js");
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class Gralonium extends discord_js_1.Client {
|
|
12
12
|
static #processHandlersBound = false;
|
|
13
13
|
static #boundClients = new Set();
|
|
14
14
|
|
|
@@ -104,10 +104,10 @@ class RedBot extends discord_js_1.Client {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
static #bindProcessHandlers() {
|
|
107
|
-
if (
|
|
107
|
+
if (Gralonium.#processHandlersBound) return;
|
|
108
108
|
|
|
109
109
|
const dispatch = (error) => {
|
|
110
|
-
for (const client of
|
|
110
|
+
for (const client of Gralonium.#boundClients) {
|
|
111
111
|
client.handleFrameworkError(error);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
@@ -115,7 +115,7 @@ class RedBot extends discord_js_1.Client {
|
|
|
115
115
|
process.on("uncaughtException", dispatch);
|
|
116
116
|
process.on("unhandledRejection", dispatch);
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
Gralonium.#processHandlersBound = true;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
#registerHelpCommand() {
|
|
@@ -134,8 +134,8 @@ class RedBot extends discord_js_1.Client {
|
|
|
134
134
|
|
|
135
135
|
async login(token) {
|
|
136
136
|
if (this.ops.bindProcessHandlers !== false) {
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
Gralonium.#bindProcessHandlers();
|
|
138
|
+
Gralonium.#boundClients.add(this);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
this.#bindCoreListeners();
|
|
@@ -151,12 +151,9 @@ class RedBot extends discord_js_1.Client {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
destroy() {
|
|
154
|
-
|
|
154
|
+
Gralonium.#boundClients.delete(this);
|
|
155
155
|
return super.destroy();
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
exports.
|
|
160
|
-
exports.Enire = RedBot;
|
|
161
|
-
exports.Erine = RedBot;
|
|
162
|
-
exports.Gralonium = RedBot;
|
|
159
|
+
exports.Gralonium = Gralonium;
|
package/lib/classes/Context.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Command, Types } from "../classes/Loader.js";
|
|
2
2
|
import * as P from "./builders/ParamsBuilder.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Gralonium } from "./Client.js";
|
|
4
4
|
import * as DJS from "discord.js";
|
|
5
5
|
|
|
6
6
|
export declare class Context {
|
|
7
|
-
bot:
|
|
7
|
+
bot: Gralonium;
|
|
8
8
|
args: string[] | null;
|
|
9
9
|
data: DJS.Message | DJS.CommandInteraction;
|
|
10
10
|
prefix: string;
|
|
@@ -12,7 +12,7 @@ export declare class Context {
|
|
|
12
12
|
command: Command<Types.Normal> | null;
|
|
13
13
|
parent: Command<Types.Group> | null;
|
|
14
14
|
params: P.BaseParam[] | null;
|
|
15
|
-
constructor(bot:
|
|
15
|
+
constructor(bot: Gralonium, data: DJS.Message | DJS.CommandInteraction);
|
|
16
16
|
get message(): DJS.Message | null;
|
|
17
17
|
get interaction(): DJS.CommandInteraction | null;
|
|
18
18
|
get author(): DJS.User;
|
package/lib/classes/Context.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gralonium } from "./Client.js";
|
|
2
2
|
import { Collection } from "discord.js";
|
|
3
3
|
export declare enum Bucket {
|
|
4
4
|
Member = "MEMBER",
|
|
@@ -7,12 +7,12 @@ export declare enum Bucket {
|
|
|
7
7
|
Channel = "CHANNEL"
|
|
8
8
|
}
|
|
9
9
|
export declare class Cooldowns {
|
|
10
|
-
bot:
|
|
10
|
+
bot: Gralonium;
|
|
11
11
|
track: Collection<string, {
|
|
12
12
|
startedAt: number;
|
|
13
13
|
expiresAt: number;
|
|
14
14
|
}>;
|
|
15
|
-
constructor(bot:
|
|
15
|
+
constructor(bot: Gralonium);
|
|
16
16
|
getCooldownSource(command: string, id: string, bucket: Bucket): Promise<number | undefined>;
|
|
17
17
|
setCooldownSource(command: string, id: string, bucket: Bucket, time: number): Promise<void>;
|
|
18
18
|
check(command: string, id: string, cooldown: number, bucket: Bucket): Promise<{
|
package/lib/classes/Cooldowns.js
CHANGED
|
@@ -49,13 +49,8 @@ class Cooldowns {
|
|
|
49
49
|
const tracked = this.track.get(key);
|
|
50
50
|
if (!tracked) return null;
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const elapsed = Date.now() - tracked.startedAt;
|
|
58
|
-
if (elapsed >= cooldown) {
|
|
52
|
+
const now = Date.now();
|
|
53
|
+
if (now >= tracked.expiresAt) {
|
|
59
54
|
this.track.delete(key);
|
|
60
55
|
return null;
|
|
61
56
|
}
|
|
@@ -65,7 +60,7 @@ class Cooldowns {
|
|
|
65
60
|
id,
|
|
66
61
|
time: cooldown,
|
|
67
62
|
bucket,
|
|
68
|
-
left:
|
|
63
|
+
left: tracked.expiresAt - now,
|
|
69
64
|
};
|
|
70
65
|
}
|
|
71
66
|
}
|
package/lib/classes/Loader.d.ts
CHANGED
|
@@ -4,20 +4,20 @@ import { CommandBuilder } from "./builders/CommandBuilder.js";
|
|
|
4
4
|
import { ParamsBuilder } from "./builders/ParamsBuilder.js";
|
|
5
5
|
import { EventBuilder } from "./builders/EventBuilder.js";
|
|
6
6
|
import { GroupBuilder } from "./builders/GroupBuilder.js";
|
|
7
|
-
import { Plugins as
|
|
7
|
+
import { Plugins as GraloniumPlugins } from "../main.js";
|
|
8
8
|
import { Context } from "./Context.js";
|
|
9
|
-
import {
|
|
9
|
+
import { Gralonium } from "./Client.js";
|
|
10
10
|
|
|
11
11
|
export interface ModuleData<T extends unknown = unknown, K extends any[] = any[]> {
|
|
12
12
|
data: CommandBuilder | GroupBuilder | InteractionBuilder | EventBuilder;
|
|
13
|
-
plugins?: T extends CommandBuilder ? (typeof
|
|
13
|
+
plugins?: T extends CommandBuilder ? (typeof GraloniumPlugins[] | Plugin[]) : never;
|
|
14
14
|
params?: T extends CommandBuilder ? ParamsBuilder : never;
|
|
15
15
|
code?: T extends CommandBuilder
|
|
16
16
|
? (ctx: Context) => Promise<void>
|
|
17
17
|
: T extends InteractionBuilder
|
|
18
18
|
? (interaction: any) => Promise<void>
|
|
19
19
|
: T extends EventBuilder
|
|
20
|
-
? (bot:
|
|
20
|
+
? (bot: Gralonium, ...args: K) => Promise<void>
|
|
21
21
|
: undefined;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -44,20 +44,25 @@ export declare enum Types {
|
|
|
44
44
|
|
|
45
45
|
export type Command<K extends keyof CommandStructures = "normal"> = CommandStructures[K];
|
|
46
46
|
|
|
47
|
-
interface
|
|
47
|
+
interface GraloniumCollected {
|
|
48
48
|
normal: Collection<string, Command<"normal">> | null;
|
|
49
49
|
group: Collection<string, Command<"group">> | null;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
interface LoaderOptions {
|
|
53
|
-
client:
|
|
53
|
+
client: Gralonium;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export interface CommandHelpingObject extends Command<Types.Normal> {
|
|
57
57
|
group: Command<Types.Group> | null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
export interface GroupHelpingObject {
|
|
61
|
+
data: GroupBuilder;
|
|
62
|
+
subcommands: CommandHelpingObject[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type InteractionTypes =
|
|
61
66
|
| "autocomplete"
|
|
62
67
|
| "button"
|
|
63
68
|
| "chatInput"
|
|
@@ -72,11 +77,10 @@ type ErineInteractionTypes =
|
|
|
72
77
|
| "anyInteraction";
|
|
73
78
|
|
|
74
79
|
export declare class Loader {
|
|
75
|
-
client:
|
|
76
|
-
commands:
|
|
77
|
-
interactions: Record<
|
|
80
|
+
client: Gralonium;
|
|
81
|
+
commands: GraloniumCollected;
|
|
82
|
+
interactions: Record<InteractionTypes, Collection<string, ModuleData<InteractionBuilder>>>;
|
|
78
83
|
globalPlugins: Plugin[];
|
|
79
|
-
listeners: Collection<string, ModuleData<InteractionBuilder>> | null;
|
|
80
84
|
rest: REST;
|
|
81
85
|
constructor(options: LoaderOptions);
|
|
82
86
|
load(dir: string, reload?: boolean): Promise<ModuleData<InteractionBuilder | CommandBuilder | EventBuilder | GroupBuilder, any[]>[]>;
|
package/lib/classes/Loader.js
CHANGED
|
@@ -29,13 +29,12 @@ class Loader {
|
|
|
29
29
|
commands;
|
|
30
30
|
interactions;
|
|
31
31
|
globalPlugins;
|
|
32
|
-
listeners;
|
|
33
32
|
rest;
|
|
34
33
|
#eventHandlers;
|
|
35
34
|
#loadedSignature;
|
|
36
35
|
|
|
37
36
|
constructor(options) {
|
|
38
|
-
if (!(options?.client instanceof Client_js_1.
|
|
37
|
+
if (!(options?.client instanceof Client_js_1.Gralonium)) {
|
|
39
38
|
throw new SyntaxError("Invalid client provided in options");
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -56,7 +55,6 @@ class Loader {
|
|
|
56
55
|
anyInteraction: new discord_js_1.Collection(),
|
|
57
56
|
};
|
|
58
57
|
this.globalPlugins = [];
|
|
59
|
-
this.listeners = null;
|
|
60
58
|
this.rest = new discord_js_1.REST();
|
|
61
59
|
this.#eventHandlers = new Map();
|
|
62
60
|
this.#loadedSignature = new Set();
|
package/lib/classes/Utils.d.ts
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { Command, Types } from "../classes/Loader.js";
|
|
2
2
|
import * as P from "./builders/ParamsBuilder.js";
|
|
3
3
|
import { Context } from "./Context.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Gralonium } from "./Client.js";
|
|
5
5
|
import * as DJS from "discord.js";
|
|
6
6
|
|
|
7
7
|
export declare class Utils {
|
|
8
|
-
static isType<T, R>(obj: any, func: (obj: R) => boolean): obj is T;
|
|
9
8
|
static noop(n?: null): null;
|
|
10
9
|
static getMember(query: string, options: { guild: DJS.Guild; force: boolean }): Promise<DJS.GuildMember | null>;
|
|
11
10
|
static getChannel<T = DJS.Channel>(query: string, options: { guild: DJS.Guild; force?: boolean }): Promise<T | null>;
|
|
12
11
|
static getRole(query: string, options: { guild: DJS.Guild; force?: boolean }): Promise<DJS.Role | null>;
|
|
13
|
-
static getUser(query: string, bot:
|
|
12
|
+
static getUser(query: string, bot: Gralonium): Promise<DJS.User | null>;
|
|
14
13
|
static transform(input: string, param: P.BaseParam, ctx: Context, seeable?: boolean): Promise<{ break: boolean; value: any }>;
|
|
15
14
|
static executeCommand(
|
|
16
15
|
ctx: Context,
|
|
17
16
|
command: Command<Types.Normal>,
|
|
18
17
|
options: { group?: Command<Types.Group> | null; source: "prefix" | "slash"; args?: string[] | null; interaction?: DJS.ChatInputCommandInteraction | null; prefix?: string }
|
|
19
18
|
): Promise<void>;
|
|
20
|
-
static handleMessage(bot:
|
|
21
|
-
static handleInteraction(bot:
|
|
19
|
+
static handleMessage(bot: Gralonium, message: DJS.Message, isEdit?: boolean): Promise<void>;
|
|
20
|
+
static handleInteraction(bot: Gralonium, interaction: DJS.Interaction): Promise<void>;
|
|
22
21
|
static runPrefixCommand(ctx: Context, command: Command<Types.Normal>, args: string[], group?: Command<Types.Group>): Promise<void>;
|
|
23
22
|
static runInteractionCommand(ctx: Context, int: DJS.ChatInputCommandInteraction): Promise<void>;
|
|
24
23
|
static splitArgs(text: string, special?: boolean, removeNewLines?: boolean): string[];
|
package/lib/classes/Utils.js
CHANGED
|
@@ -9,10 +9,6 @@ const Errors = tslib_1.__importStar(require("./Errors.js"));
|
|
|
9
9
|
const Cooldowns_js_1 = require("./Cooldowns.js");
|
|
10
10
|
|
|
11
11
|
class Utils {
|
|
12
|
-
static isType(obj, func) {
|
|
13
|
-
return func(obj);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
12
|
static noop(n = null) {
|
|
17
13
|
return n;
|
|
18
14
|
}
|
|
@@ -137,19 +133,15 @@ class Utils {
|
|
|
137
133
|
return paramsBuilder.params.map((param) => ({ ...param, value: undefined }));
|
|
138
134
|
}
|
|
139
135
|
|
|
140
|
-
static #normalizeChoiceInput(input) {
|
|
141
|
-
return String(input ?? "").toLowerCase().trim();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
136
|
static async transform(input, param, ctx, seeable = true) {
|
|
145
137
|
if (!input && seeable) {
|
|
146
138
|
return { break: false, value: null };
|
|
147
139
|
}
|
|
148
140
|
|
|
149
141
|
if (param.choices?.length) {
|
|
150
|
-
const normalizedInput = Utils.#
|
|
142
|
+
const normalizedInput = Utils.#toLower(input);
|
|
151
143
|
const selected = param.choices.find(
|
|
152
|
-
(choice) => Utils.#
|
|
144
|
+
(choice) => Utils.#toLower(choice.name) === normalizedInput || String(choice.value) === String(input)
|
|
153
145
|
);
|
|
154
146
|
if (selected) return { break: false, value: selected.value };
|
|
155
147
|
throw new Errors.InvalidParamChoice(ctx, param, param.choices);
|
|
@@ -66,7 +66,6 @@ class ComponentsV2Builder {
|
|
|
66
66
|
constructor() {
|
|
67
67
|
this._container = new discord_js_1.ContainerBuilder();
|
|
68
68
|
this._pendingButtons = [];
|
|
69
|
-
this._spoiler = false;
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
// ─── Internal helpers ────────────────────────────────────────────────────
|
|
@@ -190,7 +189,6 @@ class ComponentsV2Builder {
|
|
|
190
189
|
* Mark the container as a spoiler (blurred until clicked).
|
|
191
190
|
*/
|
|
192
191
|
setSpoiler(spoiler) {
|
|
193
|
-
this._spoiler = spoiler;
|
|
194
192
|
this._container.setSpoiler(spoiler);
|
|
195
193
|
return this;
|
|
196
194
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { User, Message, CollectedInteraction } from "discord.js";
|
|
2
2
|
import { AsyncFunction } from "../Loader.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Gralonium } from "../Client.js";
|
|
4
4
|
export type ConfirmatorOptions = {
|
|
5
5
|
author: User;
|
|
6
6
|
filter?: ConfirmatorProcess;
|
|
@@ -23,36 +23,13 @@ export declare class Confirmator {
|
|
|
23
23
|
filter: ConfirmatorProcess;
|
|
24
24
|
timeout: number;
|
|
25
25
|
message?: Message;
|
|
26
|
-
bot:
|
|
27
|
-
constructor(bot:
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param predicate The function to call when someone clicks the continue button
|
|
31
|
-
*/
|
|
26
|
+
bot: Gralonium;
|
|
27
|
+
constructor(bot: Gralonium, options: ConfirmatorOptions);
|
|
32
28
|
setContinueProcess(predicate: ConfirmatorProcess): this;
|
|
33
|
-
/**
|
|
34
|
-
* @param predicate The function to call when someone clicks the cancel button.
|
|
35
|
-
*/
|
|
36
29
|
setCancelProcess(predicate: ConfirmatorProcess): this;
|
|
37
|
-
/**
|
|
38
|
-
* @param predicate The function to call when the filter process returns false
|
|
39
|
-
*/
|
|
40
30
|
setFilterErrorProcess(predicate: ConfirmatorProcess): this;
|
|
41
|
-
/**
|
|
42
|
-
* @param predicate The function to call and check if is true, if not it will throw an error (setted with .setFilterErrorProcess())
|
|
43
|
-
*/
|
|
44
31
|
setFilterCheckProcess(predicate: ConfirmatorProcess): this;
|
|
45
|
-
/**
|
|
46
|
-
* You have to use this after you send the message with the buttons, this is required.
|
|
47
|
-
* @param message The message that will be used in the process
|
|
48
|
-
*/
|
|
49
32
|
setMessage(message: Message): this;
|
|
50
|
-
/**
|
|
51
|
-
* @param options Optional options to customize your buttons
|
|
52
|
-
*/
|
|
53
33
|
static Buttons(options?: ConfirmatorButtonsOptions): import("discord.js").APIActionRowComponent<import("discord.js").APIStringSelectComponent | import("discord.js").APIChannelSelectComponent | import("discord.js").APIMentionableSelectComponent | import("discord.js").APIUserSelectComponent | import("discord.js").APIRoleSelectComponent | import("discord.js").APIButtonComponent | import("discord.js").APITextInputComponent>;
|
|
54
|
-
/**
|
|
55
|
-
* Start the confirmator, we recommend you to start it after using Confirmator.setMessage()
|
|
56
|
-
*/
|
|
57
34
|
start(): void;
|
|
58
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { User, Message, ButtonStyle, CollectedInteraction } from "discord.js";
|
|
2
2
|
import { AsyncFunction } from "../Loader.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Gralonium } from "../Client.js";
|
|
4
4
|
export type ButtonSchema = {
|
|
5
5
|
style?: ButtonStyle;
|
|
6
6
|
label?: string;
|
|
@@ -19,47 +19,21 @@ export type PaginatorButtonsOptions = {
|
|
|
19
19
|
export declare class Paginator<P = any> {
|
|
20
20
|
pages: P[];
|
|
21
21
|
filter: PaginatorProcess;
|
|
22
|
-
bot:
|
|
22
|
+
bot: Gralonium;
|
|
23
23
|
message?: Message;
|
|
24
24
|
timeout: number;
|
|
25
25
|
private _author;
|
|
26
26
|
private _page;
|
|
27
27
|
private _filter;
|
|
28
28
|
private _update;
|
|
29
|
-
constructor(bot:
|
|
30
|
-
/**
|
|
31
|
-
* Get the page content (provided in the constructor).
|
|
32
|
-
*/
|
|
29
|
+
constructor(bot: Gralonium, options: PaginatorOptions);
|
|
33
30
|
get page(): P;
|
|
34
|
-
/**
|
|
35
|
-
* Get the current page number.
|
|
36
|
-
*/
|
|
37
31
|
get pageNumber(): number;
|
|
38
|
-
/**
|
|
39
|
-
* Get the page footer.
|
|
40
|
-
* @example "3/10"
|
|
41
|
-
*/
|
|
42
32
|
get pagesFooter(): string;
|
|
43
|
-
/**
|
|
44
|
-
* @param predicate The function to call when someone clicks the cancel button.
|
|
45
|
-
*/
|
|
46
33
|
setUpdateProcess(predicate: AsyncFunction<P, any>): this;
|
|
47
|
-
/**
|
|
48
|
-
* @param predicate The function to call when the filter process returns false
|
|
49
|
-
*/
|
|
50
34
|
setFilterProcess(predicate: PaginatorProcess): this;
|
|
51
|
-
/**
|
|
52
|
-
* @param predicate The function to call and check if is true, if not it will throw an error (setted with .setFilterErrorProcess())
|
|
53
|
-
*/
|
|
54
35
|
setFilterCheckProcess(predicate: PaginatorProcess): this;
|
|
55
|
-
/**
|
|
56
|
-
* You have to use this after you send the message with the buttons, this is required.
|
|
57
|
-
* @param message The message that will be used in the process
|
|
58
|
-
*/
|
|
59
36
|
setMessage(message: Message): this;
|
|
60
|
-
/**
|
|
61
|
-
* @param options Optional options to customize your buttons
|
|
62
|
-
*/
|
|
63
37
|
static Buttons(options?: PaginatorButtonsOptions): import("discord.js").APIActionRowComponent<import("discord.js").APIStringSelectComponent | import("discord.js").APIChannelSelectComponent | import("discord.js").APIMentionableSelectComponent | import("discord.js").APIUserSelectComponent | import("discord.js").APIRoleSelectComponent | import("discord.js").APIButtonComponent | import("discord.js").APITextInputComponent>;
|
|
64
38
|
start(): void;
|
|
65
39
|
}
|
package/lib/main.d.ts
CHANGED
|
@@ -12,7 +12,4 @@ export * from "./classes/HelpCommand.js";
|
|
|
12
12
|
export * from "./classes/Cooldowns.js";
|
|
13
13
|
export * as Errors from "./classes/Errors.js";
|
|
14
14
|
export * as Plugins from "./classes/Plugins.js";
|
|
15
|
-
export * as ErineUtils from "./classes/Utils.js";
|
|
16
|
-
export * as RedBotUtils from "./classes/Utils.js";
|
|
17
|
-
export * as EnireUtils from "./classes/Utils.js";
|
|
18
15
|
export * as GraloniumUtils from "./classes/Utils.js";
|
package/lib/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GraloniumUtils = exports.
|
|
3
|
+
exports.GraloniumUtils = exports.Plugins = exports.Errors = void 0;
|
|
4
4
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
|
|
@@ -19,7 +19,4 @@ tslib_1.__exportStar(require("./classes/Cooldowns.js"), exports);
|
|
|
19
19
|
|
|
20
20
|
exports.Errors = tslib_1.__importStar(require("./classes/Errors.js"));
|
|
21
21
|
exports.Plugins = tslib_1.__importStar(require("./classes/Plugins.js"));
|
|
22
|
-
exports.
|
|
23
|
-
exports.RedBotUtils = exports.ErineUtils;
|
|
24
|
-
exports.EnireUtils = exports.ErineUtils;
|
|
25
|
-
exports.GraloniumUtils = exports.ErineUtils;
|
|
22
|
+
exports.GraloniumUtils = tslib_1.__importStar(require("./classes/Utils.js"));
|
package/package.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gralonium",
|
|
3
3
|
"description": "i know.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "carzo",
|
|
7
|
-
|
|
8
7
|
"type": "commonjs",
|
|
9
|
-
|
|
10
8
|
"main": "./lib/main.js",
|
|
11
9
|
"types": "./lib/main.d.ts",
|
|
12
|
-
|
|
13
10
|
"exports": {
|
|
14
11
|
".": {
|
|
15
12
|
"types": "./lib/main.d.ts",
|
|
@@ -24,13 +21,10 @@
|
|
|
24
21
|
"default": "./lib/experiments.js"
|
|
25
22
|
}
|
|
26
23
|
},
|
|
27
|
-
|
|
28
24
|
"files": [
|
|
29
25
|
"lib/**/*"
|
|
30
26
|
],
|
|
31
|
-
|
|
32
27
|
"sideEffects": false,
|
|
33
|
-
|
|
34
28
|
"scripts": {
|
|
35
29
|
"build": "node -e \"const fs=require('fs');const cp=require('child_process');if(!fs.existsSync('tsconfig.json')||!fs.existsSync('src')){console.log('Skipping build: tsconfig.json/src not found');process.exit(0)}cp.execSync('tsc -p tsconfig.json && tsc-alias -p tsconfig.json',{stdio:'inherit',shell:true})\"",
|
|
36
30
|
"watch": "tsc -w -p tsconfig.json",
|
|
@@ -38,32 +32,27 @@
|
|
|
38
32
|
"clean": "rimraf lib",
|
|
39
33
|
"prepublishOnly": "npm run build"
|
|
40
34
|
},
|
|
41
|
-
|
|
42
35
|
"keywords": [
|
|
43
36
|
"bot"
|
|
44
37
|
],
|
|
45
|
-
|
|
46
38
|
"publishConfig": {
|
|
47
39
|
"access": "public",
|
|
48
40
|
"tag": "latest"
|
|
49
41
|
},
|
|
50
|
-
|
|
51
42
|
"engines": {
|
|
52
43
|
"node": ">=18.0.0"
|
|
53
44
|
},
|
|
54
|
-
|
|
55
45
|
"peerDependencies": {
|
|
56
46
|
"discord.js": "^14.0.0"
|
|
57
47
|
},
|
|
58
|
-
|
|
59
48
|
"dependencies": {
|
|
60
49
|
"@sapphire/shapeshift": "^3.9.7",
|
|
61
50
|
"tslib": "^2.6.2"
|
|
62
51
|
},
|
|
63
|
-
|
|
64
52
|
"devDependencies": {
|
|
65
|
-
"
|
|
53
|
+
"rimraf": "^5.0.5",
|
|
66
54
|
"tsc-alias": "^1.8.8",
|
|
67
|
-
"
|
|
55
|
+
"typescript": "^5.4.5",
|
|
56
|
+
"vitest": "^5.0.0"
|
|
68
57
|
}
|
|
69
58
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.data = void 0;
|
|
4
|
-
|
|
5
|
-
const EventBuilder_js_1 = require("../classes/builders/EventBuilder.js");
|
|
6
|
-
const Utils_js_1 = require("../classes/Utils.js");
|
|
7
|
-
|
|
8
|
-
exports.data = {
|
|
9
|
-
data: new EventBuilder_js_1.EventBuilder({
|
|
10
|
-
name: "interactionCreate",
|
|
11
|
-
description: "Triggered when an interaction is created.",
|
|
12
|
-
once: false,
|
|
13
|
-
}),
|
|
14
|
-
code: async function (bot, interaction) {
|
|
15
|
-
await Utils_js_1.Utils.handleInteraction(bot, interaction);
|
|
16
|
-
},
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.data = void 0;
|
|
4
|
-
|
|
5
|
-
const EventBuilder_js_1 = require("../classes/builders/EventBuilder.js");
|
|
6
|
-
const Utils_js_1 = require("../classes/Utils.js");
|
|
7
|
-
|
|
8
|
-
exports.data = {
|
|
9
|
-
data: new EventBuilder_js_1.EventBuilder({
|
|
10
|
-
name: "messageCreate",
|
|
11
|
-
description: "Triggered when a message is created.",
|
|
12
|
-
once: false,
|
|
13
|
-
}),
|
|
14
|
-
code: async function (bot, message) {
|
|
15
|
-
await Utils_js_1.Utils.handleMessage(bot, message, false);
|
|
16
|
-
},
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.data = void 0;
|
|
4
|
-
|
|
5
|
-
const EventBuilder_js_1 = require("../classes/builders/EventBuilder.js");
|
|
6
|
-
const Utils_js_1 = require("../classes/Utils.js");
|
|
7
|
-
|
|
8
|
-
exports.data = {
|
|
9
|
-
data: new EventBuilder_js_1.EventBuilder({
|
|
10
|
-
name: "messageUpdate",
|
|
11
|
-
description: "Triggered when a message is updated.",
|
|
12
|
-
once: false,
|
|
13
|
-
}),
|
|
14
|
-
code: async function (bot, _oldMessage, newMessage) {
|
|
15
|
-
await Utils_js_1.Utils.handleMessage(bot, newMessage, true);
|
|
16
|
-
},
|
|
17
|
-
};
|