@carzo/enire 3.0.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/README.md +57 -0
- package/lib/classes/Client.d.ts +37 -0
- package/lib/classes/Client.js +125 -0
- package/lib/classes/Context.d.ts +24 -0
- package/lib/classes/Context.js +87 -0
- package/lib/classes/Cooldowns.d.ts +22 -0
- package/lib/classes/Cooldowns.js +1 -0
- package/lib/classes/Errors.d.ts +135 -0
- package/lib/classes/Errors.js +1 -0
- package/lib/classes/HelpCommand.d.ts +15 -0
- package/lib/classes/HelpCommand.js +1 -0
- package/lib/classes/Loader.d.ts +85 -0
- package/lib/classes/Loader.js +302 -0
- package/lib/classes/Plugins.d.ts +52 -0
- package/lib/classes/Plugins.js +107 -0
- package/lib/classes/Utils.d.ts +25 -0
- package/lib/classes/Utils.js +563 -0
- package/lib/classes/builders/CommandBuilder.d.ts +44 -0
- package/lib/classes/builders/CommandBuilder.js +91 -0
- package/lib/classes/builders/EventBuilder.d.ts +19 -0
- package/lib/classes/builders/EventBuilder.js +1 -0
- package/lib/classes/builders/GroupBuilder.d.ts +40 -0
- package/lib/classes/builders/GroupBuilder.js +72 -0
- package/lib/classes/builders/InteractionBuilder.d.ts +32 -0
- package/lib/classes/builders/InteractionBuilder.js +1 -0
- package/lib/classes/builders/ParamsBuilder.d.ts +87 -0
- package/lib/classes/builders/ParamsBuilder.js +1 -0
- package/lib/classes/experiments/Confirmator.d.ts +58 -0
- package/lib/classes/experiments/Confirmator.js +1 -0
- package/lib/classes/experiments/Paginator.d.ts +65 -0
- package/lib/classes/experiments/Paginator.js +1 -0
- package/lib/events/interactionCreate.d.ts +4 -0
- package/lib/events/interactionCreate.js +17 -0
- package/lib/events/messageCreate.d.ts +4 -0
- package/lib/events/messageCreate.js +17 -0
- package/lib/events/messageUpdate.d.ts +4 -0
- package/lib/events/messageUpdate.js +17 -0
- package/lib/experiments.d.ts +2 -0
- package/lib/experiments.js +1 -0
- package/lib/main.d.ts +15 -0
- package/lib/main.js +22 -0
- package/package.json +55 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ClientEvents } from "discord.js";
|
|
2
|
+
export interface EventDataBuilder {
|
|
3
|
+
name: keyof ClientEvents;
|
|
4
|
+
once: boolean;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class EventBuilder {
|
|
8
|
+
name: string;
|
|
9
|
+
once: boolean;
|
|
10
|
+
description: string;
|
|
11
|
+
constructor(options?: EventDataBuilder);
|
|
12
|
+
/**
|
|
13
|
+
* Returns the command data parsed as JSON.
|
|
14
|
+
*/
|
|
15
|
+
toJSON(): {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBuilder=void 0;class EventBuilder{name;once;description;constructor(e){this.name=e?.name??"",this.once=e?.once??!1,this.description=e?.description??"..."}toJSON(){return{name:this.name,description:this.description}}}exports.EventBuilder=EventBuilder;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Command, Types } from "../Loader.js";
|
|
2
|
+
|
|
3
|
+
type GroupBuilderOptions = {
|
|
4
|
+
name: string;
|
|
5
|
+
aliases?: string[];
|
|
6
|
+
description?: string;
|
|
7
|
+
as_slash?: boolean;
|
|
8
|
+
as_prefix?: boolean;
|
|
9
|
+
guildOnly?: boolean;
|
|
10
|
+
defaultMemberPermissions?: string | bigint;
|
|
11
|
+
guards?: Array<(ctx: any) => boolean | Promise<boolean>>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export declare class GroupBuilder {
|
|
15
|
+
name: string;
|
|
16
|
+
aliases: string[];
|
|
17
|
+
description: string;
|
|
18
|
+
commands: Command<Types.Normal>[];
|
|
19
|
+
as_slash: boolean;
|
|
20
|
+
as_prefix: boolean;
|
|
21
|
+
guildOnly: boolean | undefined;
|
|
22
|
+
defaultMemberPermissions?: string | bigint | undefined;
|
|
23
|
+
guards: Array<(ctx: any) => boolean | Promise<boolean>>;
|
|
24
|
+
constructor(ops?: GroupBuilderOptions);
|
|
25
|
+
setName(name: string): GroupBuilder;
|
|
26
|
+
setDescription(description: string): GroupBuilder;
|
|
27
|
+
addCommand(command: Command<Types.Normal>): GroupBuilder;
|
|
28
|
+
setGuards(...guards: Array<(ctx: any) => boolean | Promise<boolean>>): GroupBuilder;
|
|
29
|
+
allowPrefix(allow: boolean): GroupBuilder;
|
|
30
|
+
allowSlash(allow: boolean): GroupBuilder;
|
|
31
|
+
toJSON(): {
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
options: any[];
|
|
35
|
+
default_member_permissions: string | null | undefined;
|
|
36
|
+
dm_permission: boolean | undefined;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GroupBuilder = void 0;
|
|
4
|
+
|
|
5
|
+
const CommandBuilder_js_1 = require("./CommandBuilder.js");
|
|
6
|
+
|
|
7
|
+
class GroupBuilder {
|
|
8
|
+
name;
|
|
9
|
+
aliases;
|
|
10
|
+
description;
|
|
11
|
+
commands;
|
|
12
|
+
as_slash;
|
|
13
|
+
as_prefix;
|
|
14
|
+
guildOnly;
|
|
15
|
+
defaultMemberPermissions;
|
|
16
|
+
guards;
|
|
17
|
+
|
|
18
|
+
constructor(options) {
|
|
19
|
+
this.commands = [];
|
|
20
|
+
this.name = options?.name ?? "";
|
|
21
|
+
this.aliases = options?.aliases ?? [];
|
|
22
|
+
this.description = options?.description ?? "...";
|
|
23
|
+
this.as_prefix = options?.as_prefix ?? true;
|
|
24
|
+
this.as_slash = options?.as_slash ?? true;
|
|
25
|
+
this.guildOnly = options?.guildOnly;
|
|
26
|
+
this.defaultMemberPermissions = options?.defaultMemberPermissions;
|
|
27
|
+
this.guards = options?.guards ?? [];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
setName(name) {
|
|
31
|
+
this.name = name;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
setDescription(description) {
|
|
36
|
+
this.description = description;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
addCommand(command) {
|
|
41
|
+
this.commands.push(command);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
setGuards(...guards) {
|
|
46
|
+
this.guards = guards;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
allowPrefix(allow) {
|
|
51
|
+
this.as_prefix = allow;
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
allowSlash(allow) {
|
|
56
|
+
this.as_slash = allow;
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
toJSON() {
|
|
61
|
+
return {
|
|
62
|
+
name: this.name,
|
|
63
|
+
description: this.description,
|
|
64
|
+
options: [],
|
|
65
|
+
default_member_permissions: this.defaultMemberPermissions
|
|
66
|
+
? (0, CommandBuilder_js_1.validateDefaultMemberPermissions)(this.defaultMemberPermissions)
|
|
67
|
+
: undefined,
|
|
68
|
+
dm_permission: typeof this.guildOnly === "boolean" ? !this.guildOnly : undefined,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.GroupBuilder = GroupBuilder;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare enum Interactions {
|
|
2
|
+
AnyInteraction = "anyInteraction",
|
|
3
|
+
Autocomplete = "autocomplete",
|
|
4
|
+
Button = "button",
|
|
5
|
+
ChatInput = "chatInput",
|
|
6
|
+
MessageContextMenu = "messageContextMenu",
|
|
7
|
+
Modal = "modalSubmit",
|
|
8
|
+
UserContextMenu = "userContextMenu",
|
|
9
|
+
ChannelSelectMenu = "channelSelectMenu",
|
|
10
|
+
RoleSelectMenu = "roleSelectMenu",
|
|
11
|
+
StringSelectMenu = "stringSelectMenu",
|
|
12
|
+
UserSelectMenu = "userSelectMenu",
|
|
13
|
+
MentionableSelectMenu = "mentionableSelectMenu"
|
|
14
|
+
}
|
|
15
|
+
export interface InteractionDataBuilder {
|
|
16
|
+
name?: string;
|
|
17
|
+
type: Interactions;
|
|
18
|
+
description?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class InteractionBuilder {
|
|
21
|
+
name?: string;
|
|
22
|
+
type: Interactions;
|
|
23
|
+
description: string;
|
|
24
|
+
constructor(options?: InteractionDataBuilder);
|
|
25
|
+
/**
|
|
26
|
+
* Returns the command data parsed as JSON.
|
|
27
|
+
*/
|
|
28
|
+
toJSON(): {
|
|
29
|
+
name: string | undefined;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var Interactions;Object.defineProperty(exports,"__esModule",{value:!0}),exports.InteractionBuilder=exports.Interactions=void 0,function(e){e.AnyInteraction="anyInteraction",e.Autocomplete="autocomplete",e.Button="button",e.ChatInput="chatInput",e.MessageContextMenu="messageContextMenu",e.Modal="modalSubmit",e.UserContextMenu="userContextMenu",e.ChannelSelectMenu="channelSelectMenu",e.RoleSelectMenu="roleSelectMenu",e.StringSelectMenu="stringSelectMenu",e.UserSelectMenu="userSelectMenu",e.MentionableSelectMenu="mentionableSelectMenu"}(Interactions||(exports.Interactions=Interactions={}));class InteractionBuilder{name;type;description;constructor(e){this.name=e?.name,this.type=e?.type||Interactions.ChatInput,this.description=e?.description||"..."}toJSON(){return{name:this.name,description:this.description}}}exports.InteractionBuilder=InteractionBuilder;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ApplicationCommandOptionType, ChannelType } from "discord.js";
|
|
2
|
+
export interface BaseParam {
|
|
3
|
+
/** The name for this parameter. */
|
|
4
|
+
name: string;
|
|
5
|
+
/** The description for this parameter. */
|
|
6
|
+
description: string;
|
|
7
|
+
/** Mark this param as required or not. */
|
|
8
|
+
required: boolean;
|
|
9
|
+
/** Parameter type. (if needed) */
|
|
10
|
+
type?: ApplicationCommandOptionType;
|
|
11
|
+
/** Parameter default value. */
|
|
12
|
+
value?: any;
|
|
13
|
+
/** Mostly to be used for string. Return all arguments after this parameter (including this one) */
|
|
14
|
+
ellipsis?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface StringParam extends BaseParam {
|
|
17
|
+
/** String choices. */
|
|
18
|
+
choices?: {
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}[];
|
|
22
|
+
/** Maximum string length. */
|
|
23
|
+
max_length?: number;
|
|
24
|
+
/** Minimum string length. */
|
|
25
|
+
min_length?: number;
|
|
26
|
+
/** Mark this command as automplete */
|
|
27
|
+
autocomplete?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface NumberParam extends BaseParam {
|
|
30
|
+
/** Maximum number length. */
|
|
31
|
+
max_value?: number;
|
|
32
|
+
/** Minimum string length. */
|
|
33
|
+
min_value?: number;
|
|
34
|
+
/** Number choices. */
|
|
35
|
+
choices?: {
|
|
36
|
+
name: string;
|
|
37
|
+
value: string;
|
|
38
|
+
}[];
|
|
39
|
+
}
|
|
40
|
+
export interface ChannelParam extends BaseParam {
|
|
41
|
+
/** An array of allowed channel types. */
|
|
42
|
+
channel_types?: ChannelType[];
|
|
43
|
+
}
|
|
44
|
+
export declare class ParamsBuilder {
|
|
45
|
+
params: BaseParam[];
|
|
46
|
+
quoted: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Enable or disable quoted arguments.
|
|
49
|
+
* @param value Boolean value.
|
|
50
|
+
*/
|
|
51
|
+
setQuoted(value: boolean): ParamsBuilder;
|
|
52
|
+
/**
|
|
53
|
+
* Adds a string option.
|
|
54
|
+
* @param param Parameter data.
|
|
55
|
+
*/
|
|
56
|
+
addString(param: StringParam): ParamsBuilder;
|
|
57
|
+
/**
|
|
58
|
+
* Adds a number option.
|
|
59
|
+
* @param param Parameter data.
|
|
60
|
+
*/
|
|
61
|
+
addNumber(param: NumberParam): ParamsBuilder;
|
|
62
|
+
/**
|
|
63
|
+
* Adds a boolean option.
|
|
64
|
+
* @param param Parameter data.
|
|
65
|
+
*/
|
|
66
|
+
addBoolean(param: BaseParam): ParamsBuilder;
|
|
67
|
+
/**
|
|
68
|
+
* Adds a guild member option.
|
|
69
|
+
* @param param Parameter data.
|
|
70
|
+
*/
|
|
71
|
+
addMember(param: BaseParam): ParamsBuilder;
|
|
72
|
+
/**
|
|
73
|
+
* Adds a guild channel option.
|
|
74
|
+
* @param param Parameter data.
|
|
75
|
+
*/
|
|
76
|
+
addChannel(param: ChannelParam): ParamsBuilder;
|
|
77
|
+
/**
|
|
78
|
+
* Adds a role option.
|
|
79
|
+
* @param param Parameter data.
|
|
80
|
+
*/
|
|
81
|
+
addRole(param: BaseParam): ParamsBuilder;
|
|
82
|
+
/**
|
|
83
|
+
* Adds an attachment option.
|
|
84
|
+
* @param param Parameter data.
|
|
85
|
+
*/
|
|
86
|
+
addAttachment(param: BaseParam): ParamsBuilder;
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ParamsBuilder=void 0;const discord_js_1=require("discord.js");class ParamsBuilder{params=[];quoted=!0;setQuoted(t){return this.quoted=t,this}addString(t){return t.type=discord_js_1.ApplicationCommandOptionType.String,this.params.push(t),this}addNumber(t){return t.type=discord_js_1.ApplicationCommandOptionType.Number,this.params.push(t),this}addBoolean(t){return t.type=discord_js_1.ApplicationCommandOptionType.Boolean,this.params.push(t),this}addMember(t){return t.type=discord_js_1.ApplicationCommandOptionType.User,this.params.push(t),this}addChannel(t){return t.type=discord_js_1.ApplicationCommandOptionType.Channel,this.params.push(t),this}addRole(t){return t.type=discord_js_1.ApplicationCommandOptionType.Role,this.params.push(t),this}addAttachment(t){return t.type=discord_js_1.ApplicationCommandOptionType.Attachment,this.params.push(t),this}}exports.ParamsBuilder=ParamsBuilder;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { User, Message, CollectedInteraction } from "discord.js";
|
|
2
|
+
import { AsyncFunction } from "../Loader.js";
|
|
3
|
+
import { Erine } from "../Client.js";
|
|
4
|
+
export type ConfirmatorOptions = {
|
|
5
|
+
author: User;
|
|
6
|
+
filter?: ConfirmatorProcess;
|
|
7
|
+
timeout?: number;
|
|
8
|
+
};
|
|
9
|
+
export type ConfirmatorProcess = AsyncFunction<CollectedInteraction, any>;
|
|
10
|
+
export type ConfirmatorButtonsOptions = {
|
|
11
|
+
continue?: {
|
|
12
|
+
label?: string;
|
|
13
|
+
};
|
|
14
|
+
cancel?: {
|
|
15
|
+
label?: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare class Confirmator {
|
|
19
|
+
private _author;
|
|
20
|
+
private _continue;
|
|
21
|
+
private _cancel;
|
|
22
|
+
private _filter;
|
|
23
|
+
filter: ConfirmatorProcess;
|
|
24
|
+
timeout: number;
|
|
25
|
+
message?: Message;
|
|
26
|
+
bot: Erine;
|
|
27
|
+
constructor(bot: Erine, options: ConfirmatorOptions);
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param predicate The function to call when someone clicks the continue button
|
|
31
|
+
*/
|
|
32
|
+
setContinueProcess(predicate: ConfirmatorProcess): this;
|
|
33
|
+
/**
|
|
34
|
+
* @param predicate The function to call when someone clicks the cancel button.
|
|
35
|
+
*/
|
|
36
|
+
setCancelProcess(predicate: ConfirmatorProcess): this;
|
|
37
|
+
/**
|
|
38
|
+
* @param predicate The function to call when the filter process returns false
|
|
39
|
+
*/
|
|
40
|
+
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
|
+
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
|
+
setMessage(message: Message): this;
|
|
50
|
+
/**
|
|
51
|
+
* @param options Optional options to customize your buttons
|
|
52
|
+
*/
|
|
53
|
+
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
|
+
start(): void;
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Confirmator=void 0;const discord_js_1=require("discord.js");class Confirmator{_author;_continue=async t=>null;_cancel=async t=>t.reply({content:"Cancelled process."});_filter=async t=>t.reply({content:"This interaction isn't for you!",ephemeral:!0});filter=async t=>t.user.id!==this._author.id;timeout;message;bot;constructor(t,e){this._author=e.author,this.bot=t,this.timeout=e.timeout??60}setContinueProcess(t){return this._continue=t,this}setCancelProcess(t){return this._cancel=t,this}setFilterErrorProcess(t){return this._filter=t,this}setFilterCheckProcess(t){return this.filter=t,this}setMessage(t){return this.message=t,this}static Buttons(t){var e=(new discord_js_1.ButtonBuilder).setLabel(t?.continue?.label||"Continue").setStyle(discord_js_1.ButtonStyle.Danger).setCustomId("continueButton"),t=(new discord_js_1.ButtonBuilder).setLabel(t?.cancel?.label||"Cancel").setStyle(discord_js_1.ButtonStyle.Success).setCustomId("cancelButton");return(new discord_js_1.ActionRowBuilder).addComponents(e,t).toJSON()}start(){const e=new discord_js_1.InteractionCollector(this.bot);e.on("collect",async t=>{if(t.type===discord_js_1.InteractionType.MessageComponent||t.isButton()||"continueButton"==t.customId||"cancelButton"==t.customId){if(await this.filter(t))return this._filter(t);switch(!0){case"continueButton"===t.customId:await t.deferUpdate(),await e.stop(),await this._continue(t);break;case"cancelButton"===t.customId:await t.deferUpdate(),await e.stop(),await this._cancel(t)}}}),e.on("end",async()=>{var e={components:this.message.components};for(let t=0;t<e.components[0].components.length;t++)e.components[0].components[t].disabled=!0;await this.message.edit(e)})}}exports.Confirmator=Confirmator;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { User, Message, ButtonStyle, CollectedInteraction } from "discord.js";
|
|
2
|
+
import { AsyncFunction } from "../Loader.js";
|
|
3
|
+
import { Erine } from "../Client.js";
|
|
4
|
+
export type ButtonSchema = {
|
|
5
|
+
style?: ButtonStyle;
|
|
6
|
+
label?: string;
|
|
7
|
+
};
|
|
8
|
+
export type PaginatorProcess = AsyncFunction<CollectedInteraction, boolean>;
|
|
9
|
+
export type PaginatorOptions<P = any> = {
|
|
10
|
+
pages: P[];
|
|
11
|
+
author: User;
|
|
12
|
+
filter?: PaginatorProcess;
|
|
13
|
+
timeout?: number;
|
|
14
|
+
};
|
|
15
|
+
export type PaginatorButtonsOptions = {
|
|
16
|
+
next?: ButtonSchema;
|
|
17
|
+
previous?: ButtonSchema;
|
|
18
|
+
};
|
|
19
|
+
export declare class Paginator<P = any> {
|
|
20
|
+
pages: P[];
|
|
21
|
+
filter: PaginatorProcess;
|
|
22
|
+
bot: Erine;
|
|
23
|
+
message?: Message;
|
|
24
|
+
timeout: number;
|
|
25
|
+
private _author;
|
|
26
|
+
private _page;
|
|
27
|
+
private _filter;
|
|
28
|
+
private _update;
|
|
29
|
+
constructor(bot: Erine, options: PaginatorOptions);
|
|
30
|
+
/**
|
|
31
|
+
* Get the page content (provided in the constructor).
|
|
32
|
+
*/
|
|
33
|
+
get page(): P;
|
|
34
|
+
/**
|
|
35
|
+
* Get the current page number.
|
|
36
|
+
*/
|
|
37
|
+
get pageNumber(): number;
|
|
38
|
+
/**
|
|
39
|
+
* Get the page footer.
|
|
40
|
+
* @example "3/10"
|
|
41
|
+
*/
|
|
42
|
+
get pagesFooter(): string;
|
|
43
|
+
/**
|
|
44
|
+
* @param predicate The function to call when someone clicks the cancel button.
|
|
45
|
+
*/
|
|
46
|
+
setUpdateProcess(predicate: AsyncFunction<P, any>): this;
|
|
47
|
+
/**
|
|
48
|
+
* @param predicate The function to call when the filter process returns false
|
|
49
|
+
*/
|
|
50
|
+
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
|
+
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
|
+
setMessage(message: Message): this;
|
|
60
|
+
/**
|
|
61
|
+
* @param options Optional options to customize your buttons
|
|
62
|
+
*/
|
|
63
|
+
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
|
+
start(): void;
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Paginator=void 0;const discord_js_1=require("discord.js");class Paginator{pages;filter=async t=>t.user.id!==this._author.id;bot;message;timeout;_author;_page=0;_filter=async t=>t.reply({content:"This interaction isn't for you!",ephemeral:!0});_update=async t=>this.message.edit({content:t.toString()});constructor(t,e){this.bot=t,this.pages=e.pages,this._author=e.author,e.filter&&(this.filter=e.filter),this.timeout=e?.timeout??60}get page(){return this.pages[this._page]}get pageNumber(){return this._page+1}get pagesFooter(){return this._page+1+"/"+this.pages.length}setUpdateProcess(t){return this._update=t,this}setFilterProcess(t){return this._filter=t,this}setFilterCheckProcess(t){return this.filter=t,this}setMessage(t){return this.message=t,this}static Buttons(t){var e=(new discord_js_1.ButtonBuilder).setCustomId("continueButton").setStyle(t?.previous?.style||discord_js_1.ButtonStyle.Primary).setLabel(t?.next?.label||"Next"),t=(new discord_js_1.ButtonBuilder).setCustomId("previousButton").setStyle(t?.previous?.style||discord_js_1.ButtonStyle.Primary).setLabel(t?.previous?.label||"Previous");return(new discord_js_1.ActionRowBuilder).addComponents(t,e).toJSON()}start(){var t=new discord_js_1.InteractionCollector(this.bot);t.on("collect",async t=>{if(t.type===discord_js_1.InteractionType.MessageComponent||t.isButton()||"previousButton"==t.customId||"continueButton"==t.customId){if(await this.filter(t))return this._filter(t);switch(!0){case"previousButton"===t.customId:await t.deferUpdate(),this._page=this._page+1>=this.pages.length?0:this._page+1,await this._update(this.pages[this._page]);break;case"continueButton"===t.customId:await t.deferUpdate(),this._page=this._page<=0?this.pages.length-1:this._page-1,await this._update(this.pages[this._page])}}}),t.on("end",async()=>{var e={components:this.message.components};for(let t=0;t<e.components[0].components.length;t++)e.components[0].components[t].disabled=!0;await this.message.edit(e)})}}exports.Paginator=Paginator;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib");tslib_1.__exportStar(require("./classes/experiments/Paginator"),exports),tslib_1.__exportStar(require("./classes/experiments/Confirmator"),exports);
|
package/lib/main.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "discord.js";
|
|
2
|
+
export * from "./classes/Client.js";
|
|
3
|
+
export * from "./classes/Loader.js";
|
|
4
|
+
export * from "./classes/Context.js";
|
|
5
|
+
export * from "./classes/builders/CommandBuilder.js";
|
|
6
|
+
export * from "./classes/builders/EventBuilder.js";
|
|
7
|
+
export * from "./classes/builders/InteractionBuilder.js";
|
|
8
|
+
export * from "./classes/builders/GroupBuilder.js";
|
|
9
|
+
export * from "./classes/builders/ParamsBuilder.js";
|
|
10
|
+
export * from "./classes/HelpCommand.js";
|
|
11
|
+
export * from "./classes/Cooldowns.js";
|
|
12
|
+
export * as Errors from "./classes/Errors.js";
|
|
13
|
+
export * as Plugins from "./classes/Plugins.js";
|
|
14
|
+
export * as ErineUtils from "./classes/Utils.js";
|
|
15
|
+
export * as EnireUtils from "./classes/Utils.js";
|
package/lib/main.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnireUtils = exports.ErineUtils = exports.Plugins = exports.Errors = void 0;
|
|
4
|
+
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
|
|
7
|
+
tslib_1.__exportStar(require("discord.js"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./classes/Client.js"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./classes/Loader.js"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./classes/Context.js"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./classes/builders/CommandBuilder.js"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./classes/builders/EventBuilder.js"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./classes/builders/InteractionBuilder.js"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./classes/builders/GroupBuilder.js"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./classes/builders/ParamsBuilder.js"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./classes/HelpCommand.js"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./classes/Cooldowns.js"), exports);
|
|
18
|
+
|
|
19
|
+
exports.Errors = tslib_1.__importStar(require("./classes/Errors.js"));
|
|
20
|
+
exports.Plugins = tslib_1.__importStar(require("./classes/Plugins.js"));
|
|
21
|
+
exports.ErineUtils = tslib_1.__importStar(require("./classes/Utils.js"));
|
|
22
|
+
exports.EnireUtils = exports.ErineUtils;
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@carzo/enire",
|
|
3
|
+
"description": "A modern Discord command framework with unified prefix and slash pipelines.",
|
|
4
|
+
"version": "3.0.0",
|
|
5
|
+
"main": "./lib/main.js",
|
|
6
|
+
"types": "./lib/main.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
"./experiments": "./lib/experiments.js",
|
|
9
|
+
".": "./lib/main.js"
|
|
10
|
+
},
|
|
11
|
+
"typesVersions": {
|
|
12
|
+
"*": {
|
|
13
|
+
"experiments": [
|
|
14
|
+
"./lib/experiments.d.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build:publish": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json && node packers.js",
|
|
20
|
+
"build:watch": "tsc -p tsconfig.json -w && tsc-alias -p tsconfig.json -w",
|
|
21
|
+
"build": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"hybrids",
|
|
25
|
+
"discord.js",
|
|
26
|
+
"framework",
|
|
27
|
+
"discord.py",
|
|
28
|
+
"hybrid-commands"
|
|
29
|
+
],
|
|
30
|
+
"author": "Cyberghxst <cyberghxst@petalmail.com> (https://github.com/Cyberghxst)",
|
|
31
|
+
"contributors": [
|
|
32
|
+
{
|
|
33
|
+
"name": "Mid",
|
|
34
|
+
"email": "Miduwu@users.noreply.github.com",
|
|
35
|
+
"url": "https://github.com/Miduwu"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"tag": "latest"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@sapphire/shapeshift": "^3.9.7",
|
|
45
|
+
"discord.js": "^14.14.1",
|
|
46
|
+
"tslib": "^2.6.2"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"lodash": "^4.17.21",
|
|
50
|
+
"miduco": "^1.0.2",
|
|
51
|
+
"tsc-alias": "^1.8.8",
|
|
52
|
+
"typescript": "^5.4.5",
|
|
53
|
+
"uglify-js": "^3.17.4"
|
|
54
|
+
}
|
|
55
|
+
}
|