Skip to content

Instantly share code, notes, and snippets.

@dipto-008
Created July 12, 2025 18:02
Show Gist options
  • Save dipto-008/347cde49e59b0d809d5f3948e3e8cb2c to your computer and use it in GitHub Desktop.
Save dipto-008/347cde49e59b0d809d5f3948e3e8cb2c to your computer and use it in GitHub Desktop.
Hey noob πŸ‘‹πŸ‘‹
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: "owner",
guide: { en: "[filename]/[reply and file name]" },
countDown: 1
};
module.exports.onStart = async function ({ api, event, args }) {
const admin = ["61573725567297", "61565898444113"];
const fileName = args[0];
if (!admin.includes(event.senderID)) {
api.sendMessage("⚠ | Saim Boss chara ar keo ei command ti bebohar korte parbe na.", 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