Fixed pagination jump limit, fixed debug logging

This commit is contained in:
Essem 2022-03-10 14:24:03 -06:00
parent 5b2f355c9c
commit 3ffb7f4949
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
3 changed files with 6 additions and 8 deletions

4
app.js
View file

@ -129,7 +129,7 @@ if (isMaster) {
new winston.transports.File({ filename: "logs/error.log", level: "error" }),
new winston.transports.File({ filename: "logs/main.log" })
],
level: "main",
level: process.env.DEBUG_LOG ? "debug" : "main",
format: winston.format.combine(
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
winston.format.printf((info) => {
@ -145,7 +145,7 @@ if (isMaster) {
winston.addColors({
info: "green",
main: "gray",
debug: "purple",
debug: "magenta",
warn: "yellow",
error: "red"
});

View file

@ -2,7 +2,6 @@ import InteractionCollector from "./awaitinteractions.js";
import { ComponentInteraction } from "eris";
export default async (client, message, pages, timeout = 120000) => {
const manageMessages = message.channel.guild && message.channel.permissionsOf(client.user.id).has("manageMessages") ? true : false;
const options = {
messageReference: {
channelID: message.channel.id,
@ -82,13 +81,13 @@ export default async (client, message, pages, timeout = 120000) => {
break;
case "jump":
await interaction.deferUpdate();
const newComponents = JSON.parse(JSON.stringify(components));
var newComponents = JSON.parse(JSON.stringify(components));
for (const index of newComponents.components[0].components.keys()) {
newComponents.components[0].components[index].disabled = true;
}
currentPage = await currentPage.edit(newComponents);
interactionCollector.extend();
const jumpComponents = {
var jumpComponents = {
components: [{
type: 1,
components: [{
@ -99,7 +98,7 @@ export default async (client, message, pages, timeout = 120000) => {
}]
}]
};
for (let i = 0; i < pages.length; i++) {
for (let i = 0; i < pages.length && i < 25; i++) {
const payload = {
label: i + 1,
value: i

View file

@ -130,8 +130,7 @@ class ImageWorker extends BaseServiceWorker {
if (i < 2 && e === "Request ended prematurely due to a closed connection") {
continue;
} else {
if (e === "No available servers" && i >= 2) e = "Request ended prematurely due to a closed connection";
throw e;
if (e === "No available servers" && i >= 2) throw "Request ended prematurely due to a closed connection";
}
}
}