gralonium 0.2.0 → 0.4.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 +9 -11
- package/lib/classes/Client.js +10 -13
- package/lib/classes/Context.d.ts +43 -4
- package/lib/classes/Context.js +251 -12
- package/lib/classes/Cooldowns.d.ts +3 -3
- package/lib/classes/Cooldowns.js +3 -8
- package/lib/classes/HelpCommand.d.ts +55 -13
- package/lib/classes/HelpCommand.js +319 -1
- package/lib/classes/Loader.d.ts +17 -11
- package/lib/classes/Loader.js +43 -42
- package/lib/classes/Utils.d.ts +4 -5
- package/lib/classes/Utils.js +32 -21
- package/lib/classes/builders/CommandBuilder.d.ts +10 -0
- package/lib/classes/builders/CommandBuilder.js +16 -0
- package/lib/classes/builders/ComponentsV2Builder.d.ts +285 -113
- package/lib/classes/builders/ComponentsV2Builder.js +1069 -182
- package/lib/classes/builders/GroupBuilder.d.ts +9 -0
- package/lib/classes/builders/GroupBuilder.js +16 -0
- package/lib/classes/builders/InteractionBuilder.d.ts +40 -25
- package/lib/classes/builders/InteractionBuilder.js +102 -1
- package/lib/classes/builders/components/StyleMapper.d.ts +1 -1
- package/lib/classes/builders/components/StyleMapper.js +2 -1
- package/lib/classes/builders/components/helpers.d.ts +68 -4
- package/lib/classes/builders/components/helpers.js +366 -7
- package/lib/classes/builders/components/templates.d.ts +151 -9
- package/lib/classes/builders/components/templates.js +376 -17
- package/lib/classes/builders/components/text.d.ts +24 -0
- package/lib/classes/builders/components/text.js +91 -0
- package/lib/classes/experiments/Confirmator.d.ts +45 -50
- package/lib/classes/experiments/Confirmator.js +37 -21
- package/lib/classes/experiments/Paginator.d.ts +49 -56
- package/lib/classes/experiments/Paginator.js +48 -19
- package/lib/classes/views/V2Paginator.d.ts +91 -0
- package/lib/classes/views/V2Paginator.js +268 -0
- package/lib/classes/views/V2View.d.ts +113 -0
- package/lib/classes/views/V2View.js +438 -0
- package/lib/experiments.d.ts +2 -0
- package/lib/experiments.js +9 -1
- package/lib/main.d.ts +3 -3
- package/lib/main.js +5 -5
- package/package.json +6 -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
|
@@ -3,13 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Confirmator = void 0;
|
|
4
4
|
|
|
5
5
|
const discord_js_1 = require("discord.js");
|
|
6
|
+
const helpers_js_1 = require("../builders/components/helpers.js");
|
|
7
|
+
const StyleMapper_js_1 = require("../builders/components/StyleMapper.js");
|
|
6
8
|
|
|
7
9
|
class Confirmator {
|
|
8
10
|
_author;
|
|
9
11
|
_continue = async () => null;
|
|
10
|
-
_cancel = async (interaction) => interaction.reply({ content: "Cancelled process.",
|
|
11
|
-
_filter = async (interaction) =>
|
|
12
|
+
_cancel = async (interaction) => interaction.reply({ content: "Cancelled process.", flags: discord_js_1.MessageFlags.Ephemeral });
|
|
13
|
+
_filter = async (interaction) =>
|
|
14
|
+
interaction.reply({ content: "This interaction isn't for you!", flags: discord_js_1.MessageFlags.Ephemeral });
|
|
12
15
|
filter = async (interaction) => interaction.user.id !== this._author.id;
|
|
16
|
+
_continueId = "continueButton";
|
|
17
|
+
_cancelId = "cancelButton";
|
|
18
|
+
_disableOnEnd = true;
|
|
13
19
|
timeout;
|
|
14
20
|
message;
|
|
15
21
|
bot;
|
|
@@ -17,6 +23,10 @@ class Confirmator {
|
|
|
17
23
|
constructor(bot, options) {
|
|
18
24
|
this._author = options.author;
|
|
19
25
|
this.bot = bot;
|
|
26
|
+
if (options.filter) this.filter = options.filter;
|
|
27
|
+
if (options.continueId) this._continueId = options.continueId;
|
|
28
|
+
if (options.cancelId) this._cancelId = options.cancelId;
|
|
29
|
+
if (options.disableOnEnd !== undefined) this._disableOnEnd = Boolean(options.disableOnEnd);
|
|
20
30
|
this.timeout = options.timeout ?? 60;
|
|
21
31
|
}
|
|
22
32
|
|
|
@@ -46,31 +56,35 @@ class Confirmator {
|
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
static Buttons(options) {
|
|
59
|
+
const continueStyle =
|
|
60
|
+
options?.continue?.style !== undefined ? StyleMapper_js_1.mapButtonStyle(options.continue.style) : discord_js_1.ButtonStyle.Danger;
|
|
61
|
+
const cancelStyle =
|
|
62
|
+
options?.cancel?.style !== undefined ? StyleMapper_js_1.mapButtonStyle(options.cancel.style) : discord_js_1.ButtonStyle.Success;
|
|
63
|
+
|
|
49
64
|
const continueButton = new discord_js_1.ButtonBuilder()
|
|
50
65
|
.setLabel(options?.continue?.label || "Continue")
|
|
51
|
-
.setStyle(
|
|
52
|
-
.setCustomId("continueButton");
|
|
66
|
+
.setStyle(continueStyle)
|
|
67
|
+
.setCustomId(options?.continue?.customId || "continueButton");
|
|
68
|
+
if (options?.continue?.emoji) {
|
|
69
|
+
const parsed = helpers_js_1.parseEmoji(options.continue.emoji);
|
|
70
|
+
if (parsed) continueButton.setEmoji(parsed);
|
|
71
|
+
}
|
|
53
72
|
|
|
54
73
|
const cancelButton = new discord_js_1.ButtonBuilder()
|
|
55
74
|
.setLabel(options?.cancel?.label || "Cancel")
|
|
56
|
-
.setStyle(
|
|
57
|
-
.setCustomId("cancelButton");
|
|
75
|
+
.setStyle(cancelStyle)
|
|
76
|
+
.setCustomId(options?.cancel?.customId || "cancelButton");
|
|
77
|
+
if (options?.cancel?.emoji) {
|
|
78
|
+
const parsed = helpers_js_1.parseEmoji(options.cancel.emoji);
|
|
79
|
+
if (parsed) cancelButton.setEmoji(parsed);
|
|
80
|
+
}
|
|
58
81
|
|
|
59
82
|
return new discord_js_1.ActionRowBuilder().addComponents(continueButton, cancelButton).toJSON();
|
|
60
83
|
}
|
|
61
84
|
|
|
62
85
|
async #disableMessageComponents() {
|
|
63
|
-
if (!this.
|
|
64
|
-
|
|
65
|
-
const components = this.message.components.map((row) => {
|
|
66
|
-
const cloned = discord_js_1.ActionRowBuilder.from(row);
|
|
67
|
-
for (const component of cloned.components) {
|
|
68
|
-
component.setDisabled(true);
|
|
69
|
-
}
|
|
70
|
-
return cloned;
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
await this.message.edit({ components }).catch(() => null);
|
|
86
|
+
if (!this._disableOnEnd) return;
|
|
87
|
+
await helpers_js_1.disableMessageComponents(this.message);
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
start() {
|
|
@@ -84,7 +98,7 @@ class Confirmator {
|
|
|
84
98
|
});
|
|
85
99
|
|
|
86
100
|
collector.on("collect", async (interaction) => {
|
|
87
|
-
if (interaction.customId !==
|
|
101
|
+
if (interaction.customId !== this._continueId && interaction.customId !== this._cancelId) {
|
|
88
102
|
return;
|
|
89
103
|
}
|
|
90
104
|
|
|
@@ -93,21 +107,23 @@ class Confirmator {
|
|
|
93
107
|
return;
|
|
94
108
|
}
|
|
95
109
|
|
|
96
|
-
if (interaction.customId ===
|
|
110
|
+
if (interaction.customId === this._continueId) {
|
|
97
111
|
await interaction.deferUpdate();
|
|
98
|
-
|
|
112
|
+
collector.stop("confirmed");
|
|
99
113
|
await this._continue(interaction);
|
|
100
114
|
return;
|
|
101
115
|
}
|
|
102
116
|
|
|
103
117
|
await interaction.deferUpdate();
|
|
104
|
-
|
|
118
|
+
collector.stop("cancelled");
|
|
105
119
|
await this._cancel(interaction);
|
|
106
120
|
});
|
|
107
121
|
|
|
108
122
|
collector.on("end", async () => {
|
|
109
123
|
await this.#disableMessageComponents();
|
|
110
124
|
});
|
|
125
|
+
|
|
126
|
+
return collector;
|
|
111
127
|
}
|
|
112
128
|
}
|
|
113
129
|
|
|
@@ -1,65 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ButtonStyle, CollectedInteraction, InteractionCollector, Message, User } from "discord.js";
|
|
2
|
+
import type { ButtonStyleResolvable } from "../builders/ComponentsV2Builder.js";
|
|
3
|
+
import type { EmojiInput } from "../builders/components/helpers.js";
|
|
2
4
|
import { AsyncFunction } from "../Loader.js";
|
|
3
|
-
import {
|
|
5
|
+
import { Gralonium } from "../Client.js";
|
|
6
|
+
|
|
4
7
|
export type ButtonSchema = {
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
style?: ButtonStyle | ButtonStyleResolvable;
|
|
9
|
+
label?: string;
|
|
10
|
+
emoji?: EmojiInput;
|
|
11
|
+
customId?: string;
|
|
12
|
+
disabled?: boolean;
|
|
7
13
|
};
|
|
8
|
-
|
|
14
|
+
|
|
15
|
+
export type PaginatorProcess = AsyncFunction<CollectedInteraction, any>;
|
|
16
|
+
|
|
9
17
|
export type PaginatorOptions<P = any> = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
pages: P[];
|
|
19
|
+
author: User;
|
|
20
|
+
filter?: PaginatorProcess;
|
|
21
|
+
timeout?: number;
|
|
22
|
+
previousId?: string;
|
|
23
|
+
nextId?: string;
|
|
24
|
+
disableOnEnd?: boolean;
|
|
14
25
|
};
|
|
26
|
+
|
|
15
27
|
export type PaginatorButtonsOptions = {
|
|
16
|
-
|
|
17
|
-
|
|
28
|
+
next?: ButtonSchema;
|
|
29
|
+
previous?: ButtonSchema;
|
|
18
30
|
};
|
|
31
|
+
|
|
19
32
|
export declare class Paginator<P = any> {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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;
|
|
33
|
+
pages: P[];
|
|
34
|
+
filter: PaginatorProcess;
|
|
35
|
+
bot: Gralonium;
|
|
36
|
+
message?: Message;
|
|
37
|
+
timeout: number;
|
|
38
|
+
constructor(bot: Gralonium, options: PaginatorOptions<P>);
|
|
39
|
+
get page(): P;
|
|
40
|
+
get pageNumber(): number;
|
|
41
|
+
get pagesFooter(): string;
|
|
42
|
+
setUpdateProcess(predicate: AsyncFunction<P, any>): this;
|
|
43
|
+
setFilterProcess(predicate: PaginatorProcess): this;
|
|
44
|
+
setFilterCheckProcess(predicate: PaginatorProcess): this;
|
|
45
|
+
setMessage(message: Message): this;
|
|
46
|
+
static Buttons(
|
|
47
|
+
options?: PaginatorButtonsOptions
|
|
48
|
+
): import("discord.js").APIActionRowComponent<
|
|
49
|
+
| import("discord.js").APIStringSelectComponent
|
|
50
|
+
| import("discord.js").APIChannelSelectComponent
|
|
51
|
+
| import("discord.js").APIMentionableSelectComponent
|
|
52
|
+
| import("discord.js").APIUserSelectComponent
|
|
53
|
+
| import("discord.js").APIRoleSelectComponent
|
|
54
|
+
| import("discord.js").APIButtonComponent
|
|
55
|
+
| import("discord.js").APITextInputComponent
|
|
56
|
+
>;
|
|
57
|
+
start(): InteractionCollector<any>;
|
|
65
58
|
}
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Paginator = void 0;
|
|
4
4
|
|
|
5
5
|
const discord_js_1 = require("discord.js");
|
|
6
|
+
const helpers_js_1 = require("../builders/components/helpers.js");
|
|
7
|
+
const StyleMapper_js_1 = require("../builders/components/StyleMapper.js");
|
|
8
|
+
const ComponentsV2Builder_js_1 = require("../builders/ComponentsV2Builder.js");
|
|
6
9
|
|
|
7
10
|
class Paginator {
|
|
8
11
|
pages;
|
|
@@ -12,14 +15,29 @@ class Paginator {
|
|
|
12
15
|
timeout;
|
|
13
16
|
_author;
|
|
14
17
|
_page = 0;
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
_previousId = "previousButton";
|
|
19
|
+
_nextId = "continueButton";
|
|
20
|
+
_disableOnEnd = true;
|
|
21
|
+
_filter = async (interaction) =>
|
|
22
|
+
interaction.reply({ content: "This interaction isn't for you!", flags: discord_js_1.MessageFlags.Ephemeral });
|
|
23
|
+
_update = async (content) => {
|
|
24
|
+
if (ComponentsV2Builder_js_1.ComponentsV2Builder.isBuilder(content)) {
|
|
25
|
+
return this.message.edit(content.toPayload());
|
|
26
|
+
}
|
|
27
|
+
if (content && typeof content === "object" && (content.components || content.embeds || content.content !== undefined)) {
|
|
28
|
+
return this.message.edit(content);
|
|
29
|
+
}
|
|
30
|
+
return this.message.edit({ content: content.toString() });
|
|
31
|
+
};
|
|
17
32
|
|
|
18
33
|
constructor(bot, options) {
|
|
19
34
|
this.bot = bot;
|
|
20
35
|
this.pages = options.pages;
|
|
21
36
|
this._author = options.author;
|
|
22
37
|
if (options.filter) this.filter = options.filter;
|
|
38
|
+
if (options.previousId) this._previousId = options.previousId;
|
|
39
|
+
if (options.nextId) this._nextId = options.nextId;
|
|
40
|
+
if (options.disableOnEnd !== undefined) this._disableOnEnd = Boolean(options.disableOnEnd);
|
|
23
41
|
this.timeout = options.timeout ?? 60;
|
|
24
42
|
}
|
|
25
43
|
|
|
@@ -56,31 +74,40 @@ class Paginator {
|
|
|
56
74
|
}
|
|
57
75
|
|
|
58
76
|
static Buttons(options) {
|
|
77
|
+
const nextStyle = options?.next?.style !== undefined ? StyleMapper_js_1.mapButtonStyle(options.next.style) : discord_js_1.ButtonStyle.Primary;
|
|
78
|
+
const prevStyle =
|
|
79
|
+
options?.previous?.style !== undefined ? StyleMapper_js_1.mapButtonStyle(options.previous.style) : discord_js_1.ButtonStyle.Primary;
|
|
80
|
+
|
|
59
81
|
const nextButton = new discord_js_1.ButtonBuilder()
|
|
60
|
-
.setCustomId("continueButton")
|
|
61
|
-
.setStyle(
|
|
82
|
+
.setCustomId(options?.next?.customId || "continueButton")
|
|
83
|
+
.setStyle(nextStyle)
|
|
62
84
|
.setLabel(options?.next?.label || "Next");
|
|
85
|
+
if (options?.next?.emoji) {
|
|
86
|
+
const parsed = helpers_js_1.parseEmoji(options.next.emoji);
|
|
87
|
+
if (parsed) nextButton.setEmoji(parsed);
|
|
88
|
+
}
|
|
89
|
+
if (options?.next?.disabled !== undefined) {
|
|
90
|
+
nextButton.setDisabled(Boolean(options.next.disabled));
|
|
91
|
+
}
|
|
63
92
|
|
|
64
93
|
const previousButton = new discord_js_1.ButtonBuilder()
|
|
65
|
-
.setCustomId("previousButton")
|
|
66
|
-
.setStyle(
|
|
94
|
+
.setCustomId(options?.previous?.customId || "previousButton")
|
|
95
|
+
.setStyle(prevStyle)
|
|
67
96
|
.setLabel(options?.previous?.label || "Previous");
|
|
97
|
+
if (options?.previous?.emoji) {
|
|
98
|
+
const parsed = helpers_js_1.parseEmoji(options.previous.emoji);
|
|
99
|
+
if (parsed) previousButton.setEmoji(parsed);
|
|
100
|
+
}
|
|
101
|
+
if (options?.previous?.disabled !== undefined) {
|
|
102
|
+
previousButton.setDisabled(Boolean(options.previous.disabled));
|
|
103
|
+
}
|
|
68
104
|
|
|
69
105
|
return new discord_js_1.ActionRowBuilder().addComponents(previousButton, nextButton).toJSON();
|
|
70
106
|
}
|
|
71
107
|
|
|
72
108
|
async #disableMessageComponents() {
|
|
73
|
-
if (!this.
|
|
74
|
-
|
|
75
|
-
const components = this.message.components.map((row) => {
|
|
76
|
-
const cloned = discord_js_1.ActionRowBuilder.from(row);
|
|
77
|
-
for (const component of cloned.components) {
|
|
78
|
-
component.setDisabled(true);
|
|
79
|
-
}
|
|
80
|
-
return cloned;
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
await this.message.edit({ components }).catch(() => null);
|
|
109
|
+
if (!this._disableOnEnd) return;
|
|
110
|
+
await helpers_js_1.disableMessageComponents(this.message);
|
|
84
111
|
}
|
|
85
112
|
|
|
86
113
|
start() {
|
|
@@ -94,7 +121,7 @@ class Paginator {
|
|
|
94
121
|
});
|
|
95
122
|
|
|
96
123
|
collector.on("collect", async (interaction) => {
|
|
97
|
-
if (interaction.customId !==
|
|
124
|
+
if (interaction.customId !== this._previousId && interaction.customId !== this._nextId) {
|
|
98
125
|
return;
|
|
99
126
|
}
|
|
100
127
|
|
|
@@ -103,7 +130,7 @@ class Paginator {
|
|
|
103
130
|
return;
|
|
104
131
|
}
|
|
105
132
|
|
|
106
|
-
if (interaction.customId ===
|
|
133
|
+
if (interaction.customId === this._previousId) {
|
|
107
134
|
await interaction.deferUpdate();
|
|
108
135
|
this._page = this._page <= 0 ? this.pages.length - 1 : this._page - 1;
|
|
109
136
|
await this._update(this.pages[this._page]);
|
|
@@ -118,6 +145,8 @@ class Paginator {
|
|
|
118
145
|
collector.on("end", async () => {
|
|
119
146
|
await this.#disableMessageComponents();
|
|
120
147
|
});
|
|
148
|
+
|
|
149
|
+
return collector;
|
|
121
150
|
}
|
|
122
151
|
}
|
|
123
152
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { InteractionCollector, Message, TextBasedChannel, User } from "discord.js";
|
|
2
|
+
import type { ColorResolvable, ComponentsV2Builder, V2BuiltPayload, V2ButtonObjectOptions } from "../builders/ComponentsV2Builder.js";
|
|
3
|
+
import type { EmojiInput } from "../builders/components/helpers.js";
|
|
4
|
+
import type { Context } from "../Context.js";
|
|
5
|
+
import type { V2View, V2ViewAttachOptions, V2ViewEndMode, V2ViewSendOptions, V2ViewThirdPartyMode } from "./V2View.js";
|
|
6
|
+
|
|
7
|
+
export interface V2PaginatorButtonConfig {
|
|
8
|
+
label?: string;
|
|
9
|
+
emoji?: EmojiInput;
|
|
10
|
+
style?: V2ButtonObjectOptions["style"];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface V2PaginatorPageContext<T = any> {
|
|
14
|
+
page: T;
|
|
15
|
+
pageIndex: number;
|
|
16
|
+
pageNumber: number;
|
|
17
|
+
totalPages: number;
|
|
18
|
+
totalItems: number;
|
|
19
|
+
startIndex: number;
|
|
20
|
+
items?: T[];
|
|
21
|
+
controls: V2ButtonObjectOptions[];
|
|
22
|
+
view: V2View<{ pageIndex: number }>;
|
|
23
|
+
state: { pageIndex: number };
|
|
24
|
+
isEnded: boolean;
|
|
25
|
+
isEphemeral: boolean;
|
|
26
|
+
prevId: string;
|
|
27
|
+
nextId: string;
|
|
28
|
+
closeId: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface V2PaginatorOptions<T = any> {
|
|
32
|
+
pages?: T[];
|
|
33
|
+
items?: T[];
|
|
34
|
+
perPage?: number;
|
|
35
|
+
totalItems?: number;
|
|
36
|
+
initialPage?: number;
|
|
37
|
+
wrap?: boolean;
|
|
38
|
+
idPrefix?: string;
|
|
39
|
+
author?: User;
|
|
40
|
+
authorId?: string;
|
|
41
|
+
ownerId?: string;
|
|
42
|
+
timeout?: number;
|
|
43
|
+
time?: number;
|
|
44
|
+
timeoutSeconds?: number;
|
|
45
|
+
idle?: number;
|
|
46
|
+
thirdPartyMode?: V2ViewThirdPartyMode;
|
|
47
|
+
thirdPartyMessage?: string;
|
|
48
|
+
onEnd?: V2ViewEndMode;
|
|
49
|
+
onEndHandler?: (info: { view: V2View<{ pageIndex: number }>; message: Message | null; reason: string }) => unknown;
|
|
50
|
+
isEphemeral?: boolean;
|
|
51
|
+
color?: ColorResolvable;
|
|
52
|
+
accentColor?: ColorResolvable;
|
|
53
|
+
title?: string;
|
|
54
|
+
subtitle?: string;
|
|
55
|
+
thumbnail?: string | null;
|
|
56
|
+
numbered?: boolean;
|
|
57
|
+
emptyText?: string;
|
|
58
|
+
footer?: string;
|
|
59
|
+
renderItem?: (item: T, index: number) => string;
|
|
60
|
+
renderPage?: (ctx: V2PaginatorPageContext<T>) => ComponentsV2Builder | V2BuiltPayload;
|
|
61
|
+
appendControlsToPrebuilt?: boolean;
|
|
62
|
+
alwaysShowControls?: boolean;
|
|
63
|
+
outsideControls?: boolean;
|
|
64
|
+
showPageIndicator?: boolean;
|
|
65
|
+
showFirstLast?: boolean;
|
|
66
|
+
pageIndicatorFormatter?: (page: number, totalPages: number) => string;
|
|
67
|
+
prevButton?: V2PaginatorButtonConfig;
|
|
68
|
+
nextButton?: V2PaginatorButtonConfig;
|
|
69
|
+
firstButton?: V2PaginatorButtonConfig;
|
|
70
|
+
lastButton?: V2PaginatorButtonConfig;
|
|
71
|
+
closeButton?: boolean | V2PaginatorButtonConfig;
|
|
72
|
+
closeReason?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export declare class V2Paginator<T = any> {
|
|
76
|
+
constructor(options: V2PaginatorOptions<T>);
|
|
77
|
+
|
|
78
|
+
readonly view: V2View<{ pageIndex: number }>;
|
|
79
|
+
readonly pageIndex: number;
|
|
80
|
+
readonly totalPages: number;
|
|
81
|
+
readonly collector: InteractionCollector<any> | null;
|
|
82
|
+
readonly message: Message | null;
|
|
83
|
+
|
|
84
|
+
toPayload(options?: { ephemeral?: boolean }): V2BuiltPayload;
|
|
85
|
+
attach(message: Message | any, collectorOptions?: V2ViewAttachOptions): InteractionCollector<any>;
|
|
86
|
+
stop(reason?: string): V2View<{ pageIndex: number }>;
|
|
87
|
+
send(
|
|
88
|
+
target: Context | TextBasedChannel,
|
|
89
|
+
sendOptions?: V2ViewSendOptions
|
|
90
|
+
): Promise<{ view: V2View<{ pageIndex: number }>; message: Message | null; collector: InteractionCollector<any> | null }>;
|
|
91
|
+
}
|