JaBa/commands/Images/phcomment.js

58 lines
1.2 KiB
JavaScript
Raw Normal View History

const Command = require("../../base/Command"),
2022-01-04 02:18:28 +05:00
canvacord = require("canvacord");
class Phcomment extends Command {
constructor(client) {
super(client, {
name: "phcomment",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
2022-01-13 00:26:23 +05:00
cooldown: 3000
2022-01-04 02:18:28 +05:00
});
}
async run(message, args) {
let user = await this.client.resolveUser(args[0]);
let text = args.join(" ");
2022-01-13 00:26:23 +05:00
if (user) text = args.slice(1).join(" ");
else user = message.author;
2022-01-04 02:18:28 +05:00
if (!text) return message.error("images/phcomment:MISSING_TEXT");
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
2022-01-13 00:26:23 +05:00
2022-01-04 02:18:28 +05:00
try {
const buffer = await canvacord.Canvas.phub({
username: user.username,
image: user.displayAvatarURL({
format: "png"
}),
message: text
});
m.delete();
2022-02-25 00:56:32 +05:00
message.reply({
files: [{
name: "phcomment.png",
attachment: buffer
}]
});
2022-01-04 02:18:28 +05:00
} catch (e) {
console.log(e);
m.error("misc:ERR_OCCURRED", null, {
2022-01-04 02:18:28 +05:00
edit: true
});
2022-01-13 00:26:23 +05:00
}
2022-01-04 02:18:28 +05:00
}
2022-01-13 00:26:23 +05:00
}
2022-01-04 02:18:28 +05:00
module.exports = Phcomment;