forked from nguynquminh/Module-Mirai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrash.js
25 lines (24 loc) · 1.11 KB
/
trash.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module.exports.config = {
name: "trash",
version: "1.0.0",
hasPermssion: 0,
credits: "Quang Minh",
description: "no description",
commandCategory: "Edit-img",
usages: "",
cooldowns: 5,
dependencies: {"fs-extra": "","discord.js": "","discord-image-generation" :"","node-superfetch": ""}
};
module.exports.run = async ({ event, api, args, Users }) => {
const DIG = global.nodemodule["discord-image-generation"];
const Discord = global.nodemodule['discord.js'];
const request = global.nodemodule["node-superfetch"];
const fs = global.nodemodule["fs-extra"];
var id = Object.keys(event.mentions)[0] || event.senderID;
var avatar = (await request.get(`https://graph.facebook.com/${id}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`)).body;
let img = await new DIG.Trash().getImage(avatar);
let attach = new Discord.MessageAttachment(img);
var path_trash = __dirname + "/cache/trash.png";
fs.writeFileSync(path_trash, attach.attachment);
api.sendMessage({attachment: fs.createReadStream(path_trash)}, event.threadID, () => fs.unlinkSync(path_trash), event.messageID);
}