2022-01-13 00:56:24 +05:00
|
|
|
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-01-05 00:24:57 +05:00
|
|
|
|
|
|
|
message.channel.send({
|
|
|
|
files: [{
|
|
|
|
attachment: buffer
|
|
|
|
}]
|
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
2022-01-14 01:12:46 +05:00
|
|
|
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;
|