Skip to content

Commit

Permalink
feat: add image enhance command
Browse files Browse the repository at this point in the history
  • Loading branch information
xbnfz01 authored Feb 5, 2024
1 parent b39ac59 commit 04e7090
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/commands/converter/enhance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { ConfigCommands } from "../../types/structure/commands";
import { enhanceImage } from "../../utils/scrapers/converter/enhance";

export default <ConfigCommands>{
name: "enhance",
alias: ["remini", "tohd"],
usage: "<reply>",
category: "converter",
description: "Convert image to HD quality",
limit: 4,
cooldown: 10,
isPremium: true,
isProcess: true,
async run({ Chisato, from, message }) {
try {
const { quoted } = message;
const buffer = quoted ? await quoted.download() : await message.download();

if (buffer && (message.type === "imageMessage" || quoted?.type === "imageMessage")) {
const remini = await enhanceImage(buffer, "enhance");
await Chisato.sendImage(from, remini, null, message);
} else {
await Chisato.sendText(
from,
"*「 ! 」* Please reply to the image you want to enhance",
message
);
}
} catch (error) {
console.error(error); // Log the error for debugging
await Chisato.sendText(
from,
"*「 ! 」* An error occurred. Please report it to the bot creator immediately!",
message
);
}
},
};

0 comments on commit 04e7090

Please sign in to comment.