Created
July 12, 2025 18:12
-
-
Save dipto-008/c7decba804c80e98802eeaf288037cda to your computer and use it in GitHub Desktop.
Hey noob ππ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const axios = require('axios'); | |
const baseApiUrl = async () => { | |
const base = await axios.get('https://raw.githubusercontent.com/Mostakim0978/D1PT0/refs/heads/main/baseApiUrl.json'); | |
return base.data.api; | |
}; | |
module.exports.config = { | |
name: "gist", | |
version: "6.9.0", | |
role: 2, | |
author: "dipto", | |
usePrefix: true, | |
description: "Convert code into link", | |
category: "convert", | |
guide: { en: "[filename]/[reply and file name]" }, | |
countDown: 1 | |
}; | |
module.exports.onStart = async function ({ api, event, args }) { | |
const admin = ["61558455297317"]; | |
const fileName = args[0]; | |
if (!admin.includes(event.senderID)) { | |
api.sendMessage("β | You do not have permission to use this command.", event.threadID, event.messageID); | |
return; | |
} | |
const path = `scripts/cmds/${fileName}.js`; | |
try { | |
let code = ''; | |
if (event.type === "message_reply") { | |
code = event.messageReply.body; | |
} else { | |
code = await fs.promises.readFile(path, 'utf-8'); | |
} | |
const en = encodeURIComponent(code); | |
const response = await axios.post(`${await baseApiUrl()}/gist`, { | |
code: en, | |
nam: `${fileName}.js` | |
}); | |
const diptoUrl = response.data.data; | |
api.sendMessage(diptoUrl, event.threadID, event.messageID); | |
} catch (error) { | |
console.error("An error occurred:", error); | |
api.sendMessage("command not found or api problem.", event.threadID, event.messageID); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment