goat
command
toilet
No description
0
views
0
likes
0
installs
raw source
const axios = require("axios");
const fs = require("fs");
const path = require("path");
const baseApiUrl = async () => {
const base = await axios.get(
"https://raw.githubusercontent.com/mahmudx7/HINATA/main/baseApiUrl.json"
);
return base.data.mahmud;
};
/**
* @author MahMUD
* @author: do not delete it
*/
module.exports = {
config: {
name: "toilet",
version: "1.7",
author: "๐ฉ๐
๐๐ท๐พ๐๐ช ๐๐๐พ",
role: 0,
category: "fun",
cooldown: 10,
guide: "[mention/reply/UID]",
},
onStart: async function({ api, event, args }) {
const { senderID, mentions, threadID, messageID, messageReply } = event;
let id;
if (Object.keys(mentions).length > 0) {
id = Object.keys(mentions)[0];
} else if (messageReply) {
id = messageReply.senderID;
} else if (args[0]) {
id = args[0];
} else {
return api.sendMessage(
"โ Mention, reply, or give UID to make toilet someone",
threadID,
messageID
);
}
try {
const apiUrl = await baseApiUrl();
const url = `${apiUrl}/api/toilet?user=${id}`;
const response = await axios.get(url, { responseType: "arraybuffer" });
const filePath = path.join(__dirname, `toilet_${id}.png`);
fs.writeFileSync(filePath, response.data);
api.sendMessage(
{ attachment: fs.createReadStream(filePath), body: "เฆเงเฆพเฆ เฆฅเง ๐คฎ" },
threadID,
() => fs.unlinkSync(filePath),
messageID
);
} catch (err) {
api.sendMessage(`๐ฅนerror, contact ๐ฉ๐
๐๐ท๐พ๐๐ช ๐๐๐พ.`, threadID, messageID);
}
}
};