-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathhack.js
More file actions
91 lines (80 loc) · 4.33 KB
/
Copy pathhack.js
File metadata and controls
91 lines (80 loc) · 4.33 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const axios = require("axios");
const fs = require("fs-extra");
const path = require("path");
const mahmhd = async () => {
const base = await axios.get("https://raw.githubusercontent.com/mahmudx7/HINATA/main/baseApiUrl.json");
return base.data.mahmud;
};
module.exports = {
config: {
name: "hack",
version: "1.7",
author: "MahMUD",
countDown: 5,
role: 0,
description: {
bn: "কাউকে হ্যাক করার প্র্যাঙ্ক ছবি তৈরি করুন",
en: "Create a prank hack image of someone"
},
category: "fun",
guide: {
bn: ' {pn} <@tag>: কাউকে ট্যাগ করে হ্যাক করুন'
+ '\n {pn} <uid>: UID এর মাধ্যমে হ্যাক করুন'
+ '\n (অথবা কারো মেসেজে রিপ্লাই দিয়ে এটি ব্যবহার করুন)',
en: ' {pn} <@tag>: Hack a tagged user'
+ '\n {pn} <uid>: Hack by UID'
+ '\n (Or reply to someone\'s message)'
}
},
langs: {
bn: {
success: "✅ এই ইউজারকে সফলভাবে হ্যাক করা হয়েছে: %1",
error: "× হ্যাক করতে গিয়ে সমস্যা হয়েছে: %1। প্রয়োজনে Contact MahMUD।"
},
en: {
success: "✅ Successfully Hacked This User: %1",
error: "× Failed to hack: %1. Contact MahMUD for help."
}
},
onStart: async function ({ api, message, args, event, getLang }) {
const authorName = String.fromCharCode(77, 97, 104, 77, 85, 68);
if (this.config.author !== authorName) {
return api.sendMessage("You are not authorized to change the author name.", event.threadID, event.messageID);
}
const cacheDir = path.join(__dirname, "cache");
await fs.ensureDir(cacheDir);
const outPath = path.join(cacheDir, `hack_${Date.now()}.png`);
try {
let targetId = event.senderID;
if (event.messageReply) {
targetId = event.messageReply.senderID;
} else if (Object.keys(event.mentions).length > 0) {
targetId = Object.keys(event.mentions)[0];
} else if (args[0] && !isNaN(args[0])) {
targetId = args[0].trim();
}
let displayName = "User";
try {
const info = await api.getUserInfo([targetId]);
if (info && info[targetId]) {
displayName = info[targetId].name;
}
} catch (e) {
displayName = targetId;
}
const baseApi = await mahmhd();
const apiUrl = `${baseApi}/api/hack?id=${encodeURIComponent(targetId)}&name=${encodeURIComponent(displayName)}`;
const res = await axios.get(apiUrl, { responseType: "arraybuffer", timeout: 20000 });
await fs.writeFile(outPath, Buffer.from(res.data));
await message.reply({
body: getLang("success", displayName),
attachment: fs.createReadStream(outPath)
});
await fs.remove(outPath);
} catch (err) {
console.error("Error in hack command:", err);
if (fs.existsSync(outPath)) await fs.remove(outPath);
return message.reply(getLang("error", err.message));
}
}
};