remove paginator, it is extremely discord-specific
This commit is contained in:
parent
7a76609e70
commit
9539ea32cd
8 changed files with 27 additions and 277 deletions
|
@ -5,7 +5,6 @@ import parseCommand from "../utils/parseCommand.js";
|
|||
import { clean } from "../utils/misc.js";
|
||||
import sizeOf from "image-size";
|
||||
// import { upload } from "../utils/tempimages.js";
|
||||
// import { ThreadChannel } from "oceanic.js";
|
||||
|
||||
let mentionRegex;
|
||||
|
||||
|
@ -52,9 +51,9 @@ export default async function (matrixClient, event, room, toStartOfTimeline) {
|
|||
try {
|
||||
// parse args
|
||||
const parsed = parseCommand(preArgs);
|
||||
// if (database) {
|
||||
// await database.addCount(aliases.get(command) ?? command);
|
||||
// }
|
||||
if (database) {
|
||||
await database.addCount(aliases.get(command) ?? command);
|
||||
}
|
||||
const startTime = new Date();
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const commandClass = new cmd(matrixClient, { type: "classic", message: event.event, args: parsed._, content: text.replace(command, "").trim(), specialArgs: (({ _, ...o }) => o)(parsed) }); // we also provide the message content as a parameter for cases where we need more accuracy
|
||||
|
@ -70,7 +69,6 @@ export default async function (matrixClient, event, room, toStartOfTimeline) {
|
|||
console.log(err);
|
||||
});
|
||||
} else if (typeof result === "object") {
|
||||
// console.log(result)
|
||||
if (result.html) {
|
||||
const content = {
|
||||
format: "org.matrix.custom.html",
|
||||
|
@ -105,16 +103,13 @@ export default async function (matrixClient, event, room, toStartOfTimeline) {
|
|||
width: result.width,
|
||||
height: result.height
|
||||
}
|
||||
// if (mime === "jpg") {
|
||||
// mime = "jpeg";
|
||||
// }
|
||||
await matrixClient.sendImageMessage(event.event.room_id, mxcUri.content_uri, {h: imgsize.height, w: imgsize.width, mimetype: `image/${mime}`, size: result.contents.length, thumbnail_info: {h: imgsize.height, w: imgsize.width, mimetype: `image/${mime}`, size: result.contents.length}}, result.name)
|
||||
}
|
||||
} else {
|
||||
// await client.rest.channels.createMessage(message.channelID, Object.assign(result, reference));
|
||||
// no-op
|
||||
}
|
||||
} else {
|
||||
// console.log(typeof result)
|
||||
// no-op
|
||||
}
|
||||
} catch (error) {
|
||||
logger.log("error", error.stack)
|
||||
|
@ -129,34 +124,6 @@ export default async function (matrixClient, event, room, toStartOfTimeline) {
|
|||
} catch (e) {
|
||||
_error(`While attempting to send the previous error message, another error occurred: ${e.stack || e}`);
|
||||
}
|
||||
// if (error.toString().includes("Request entity too large")) {
|
||||
// await client.rest.channels.createMessage(event.event.room_id, Object.assign({
|
||||
// content: "The resulting file was too large to upload. Try again with a smaller image if possible."
|
||||
// }, reference));
|
||||
// } else if (error.toString().includes("Job ended prematurely")) {
|
||||
// await client.rest.channels.createMessage(event.event.room_id, Object.assign({
|
||||
// content: "Something happened to the image servers before I could receive the image. Try running your command again."
|
||||
// }, reference));
|
||||
// } else if (error.toString().includes("Timed out")) {
|
||||
// await client.rest.channels.createMessage(event.event.room_id, Object.assign({
|
||||
// content: "The request timed out before I could download that image. Try uploading your image somewhere else or reducing its size."
|
||||
// }, reference));
|
||||
// } else {
|
||||
// _error(`Error occurred with command message ${event.event.content.body}: ${error.stack || error}`);
|
||||
// try {
|
||||
// let err = error;
|
||||
// if (error?.constructor?.name == "Promise") err = await error;
|
||||
// await client.rest.channels.createMessage(event.event.room_id, Object.assign({
|
||||
// content: "Uh oh! I ran into an error while running this command. Please report the content of the attached file at the following link or on the esmBot Support server: <https://github.com/esmBot/esmBot/issues>",
|
||||
// files: [{
|
||||
// contents: `Message: ${clean(err)}\n\nStack Trace: ${clean(err.stack)}`,
|
||||
// name: "error.txt"
|
||||
// }]
|
||||
// }, reference));
|
||||
// } catch (e) {
|
||||
// _error(`While attempting to send the previous error message, another error occurred: ${e.stack || e}`);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue