Fixed issue with pagination message

This commit is contained in:
Essem 2021-08-14 16:15:21 -05:00
parent 5e8c587c41
commit 382480e1c7
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
6 changed files with 11 additions and 12 deletions

10
app.js
View file

@ -39,7 +39,7 @@ k <BBBw BBBBEBBBBBBBBBBBBBBBBBQ4BM #
esmBot ${require("./package.json").version}, powered by eris-fleet ${require("./node_modules/eris-fleet/package.json").version} esmBot ${require("./package.json").version}, powered by eris-fleet ${require("./node_modules/eris-fleet/package.json").version}
`); `);
// a bit of a hacky way to get the eris-fleet version // a bit of a hacky way to get the eris-fleet version
} }
const Admiral = new Fleet({ const Admiral = new Fleet({
@ -100,13 +100,13 @@ const Admiral = new Fleet({
}, },
services: [ services: [
{ name: "prometheus", path: path.join(__dirname, "./utils/services/prometheus.js") }, { name: "prometheus", path: path.join(__dirname, "./utils/services/prometheus.js") },
{ name: "image", path: path.join(__dirname, "./utils/services/image.js")} { name: "image", path: path.join(__dirname, "./utils/services/image.js") }
] ]
}); });
if (isMaster) { if (isMaster) {
const logger = winston.createLogger({ const logger = winston.createLogger({
levels: { levels: {
error: 0, error: 0,
warn: 1, warn: 1,
info: 2, info: 2,
@ -125,12 +125,12 @@ if (isMaster) {
const { const {
timestamp, level, message, ...args timestamp, level, message, ...args
} = info; } = info;
return `[${timestamp}]: [${level.toUpperCase()}] - ${message} ${Object.keys(args).length ? JSON.stringify(args, null, 2) : ""}`; return `[${timestamp}]: [${level.toUpperCase()}] - ${message} ${Object.keys(args).length ? JSON.stringify(args, null, 2) : ""}`;
}), }),
) )
}); });
winston.addColors({ winston.addColors({
info: "green", info: "green",
main: "gray", main: "gray",

View file

@ -96,7 +96,7 @@ class Shard extends BaseClusterWorker {
broadcast = false; broadcast = false;
return this.ipc.broadcast("broadcastEnd"); return this.ipc.broadcast("broadcastEnd");
}); });
// connect to lavalink // connect to lavalink
if (!sound.status && !sound.connected) sound.connect(this.bot); if (!sound.status && !sound.connected) sound.connect(this.bot);

View file

@ -127,7 +127,7 @@ exports.setup = async () => {
} }
exists.push(command); exists.push(command);
} }
for (const { command } of counts.rows) { for (const { command } of counts.rows) {
if (!exists.includes(command)) { if (!exists.includes(command)) {
await connection.query("DELETE FROM counts WHERE command = $1", [command]); await connection.query("DELETE FROM counts WHERE command = $1", [command]);

View file

@ -32,7 +32,7 @@ exports.setup = async () => {
} }
exists.push(command); exists.push(command);
} }
for (const { command } of counts) { for (const { command } of counts) {
if (!exists.includes(command)) { if (!exists.includes(command)) {
connection.prepare("DELETE FROM counts WHERE command = ?").run(command); connection.prepare("DELETE FROM counts WHERE command = ?").run(command);

View file

@ -10,7 +10,7 @@ class InteractionCollector extends EventEmitter {
this.bot = client; this.bot = client;
this.listener = async (packet) => { this.listener = async (packet) => {
if (packet.t !== "INTERACTION_CREATE") return; if (packet.t !== "INTERACTION_CREATE") return;
await this.verify(packet.d.message, packet.d.data.custom_id, packet.d.id, packet.d.token, packet.d.member ? packet.d.member.id : packet.d.user.id); await this.verify(packet.d.message, packet.d.data.custom_id, packet.d.id, packet.d.token, packet.d.member ? packet.d.member.user.id : packet.d.user.id);
}; };
this.bot.on("rawWS", this.listener); this.bot.on("rawWS", this.listener);
if (options.time) setTimeout(() => this.stop("time"), options.time); if (options.time) setTimeout(() => this.stop("time"), options.time);
@ -18,8 +18,7 @@ class InteractionCollector extends EventEmitter {
async verify(message, interaction, id, token, member) { async verify(message, interaction, id, token, member) {
if (this.message.id !== message.id) return false; if (this.message.id !== message.id) return false;
const msg = await this.bot.getMessage(message.channel_id, message.id); this.emit("interaction", interaction, id, token, member);
this.emit("interaction", msg, interaction, id, token, member);
return true; return true;
} }

View file

@ -73,7 +73,7 @@ module.exports = async (client, message, pages, timeout = 120000) => {
let currentPage = await client.createMessage(message.channel.id, Object.assign(pages[page], options, pages.length > 1 ? components : {})); let currentPage = await client.createMessage(message.channel.id, Object.assign(pages[page], options, pages.length > 1 ? components : {}));
if (pages.length > 1) { if (pages.length > 1) {
const interactionCollector = new InteractionCollector(client, currentPage, { time: timeout }); const interactionCollector = new InteractionCollector(client, currentPage, { time: timeout });
interactionCollector.on("interaction", async (msg, interaction, id, token, member) => { interactionCollector.on("interaction", async (interaction, id, token, member) => {
if (member === message.author.id) { if (member === message.author.id) {
switch (interaction) { switch (interaction) {
case "back": case "back":