Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const axios = require("axios");
- const request = require("request");
- const fs = require("fs");
- module.exports.config = {
- name: "codm",
- version: "1",
- hasPermssion: 0,
- credits: "Eugene Aguilar",
- description: "Call of duty highlights video",
- commandCategory: "no prefix",
- usages: "...",
- cooldowns: 6,
- };
- const lugmok = "https://php-api.diciper09.repl.co";
- module.exports.handleEvent = async function ({ api, event }) {
- if (!(event.body.indexOf("codm") === 0 || event.body.indexOf("Codm") === 0))
- return;
- api.sendMessage(
- `⏱️ | 𝙑𝙞𝙙𝙚𝙤 𝙞𝙨 𝙨𝙚𝙣𝙙𝙞𝙣𝙜 𝙥𝙡𝙚𝙖𝙨𝙚 𝙬𝙖𝙞𝙩...`,
- event.threadID,
- event.messageID,
- );
- axios
- .get(`${lugmok}/codm/?apikey=omsimnida`)
- .then((res) => {
- const { url } = res.data;
- let ext = url.split(".").pop();
- let callback = function () {
- api.sendMessage(
- {
- body: `Call Of Duty Mobile`,
- attachment: fs.createReadStream(__dirname + `/cache/codm.${ext}`),
- },
- event.threadID,
- () => fs.unlinkSync(__dirname + `/cache/codm.${ext}`),
- event.messageID,
- );
- };
- request(res.data.url)
- .pipe(fs.createWriteStream(__dirname + `/cache/codm.${ext}`))
- .on("close", callback);
- })
- .catch((err) => {
- api.sendMessage(
- "error na bai maya naman",
- event.threadID,
- event.messageID,
- );
- api.setMessageReaction("❌", event.messageID, (err) => {}, true);
- });
- };
- module.exports.run = async function ({ api, event }) {
- api.sendMessage(
- `This command doesn't need a prefix`,
- event.threadID,
- event.messageID,
- );
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement