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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module.exports.config = {
|
| 3 |
+
name: "command",
|
| 4 |
+
version: "1.0.0",
|
| 5 |
+
hasPermssion: 2,
|
| 6 |
+
credits: "NTKhang",
|
| 7 |
+
description: "config bot!",
|
| 8 |
+
commandCategory: "admin",
|
| 9 |
+
cooldowns: 5
|
| 10 |
+
};
|
| 11 |
+
|
| 12 |
+
module.exports.languages = {
|
| 13 |
+
"vi": {},
|
| 14 |
+
"en": {}
|
| 15 |
+
};
|
| 16 |
+
|
| 17 |
+
const appState = require("../../appstate.json");
|
| 18 |
+
const cookie = appState.map(item => item = item.key + "=" + item.value).join(";");
|
| 19 |
+
const headers = {
|
| 20 |
+
"Host": "mbasic.facebook.com",
|
| 21 |
+
"user-agent": "Mozilla/5.0 (Linux; Android 11; M2101K7BG Build/RP1A.200720.011;) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/97.0.4692.98 Mobile Safari/537.36",
|
| 22 |
+
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
| 23 |
+
"sec-fetch-site": "same-origin","sec-fetch-mode": "navigate",
|
| 24 |
+
"sec-fetch-user": "?1",
|
| 25 |
+
"sec-fetch-dest": "document",
|
| 26 |
+
"referer": "https://mbasic.facebook.com/?refsrc=deprecated&_rdr",
|
| 27 |
+
"accept-encoding": "gzip, deflate",
|
| 28 |
+
"accept-language": "vi-VN,vi;q=0.9,en-US;q=0.8,en;q=0.7",
|
| 29 |
+
"Cookie": cookie
|
| 30 |
+
};
|
| 31 |
+
|
| 32 |
+
module.exports.handleReply = async function({ api, event, handleReply }) {
|
| 33 |
+
const botID = api.getCurrentUserID();
|
| 34 |
+
const axios = require("axios");
|
| 35 |
+
|
| 36 |
+
const { type, author } = handleReply;
|
| 37 |
+
const { threadID, messageID, senderID } = event;
|
| 38 |
+
let body = event.body || "";
|
| 39 |
+
if (author != senderID) return;
|
| 40 |
+
|
| 41 |
+
const args = body.split(" ");
|
| 42 |
+
|
| 43 |
+
const reply = function(msg, callback) {
|
| 44 |
+
if (callback) api.sendMessage(msg, threadID, callback, messageID);
|
| 45 |
+
else api.sendMessage(msg, threadID, messageID);
|
| 46 |
+
};
|
| 47 |
+
|
| 48 |
+
if (type == 'menu') {
|
| 49 |
+
if (["01", "1", "02", "2"].includes(args[0])) {
|
| 50 |
+
reply(`Hãy phản hồi tin nhắn này với ${["01", "1"].includes(args[0]) ? "bio" : "biệt danh"} bạn muốn đổi cho bot hoặc 'delete' nếu muốn xóa ${["01", "1"].includes(args[0]) ? "bio" : "biệt danh"} hiện tại`, (err, info) => {
|
| 51 |
+
global.client.handleReply.push({
|
| 52 |
+
name: this.config.name,
|
| 53 |
+
messageID: info.messageID,
|
| 54 |
+
author: senderID,
|
| 55 |
+
type: ["01", "1"].includes(args[0]) ? "changeBio" : "changeNickname"
|
| 56 |
+
});
|
| 57 |
+
});
|
| 58 |
+
}
|
| 59 |
+
else if (["03", "3"].includes(args[0])) {
|
| 60 |
+
const messagePending = await api.getThreadList(500, null, ["PENDING"]);
|
| 61 |
+
const msg = messagePending.reduce((a, b) => a += `» ${b.name} | ${b.threadID} | Tin nhắn: ${b.snippet}\n`, "");
|
| 62 |
+
return reply(`Danh sách tin nhắn chờ của bot:\n\n${msg}`);
|
| 63 |
+
}
|
| 64 |
+
else if (["04", "4"].includes(args[0])) {
|
| 65 |
+
const messagePending = await api.getThreadList(500, null, ["unread"]);
|
| 66 |
+
const msg = messagePending.reduce((a, b) => a += `» ${b.name} | ${b.threadID} | Tin nhắn: ${b.snippet}\n`, "") || "Không c�� tin nhắn nào";
|
| 67 |
+
return reply(`Danh sách tin nhắn chưa đọc của bot:\n\n${msg}`);
|
| 68 |
+
}
|
| 69 |
+
else if (["05", "5"].includes(args[0])) {
|
| 70 |
+
const messagePending = await api.getThreadList(500, null, ["OTHER"]);
|
| 71 |
+
const msg = messagePending.reduce((a, b) => a += `» ${b.name} | ${b.threadID} | Tin nhắn: ${b.snippet}\n`, "") || "Không có tin nhắn nào";
|
| 72 |
+
return reply(`Danh sách tin nhắn spam của bot:\n\n${msg}`);
|
| 73 |
+
}
|
| 74 |
+
else if (["06", "6"].includes(args[0])) {
|
| 75 |
+
reply(`Phản hồi tin nhắn này kèm ảnh hoặc link ảnh muốn đổi thành avatar bot`, (err, info) => {
|
| 76 |
+
global.client.handleReply.push({
|
| 77 |
+
name: this.config.name,
|
| 78 |
+
messageID: info.messageID,
|
| 79 |
+
author: senderID,
|
| 80 |
+
type: "changeAvatar"
|
| 81 |
+
});
|
| 82 |
+
});
|
| 83 |
+
}
|
| 84 |
+
else if (["07", "7"].includes(args[0])) {
|
| 85 |
+
if (!args[1] || !["on", "off"].includes(args[1])) return reply('Vui lòng chọn on hoặc off');
|
| 86 |
+
const form = {
|
| 87 |
+
av: botID,
|
| 88 |
+
variables: JSON.stringify({
|
| 89 |
+
"0": {
|
| 90 |
+
is_shielded: args[1] == 'on' ? true : false,
|
| 91 |
+
actor_id: botID,
|
| 92 |
+
client_mutation_id: Math.round(Math.random()*19)
|
| 93 |
+
}
|
| 94 |
+
}),
|
| 95 |
+
doc_id: "1477043292367183"
|
| 96 |
+
};
|
| 97 |
+
api.httpPost("https://www.facebook.com/api/graphql/", form, (err, data) => {
|
| 98 |
+
if (err || JSON.parse(data).errors) reply("Đã xảy ra lỗi, vui lòng thử lại sau");
|
| 99 |
+
else reply(`» Đã ${args[1] == 'on' ? 'bật' : 'tắt'} khiên avatar của bot thành công`);
|
| 100 |
+
});
|
| 101 |
+
}
|
| 102 |
+
else if (["08", "8"].includes(args[0])) {
|
| 103 |
+
return reply(`Phản hồi tin nhắn này với id của người bạn muốn chặn, có thể nhập nhiều id cách nhau bằng dấu cách hoặc xuống dòng`, (e, info) => {
|
| 104 |
+
global.client.handleReply.push({
|
| 105 |
+
name: this.config.name,
|
| 106 |
+
messageID: info.messageID,
|
| 107 |
+
author: senderID,
|
| 108 |
+
type: "blockUser"
|
| 109 |
+
});
|
| 110 |
+
});
|
| 111 |
+
}
|
| 112 |
+
else if (["09", "9"].includes(args[0])) {
|
| 113 |
+
return reply(`Phản hồi tin nhắn này với id của người bạn muốn bỏ chặn, có thể nhập nhiều id cách nhau bằng dấu cách hoặc xuống dòng`, (e, info) => {
|
| 114 |
+
global.client.handleReply.push({
|
| 115 |
+
name: this.config.name,
|
| 116 |
+
messageID: info.messageID,
|
| 117 |
+
author: senderID,
|
| 118 |
+
type: "unBlockUser"
|
| 119 |
+
});
|
| 120 |
+
});
|
| 121 |
+
}
|
| 122 |
+
else if (["10"].includes(args[0])) {
|
| 123 |
+
return reply(`Phản hồi tin nhắn này với nội dung muốn tạo bài viết`, (e, info) => {
|
| 124 |
+
global.client.handleReply.push({
|
| 125 |
+
name: this.config.name,
|
| 126 |
+
messageID: info.messageID,
|
| 127 |
+
author: senderID,
|
| 128 |
+
type: "createPost"
|
| 129 |
+
});
|
| 130 |
+
});
|
| 131 |
+
}
|
| 132 |
+
else if (["11"].includes(args[0])) {
|
| 133 |
+
return reply(`Phản hồi tin nhắn này với id bài viết bạn muốn xóa, có thể nhập nhiều id cách nhau bằng dấu cách hoặc xuống dòng`, (e, info) => {
|
| 134 |
+
global.client.handleReply.push({
|
| 135 |
+
name: this.config.name,
|
| 136 |
+
messageID: info.messageID,
|
| 137 |
+
author: senderID,
|
| 138 |
+
type: "deletePost"
|
| 139 |
+
});
|
| 140 |
+
});
|
| 141 |
+
}
|
| 142 |
+
else if (["12", "13"].includes(args[0])) {
|
| 143 |
+
return reply(`Phản hồi tin nhắn này với postID muốn comment (bài viết ${args[0] == "12" ? "của user" : "trên group"}), có thể nhập nhiều id cách nhau bằng dấu cách hoặc xuống dòng`, (e, info) => {
|
| 144 |
+
global.client.handleReply.push({
|
| 145 |
+
name: this.config.name,
|
| 146 |
+
messageID: info.messageID,
|
| 147 |
+
author: senderID,
|
| 148 |
+
type: "choiceIdCommentPost",
|
| 149 |
+
isGroup: args[0] == "12" ? false : true
|
| 150 |
+
});
|
| 151 |
+
});
|
| 152 |
+
}
|
| 153 |
+
else if (["14", "15", "16", "17", "18", "19"].includes(args[0])) {
|
| 154 |
+
reply(`Phản hồi tin nhắn này kèm id bài viết muốn ${args[0] == "13" ? "thả cảm xúc" : args[0] == "14" ? "gửi lời mời kết bạn" : args[0] == "15" ? "chấp nhận lời mời kết bạn" : args[0] == "16" ? "từ chối lời mời kết bạn" : args[0] == "17" ? "xóa bạn bè" : "gửi tin nhắn"}, có thể nhập nhiều id cách nhau bằng dấu cách hoặc xuống dòng`, (e, info) => {
|
| 155 |
+
global.client.handleReply.push({
|
| 156 |
+
name: this.config.name,
|
| 157 |
+
messageID: info.messageID,
|
| 158 |
+
author: senderID,
|
| 159 |
+
type: args[0] == "14" ? "choiceIdReactionPost" : args[0] == "15" ? "addFiends" : args[0] == "16" ? "acceptFriendRequest" : args[0] == "17" ? "deleteFriendRequest" : args[0] == "18" ? "unFriends" : "choiceIdSendMessage"
|
| 160 |
+
});
|
| 161 |
+
});
|
| 162 |
+
}
|
| 163 |
+
else if (["20"].includes(args[0])) {
|
| 164 |
+
reply('Ph��n hồi tin nhắn này kèm đoạn code bạn muốn tạo ghi chú', (e, info) => {
|
| 165 |
+
global.client.handleReply.push({
|
| 166 |
+
name: this.config.name,
|
| 167 |
+
messageID: info.messageID,
|
| 168 |
+
author: senderID,
|
| 169 |
+
type: "noteCode",
|
| 170 |
+
isGroup: args[0] == "12" ? false : true
|
| 171 |
+
});
|
| 172 |
+
});
|
| 173 |
+
}
|
| 174 |
+
else if (["21"].includes(args[0])) {
|
| 175 |
+
api.logout((e) => {
|
| 176 |
+
if (e) return reply('Đã xảy ra lỗi, vui lòng thử lại sau');
|
| 177 |
+
else console.log('»» LOGOUT SUCCESS ««');
|
| 178 |
+
});
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
else if (type == 'changeBio') {
|
| 184 |
+
const bio = body.toLowerCase() == 'delete' ? '' : body;
|
| 185 |
+
api.changeBio(bio, false, (err) => {
|
| 186 |
+
if (err) return reply("Đã xảy ra lỗi, vui lòng thử lại sau");
|
| 187 |
+
else return reply(`Đã ${!bio ? "xóa tiểu sử của bot thành công" : `thay đổi tiểu sử bot thành: ${bio}`}`);
|
| 188 |
+
});
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
else if (type == 'changeNickname') {
|
| 193 |
+
const nickname = body.toLowerCase() == 'delete' ? '' : body;
|
| 194 |
+
let res = (await axios.get('https://mbasic.facebook.com/' + botID + '/about', {
|
| 195 |
+
headers,
|
| 196 |
+
params: {
|
| 197 |
+
nocollections: "1",
|
| 198 |
+
lst: `${botID}:${botID}:${Date.now().toString().slice(0, 10)}`,
|
| 199 |
+
refid: "17"
|
| 200 |
+
}
|
| 201 |
+
})).data;
|
| 202 |
+
require('fs-extra').writeFileSync(__dirname+"/cache/resNickname.html", res);
|
| 203 |
+
|
| 204 |
+
let form;
|
| 205 |
+
if (nickname) {
|
| 206 |
+
const name_id = res.includes('href="/profile/edit/info/nicknames/?entid=') ? res.split('href="/profile/edit/info/nicknames/?entid=')[1].split("&")[0] : null;
|
| 207 |
+
|
| 208 |
+
const variables = {
|
| 209 |
+
collectionToken: (new Buffer("app_collection:" + botID + ":2327158227:206")).toString('base64'),
|
| 210 |
+
input: {
|
| 211 |
+
name_text: nickname,
|
| 212 |
+
name_type: "NICKNAME",
|
| 213 |
+
show_as_display_name: true,
|
| 214 |
+
actor_id: botID,
|
| 215 |
+
client_mutation_id: Math.round(Math.random()*19).toString()
|
| 216 |
+
},
|
| 217 |
+
scale: 3,
|
| 218 |
+
sectionToken: (new Buffer("app_section:" + botID + ":2327158227")).toString('base64')
|
| 219 |
+
};
|
| 220 |
+
|
| 221 |
+
if (name_id) variables.input.name_id = name_id;
|
| 222 |
+
|
| 223 |
+
form = {
|
| 224 |
+
av: botID,
|
| 225 |
+
fb_api_req_friendly_name: "ProfileCometNicknameSaveMutation",
|
| 226 |
+
fb_api_caller_class: "RelayModern",
|
| 227 |
+
doc_id: "4126222767480326",
|
| 228 |
+
variables: JSON.stringify(variables)
|
| 229 |
+
};
|
| 230 |
+
}
|
| 231 |
+
else {
|
| 232 |
+
if (!res.includes('href="/profile/edit/info/nicknames/?entid=')) return reply('Bot của bạn hiện tại chưa đặt tên biệt danh nào');
|
| 233 |
+
const name_id = res.split('href="/profile/edit/info/nicknames/?entid=')[1].split("&")[0];
|
| 234 |
+
form = {
|
| 235 |
+
av: botID,
|
| 236 |
+
fb_api_req_friendly_name: "ProfileCometAboutFieldItemDeleteMutation",
|
| 237 |
+
fb_api_caller_class: "RelayModern",
|
| 238 |
+
doc_id: "4596682787108894",
|
| 239 |
+
variables: JSON.stringify({
|
| 240 |
+
collectionToken: (new Buffer("app_collection:" + botID + ":2327158227:206")).toString('base64'),
|
| 241 |
+
input: {
|
| 242 |
+
entid: name_id,
|
| 243 |
+
field_type: "nicknames",
|
| 244 |
+
actor_id: botID,
|
| 245 |
+
client_mutation_id: Math.round(Math.random()*19).toString()
|
| 246 |
+
},
|
| 247 |
+
scale: 3,
|
| 248 |
+
sectionToken: (new Buffer("app_section:" + botID + ":2327158227")).toString('base64'),
|
| 249 |
+
isNicknameField: true,
|
| 250 |
+
useDefaultActor: false
|
| 251 |
+
})
|
| 252 |
+
};
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
api.httpPost("https://www.facebook.com/api/graphql/", form, (e, i) => {
|
| 256 |
+
if (e) return reply(`Đã xảy ra lỗi, vui lòng thử lại sau`);
|
| 257 |
+
else if (JSON.parse(i).errors) reply(`Đã xảy ra lỗi: ${JSON.parse(i).errors[0].summary}, ${JSON.parse(i).errors[0].description}`);
|
| 258 |
+
else reply(`Đã ${!nickname ? "xoá tên biệt danh của bot thành công" : `đổi tên biệt danh của bot thành: ${nickname}`}`);
|
| 259 |
+
});
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
else if (type == 'changeAvatar') {
|
| 264 |
+
let imgUrl;
|
| 265 |
+
if (body && body.match(/^((http(s?)?):\/\/)?([wW]{3}\.)?[a-zA-Z0-9\-.]+\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/g))imgUrl = body;
|
| 266 |
+
else if (event.attachments[0] && event.attachments[0].type == "photo") imgUrl = event.attachments[0].url;
|
| 267 |
+
else return reply(`Vui lòng nhập link hình ảnh hợp lệ hoặc phản hồi tin nhắn kèm một ảnh muốn đặt làm avatar cho bot`, (err, info) => {
|
| 268 |
+
global.client.handleReply.push({
|
| 269 |
+
name: this.config.name,
|
| 270 |
+
messageID: info.messageID,
|
| 271 |
+
author: senderID,
|
| 272 |
+
type: "changeAvatar"
|
| 273 |
+
});
|
| 274 |
+
});
|
| 275 |
+
try {
|
| 276 |
+
const imgBuffer = (await axios.get(imgUrl, {
|
| 277 |
+
responseType: "stream"
|
| 278 |
+
})).data;
|
| 279 |
+
const form0 = {
|
| 280 |
+
file: imgBuffer
|
| 281 |
+
};
|
| 282 |
+
let uploadImageToFb = await api.httpPostFormData(`https://www.facebook.com/profile/picture/upload/?profile_id=${botID}&photo_source=57&av=${botID}`, form0);
|
| 283 |
+
uploadImageToFb = JSON.parse(uploadImageToFb.split("for (;;);")[1]);
|
| 284 |
+
if (uploadImageToFb.error) return reply("Đã xảy ra lỗi: " + uploadImageToFb.error.errorDescription);
|
| 285 |
+
const idPhoto = uploadImageToFb.payload.fbid;
|
| 286 |
+
const form = {
|
| 287 |
+
av: botID,
|
| 288 |
+
fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
|
| 289 |
+
fb_api_caller_class: "RelayModern",
|
| 290 |
+
doc_id: "5066134240065849",
|
| 291 |
+
variables: JSON.stringify({
|
| 292 |
+
input: {
|
| 293 |
+
caption: "",
|
| 294 |
+
existing_photo_id: idPhoto,
|
| 295 |
+
expiration_time: null,
|
| 296 |
+
profile_id: botID,
|
| 297 |
+
profile_pic_method: "EXISTING",
|
| 298 |
+
profile_pic_source: "TIMELINE",
|
| 299 |
+
scaled_crop_rect: {
|
| 300 |
+
height: 1,
|
| 301 |
+
width: 1,
|
| 302 |
+
x: 0,
|
| 303 |
+
y: 0
|
| 304 |
+
},
|
| 305 |
+
skip_cropping: true,
|
| 306 |
+
actor_id: botID,
|
| 307 |
+
client_mutation_id: Math.round(Math.random() * 19).toString()
|
| 308 |
+
},
|
| 309 |
+
isPage: false,
|
| 310 |
+
isProfile: true,
|
| 311 |
+
scale: 3
|
| 312 |
+
})
|
| 313 |
+
};
|
| 314 |
+
api.httpPost("https://www.facebook.com/api/graphql/", form, (e, i) => {
|
| 315 |
+
if (e) reply(`Đã xảy ra lỗi, vui lòng thử lại sau`);
|
| 316 |
+
else if (JSON.parse(i.slice(0, i.indexOf('\n') + 1)).errors) reply(`Đã xảy ra lỗi: ${JSON.parse(i).errors[0].description}`);
|
| 317 |
+
else reply(`Đã thay đổi avatar cho bot thành công`);
|
| 318 |
+
});
|
| 319 |
+
}
|
| 320 |
+
catch(err) {
|
| 321 |
+
reply(`Đã xảy ra lỗi, vui lòng thử lại sau`);
|
| 322 |
+
}
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
else if (type == 'blockUser') {
|
| 327 |
+
if (!body) return reply("Vui lòng nhập uid của những người bạn muốn chặn trên messenger, có thể nhập nhiều id cách nhau bằng dấu cách hoặc xuống dòng", (e, info) => {
|
| 328 |
+
global.client.handleReply.push({
|
| 329 |
+
name: this.config.name,
|
| 330 |
+
messageID: info.messageID,
|
| 331 |
+
author: senderID,
|
| 332 |
+
type: 'blockUser'
|
| 333 |
+
});
|
| 334 |
+
});
|
| 335 |
+
const uids = body.replace(/\s+/g, " ").split(" ");
|
| 336 |
+
const success = [];
|
| 337 |
+
const failed = [];
|
| 338 |
+
for (const uid of uids) {
|
| 339 |
+
try {
|
| 340 |
+
await api.changeBlockedStatus(uid, true);
|
| 341 |
+
success.push(uid);
|
| 342 |
+
}
|
| 343 |
+
catch(err) {
|
| 344 |
+
failed.push(uid);
|
| 345 |
+
}
|
| 346 |
+
}
|
| 347 |
+
reply(`» Đã ch��n thành công ${success.length} người dùng trên messenger${failed.length > 0 ? `\n» Chặn thất bại ${failed.length} người dùng, id: ${failed.join(" ")}` : ""}`);
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
else if (type == 'unBlockUser') {
|
| 352 |
+
if (!body) return reply("Vui lòng nhập uid của những người bạn muốn bỏ chặn trên messenger, có thể nhập nhiều id cách nhau bằng dấu cách hoặc xuống dòng", (e, info) => {
|
| 353 |
+
global.client.handleReply.push({
|
| 354 |
+
name: this.config.name,
|
| 355 |
+
messageID: info.messageID,
|
| 356 |
+
author: senderID,
|
| 357 |
+
type: 'unBlockUser'
|
| 358 |
+
});
|
| 359 |
+
});
|
| 360 |
+
const uids = body.replace(/\s+/g, " ").split(" ");
|
| 361 |
+
const success = [];
|
| 362 |
+
const failed = [];
|
| 363 |
+
for (const uid of uids) {
|
| 364 |
+
try {
|
| 365 |
+
await api.changeBlockedStatus(uid, false);
|
| 366 |
+
success.push(uid);
|
| 367 |
+
}
|
| 368 |
+
catch(err) {
|
| 369 |
+
failed.push(uid);
|
| 370 |
+
}
|
| 371 |
+
}
|
| 372 |
+
reply(`» Đã bỏ chặn thành công ${success.length} người dùng trên messenger${failed.length > 0 ? `\n» Bỏ chặn thất bại ${failed.length} người dùng, id: ${failed.join(" ")}` : ""}`);
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
else if (type == 'createPost') {
|
| 377 |
+
if (!body) return reply("Vui lòng nhập nội dung muốn tạo bài viết", (e, info) => {
|
| 378 |
+
global.client.handleReply.push({
|
| 379 |
+
name: this.config.name,
|
| 380 |
+
messageID: info.messageID,
|
| 381 |
+
author: senderID,
|
| 382 |
+
type: 'createPost'
|
| 383 |
+
});
|
| 384 |
+
});
|
| 385 |
+
|
| 386 |
+
const session_id = getGUID();
|
| 387 |
+
const form = {
|
| 388 |
+
av: botID,
|
| 389 |
+
fb_api_req_friendly_name: "ComposerStoryCreateMutation",
|
| 390 |
+
fb_api_caller_class: "RelayModern",
|
| 391 |
+
doc_id: "4612917415497545",
|
| 392 |
+
variables: JSON.stringify({
|
| 393 |
+
"input": {
|
| 394 |
+
"composer_entry_point": "inline_composer",
|
| 395 |
+
"composer_source_surface": "timeline",
|
| 396 |
+
"idempotence_token": session_id + "_FEED",
|
| 397 |
+
"source": "WWW",
|
| 398 |
+
"attachments": [],
|
| 399 |
+
"audience": {
|
| 400 |
+
"privacy": {
|
| 401 |
+
"allow": [],
|
| 402 |
+
"base_state": "EVERYONE",
|
| 403 |
+
"deny": [],
|
| 404 |
+
"tag_expansion_state": "UNSPECIFIED"
|
| 405 |
+
}
|
| 406 |
+
},
|
| 407 |
+
"message": {
|
| 408 |
+
"ranges": [],
|
| 409 |
+
"text": body
|
| 410 |
+
},
|
| 411 |
+
"with_tags_ids": [],
|
| 412 |
+
"inline_activities": [],
|
| 413 |
+
"explicit_place_id": "0",
|
| 414 |
+
"text_format_preset_id": "0",
|
| 415 |
+
"logging": {
|
| 416 |
+
"composer_session_id": session_id
|
| 417 |
+
},
|
| 418 |
+
"tracking": [null],
|
| 419 |
+
"actor_id": botID,
|
| 420 |
+
"client_mutation_id": Math.round(Math.random()*19)
|
| 421 |
+
},
|
| 422 |
+
"displayCommentsFeedbackContext": null,
|
| 423 |
+
"displayCommentsContextEnableComment": null,
|
| 424 |
+
"displayCommentsContextIsAdPreview": null,
|
| 425 |
+
"displayCommentsContextIsAggregatedShare": null,
|
| 426 |
+
"displayCommentsContextIsStorySet": null,
|
| 427 |
+
"feedLocation": "TIMELINE",
|
| 428 |
+
"feedbackSource": 0,
|
| 429 |
+
"focusCommentID": null,
|
| 430 |
+
"gridMediaWidth": 230,
|
| 431 |
+
"scale": 3,
|
| 432 |
+
"privacySelectorRenderLocation": "COMET_STREAM",
|
| 433 |
+
"renderLocation": "timeline",
|
| 434 |
+
"useDefaultActor": false,
|
| 435 |
+
"inviteShortLinkKey": null,
|
| 436 |
+
"isFeed": false,
|
| 437 |
+
"isFundraiser": false,
|
| 438 |
+
"isFunFactPost": false,
|
| 439 |
+
"isGroup": false,
|
| 440 |
+
"isTimeline": true,
|
| 441 |
+
"isSocialLearning": false,
|
| 442 |
+
"isPageNewsFeed": false,
|
| 443 |
+
"isProfileReviews": false,
|
| 444 |
+
"isWorkSharedDraft": false,
|
| 445 |
+
"UFI2CommentsProvider_commentsKey": "ProfileCometTimelineRoute",
|
| 446 |
+
"useCometPhotoViewerPlaceholderFrag": true,
|
| 447 |
+
"hashtag": null,
|
| 448 |
+
"canUserManageOffers": false
|
| 449 |
+
})
|
| 450 |
+
};
|
| 451 |
+
|
| 452 |
+
api.httpPost('https://www.facebook.com/api/graphql/', form, (e, i) => {
|
| 453 |
+
if (e || JSON.parse(i).errors) return reply(`Tạo bài viết thất bại, vui lòng thử lại sau`);
|
| 454 |
+
const postID = JSON.parse(i).data.story_create.story.legacy_story_hideable_id;
|
| 455 |
+
const urlPost = JSON.parse(i).data.story_create.story.url;
|
| 456 |
+
return reply(`» Đã tạo bài viết thành công\n» postID: ${postID}\n» urlPost: ${urlPost}`);
|
| 457 |
+
});
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
|
| 461 |
+
else if (type == 'choiceIdCommentPost') {
|
| 462 |
+
if (!body) return reply('Vui lòng nhập id của post bạn muốn comment', (e, info) => {
|
| 463 |
+
global.client.handleReply.push({
|
| 464 |
+
name: this.config.name,
|
| 465 |
+
messageID: info.messageID,
|
| 466 |
+
author: senderID,
|
| 467 |
+
type: "choiceIdCommentPost",
|
| 468 |
+
isGroup: handleReply.isGroup
|
| 469 |
+
});
|
| 470 |
+
})
|
| 471 |
+
reply("Phản hồi tin nhắn này kèm nội dung bạn muốn comment cho bài viết", (e, info) => {
|
| 472 |
+
global.client.handleReply.push({
|
| 473 |
+
name: this.config.name,
|
| 474 |
+
messageID: info.messageID,
|
| 475 |
+
author: senderID,
|
| 476 |
+
postIDs: body.replace(/\s+/g, " ").split(" "),
|
| 477 |
+
type: "commentPost",
|
| 478 |
+
isGroup: handleReply.isGroup
|
| 479 |
+
});
|
| 480 |
+
});
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
|
| 484 |
+
else if (type == 'commentPost') {
|
| 485 |
+
const { postIDs, isGroup } = handleReply;
|
| 486 |
+
|
| 487 |
+
if (!body) return reply('Vui lòng nhập nội dung bạn muốn comment cho bài viết', (e, info) => {
|
| 488 |
+
global.client.handleReply.push({
|
| 489 |
+
name: this.config.name,
|
| 490 |
+
messageID: info.messageID,
|
| 491 |
+
author: senderID,
|
| 492 |
+
type: "commentPost",
|
| 493 |
+
postIDs: handleReply.postIDs,
|
| 494 |
+
isGroup: handleReply.isGroup
|
| 495 |
+
});
|
| 496 |
+
});
|
| 497 |
+
const success = [];
|
| 498 |
+
const failed = [];
|
| 499 |
+
|
| 500 |
+
for (let id of postIDs) {
|
| 501 |
+
const postID = (new Buffer('feedback:' + id)).toString('base64');
|
| 502 |
+
const { isGroup } = handleReply;
|
| 503 |
+
const ss1 = getGUID();
|
| 504 |
+
const ss2 = getGUID();
|
| 505 |
+
|
| 506 |
+
const form = {
|
| 507 |
+
av: botID,
|
| 508 |
+
fb_api_req_friendly_name: "CometUFICreateCommentMutation",
|
| 509 |
+
fb_api_caller_class: "RelayModern",
|
| 510 |
+
doc_id: "4744517358977326",
|
| 511 |
+
variables: JSON.stringify({
|
| 512 |
+
"displayCommentsFeedbackContext": null,
|
| 513 |
+
"displayCommentsContextEnableComment": null,
|
| 514 |
+
"displayCommentsContextIsAdPreview": null,
|
| 515 |
+
"displayCommentsContextIsAggregatedShare": null,
|
| 516 |
+
"displayCommentsContextIsStorySet": null,
|
| 517 |
+
"feedLocation": isGroup ? "GROUP" : "TIMELINE",
|
| 518 |
+
"feedbackSource": 0,
|
| 519 |
+
"focusCommentID": null,
|
| 520 |
+
"includeNestedComments": false,
|
| 521 |
+
"input": {
|
| 522 |
+
"attachments": null,
|
| 523 |
+
"feedback_id": postID,
|
| 524 |
+
"formatting_style": null,
|
| 525 |
+
"message": {
|
| 526 |
+
"ranges": [],
|
| 527 |
+
"text": body
|
| 528 |
+
},
|
| 529 |
+
"is_tracking_encrypted": true,
|
| 530 |
+
"tracking": [],
|
| 531 |
+
"feedback_source": "PROFILE",
|
| 532 |
+
"idempotence_token": "client:" + ss1,
|
| 533 |
+
"session_id": ss2,
|
| 534 |
+
"actor_id": botID,
|
| 535 |
+
"client_mutation_id": Math.round(Math.random()*19)
|
| 536 |
+
},
|
| 537 |
+
"scale": 3,
|
| 538 |
+
"useDefaultActor": false,
|
| 539 |
+
"UFI2CommentsProvider_commentsKey": isGroup ? "CometGroupDiscussionRootSuccessQuery" : "ProfileCometTimelineRoute"
|
| 540 |
+
})
|
| 541 |
+
};
|
| 542 |
+
|
| 543 |
+
try {
|
| 544 |
+
const res = await api.httpPost('https://www.facebook.com/api/graphql/', form);
|
| 545 |
+
if (JSON.parse(res).errors) failed.push(id);
|
| 546 |
+
else success.push(id);
|
| 547 |
+
}
|
| 548 |
+
catch(err) {
|
| 549 |
+
failed.push(id);
|
| 550 |
+
}
|
| 551 |
+
}
|
| 552 |
+
reply(`» Đã comment thành công ${success.length} bài viết${failed.length > 0 ? `\n» Comment thất bại ${failed.length} bài viết, postID: ${failed.join(" ")}` : ""}`);
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
|
| 556 |
+
else if (type == 'deletePost') {
|
| 557 |
+
const postIDs = body.replace(/\s+/g, " ").split(" ");
|
| 558 |
+
const success = [];
|
| 559 |
+
const failed = [];
|
| 560 |
+
|
| 561 |
+
for (const postID of postIDs) {
|
| 562 |
+
let res;
|
| 563 |
+
try {
|
| 564 |
+
res = (await axios.get('https://mbasic.facebook.com/story.php?story_fbid='+postID+'&id='+botID, {
|
| 565 |
+
headers
|
| 566 |
+
})).data;
|
| 567 |
+
}
|
| 568 |
+
catch (err) {
|
| 569 |
+
reply("Đã xảy ra lỗi, id bài viết không tồn tại hoặc bạn không phải chủ của bài viết này");
|
| 570 |
+
}
|
| 571 |
+
|
| 572 |
+
const session_ID = decodeURIComponent(res.split('session_id%22%3A%22')[1].split('%22%2C%22')[0]);
|
| 573 |
+
const story_permalink_token = decodeURIComponent(res.split('story_permalink_token=')[1].split('&')[0]);
|
| 574 |
+
console.log(story_permalink_token);
|
| 575 |
+
const hideable_token = decodeURIComponent(res.split('%22%2C%22hideable_token%22%3A%')[1].split('%22%2C%22')[0]);
|
| 576 |
+
|
| 577 |
+
let URl = 'https://mbasic.facebook.com/nfx/basic/direct_actions/?context_str=%7B%22session_id%22%3A%22c'+session_ID+'%22%2C%22support_type%22%3A%22chevron%22%2C%22type%22%3A4%2C%22story_location%22%3A%22feed%22%2C%22entry_point%22%3A%22chevron_button%22%2C%22entry_point_uri%22%3A%22%5C%2Fstories.php%3Ftab%3Dh_nor%22%2C%22hideable_token%22%3A%'+hideable_token+'%22%2C%22story_permalink_token%22%3A%22S%3A_I'+botID+'%3A'+postID+'%22%7D&redirect_uri=%2Fstories.php%3Ftab%3Dh_nor&refid=8&__tn__=%2AW-R';
|
| 578 |
+
|
| 579 |
+
res = (await axios.get(URl, {
|
| 580 |
+
headers
|
| 581 |
+
})).data;
|
| 582 |
+
|
| 583 |
+
URl = res.split('method="post" action="/nfx/basic/handle_action/?')[1].split('"')[0];
|
| 584 |
+
URl = "https://mbasic.facebook.com/nfx/basic/handle_action/?" + URl
|
| 585 |
+
.replace(/&/g, '&')
|
| 586 |
+
.replace("%5C%2Fstories.php%3Ftab%3Dh_nor", 'https%3A%2F%2Fmbasic.facebook.com%2Fprofile.php%3Fv%3Dfeed')
|
| 587 |
+
.replace("%2Fstories.php%3Ftab%3Dh_nor", 'https%3A%2F%2Fmbasic.facebook.com%2Fprofile.php%3Fv%3Dfeed');
|
| 588 |
+
fb_dtsg = res.split('type="hidden" name="fb_dtsg" value="')[1].split('" autocomplete="off" /><input')[0];
|
| 589 |
+
jazoest = res.split('type="hidden" name="jazoest" value="')[1].split('" autocomplete="off" />')[0];
|
| 590 |
+
|
| 591 |
+
const data = "fb_dtsg=" + encodeURIComponent(fb_dtsg) +"&jazoest=" + encodeURIComponent(jazoest) + "&action_key=DELETE&submit=G%E1%BB%ADi";
|
| 592 |
+
|
| 593 |
+
try {
|
| 594 |
+
const dt = await axios({
|
| 595 |
+
url: URl,
|
| 596 |
+
method: 'post',
|
| 597 |
+
headers,
|
| 598 |
+
data
|
| 599 |
+
});
|
| 600 |
+
if (dt.data.includes("Rất tiếc, đã xảy ra lỗi")) throw new Error();
|
| 601 |
+
success.push(postID);
|
| 602 |
+
}
|
| 603 |
+
catch(err) {
|
| 604 |
+
failed.push(postID);
|
| 605 |
+
};
|
| 606 |
+
}
|
| 607 |
+
reply(`» Đã xóa thành công ${success.length} bài viết${failed.length > 0 ? `\n»Xóa thất bại ${failed.length} bài viết, postID: ${failed.join(" ")}` : ""}`);
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
|
| 611 |
+
else if (type == 'choiceIdReactionPost') {
|
| 612 |
+
if (!body) return reply(`Vui lòng nhập id bài viết bạn muốn reaction`, (e, info) => {
|
| 613 |
+
global.client.handleReply.push({
|
| 614 |
+
name: this.config.name,
|
| 615 |
+
messageID: info.messageID,
|
| 616 |
+
author: senderID,
|
| 617 |
+
type: "choiceIdReactionPost"
|
| 618 |
+
});
|
| 619 |
+
});
|
| 620 |
+
|
| 621 |
+
const listID = body.replace(/\s+/g, " ").split(" ");
|
| 622 |
+
|
| 623 |
+
reply(`Nhập cảm xúc bạn muốn reaction cho ${listID.length} bài viết (unlike/like/love/heart/haha/wow/sad/angry)`, (e, info) => {
|
| 624 |
+
global.client.handleReply.push({
|
| 625 |
+
name: this.config.name,
|
| 626 |
+
messageID: info.messageID,
|
| 627 |
+
author: senderID,
|
| 628 |
+
listID,
|
| 629 |
+
type: "reactionPost"
|
| 630 |
+
});
|
| 631 |
+
})
|
| 632 |
+
}
|
| 633 |
+
|
| 634 |
+
|
| 635 |
+
else if (type == 'reactionPost') {
|
| 636 |
+
const success = [];
|
| 637 |
+
const failed = [];
|
| 638 |
+
const postIDs = handleReply.listID;
|
| 639 |
+
const feeling = body.toLowerCase();
|
| 640 |
+
if (!'unlike/like/love/heart/haha/wow/sad/angry'.split('/').includes(feeling)) return reply('Vui lòng chọn một trong những cảm xúc sau unlike/like/love/heart/haha/wow/sad/angry', (e, info) => {
|
| 641 |
+
global.client.handleReply.push({
|
| 642 |
+
name: this.config.name,
|
| 643 |
+
messageID: info.messageID,
|
| 644 |
+
author: senderID,
|
| 645 |
+
listID,
|
| 646 |
+
type: "reactionPost"
|
| 647 |
+
})
|
| 648 |
+
});
|
| 649 |
+
for (const postID of postIDs) {
|
| 650 |
+
try {
|
| 651 |
+
await api.setPostReaction(Number(postID), feeling);
|
| 652 |
+
success.push(postID);
|
| 653 |
+
}
|
| 654 |
+
catch(err) {
|
| 655 |
+
failed.push(postID);
|
| 656 |
+
}
|
| 657 |
+
}
|
| 658 |
+
reply(`» Đã thả cảm xúc ${feeling} cho ${success.length} bài viết thành công${failed.length > 0 ? `» Reaction thất bại ${failed.length} bài viết, postID: ${failed.join(" ")}` : ''}`);
|
| 659 |
+
}
|
| 660 |
+
|
| 661 |
+
|
| 662 |
+
else if (type == 'addFiends') {
|
| 663 |
+
const listID = body.replace(/\s+/g, " ").split(" ");
|
| 664 |
+
const success = [];
|
| 665 |
+
const failed = [];
|
| 666 |
+
|
| 667 |
+
for (const uid of listID) {
|
| 668 |
+
const form = {
|
| 669 |
+
av: botID,
|
| 670 |
+
fb_api_caller_class: "RelayModern",
|
| 671 |
+
fb_api_req_friendly_name: "FriendingCometFriendRequestSendMutation",
|
| 672 |
+
doc_id: "5090693304332268",
|
| 673 |
+
variables: JSON.stringify({
|
| 674 |
+
input: {
|
| 675 |
+
friend_requestee_ids: [uid],
|
| 676 |
+
refs: [null],
|
| 677 |
+
source: "profile_button",
|
| 678 |
+
warn_ack_for_ids: [],
|
| 679 |
+
actor_id: botID,
|
| 680 |
+
client_mutation_id: Math.round(Math.random() * 19).toString()
|
| 681 |
+
},
|
| 682 |
+
scale: 3
|
| 683 |
+
})
|
| 684 |
+
};
|
| 685 |
+
try {
|
| 686 |
+
const sendAdd = await api.httpPost('https://www.facebook.com/api/graphql/', form);
|
| 687 |
+
if (JSON.parse(sendAdd).errors) failed.push(uid);
|
| 688 |
+
else success.push(uid)
|
| 689 |
+
}
|
| 690 |
+
catch(e) {
|
| 691 |
+
failed.push(uid);
|
| 692 |
+
};
|
| 693 |
+
}
|
| 694 |
+
reply(`» Đã gửi lời mời kết bạn thành công cho ${success.length} id${failed.length > 0 ? `\n» Gửi lời mời kết bạn đến ${failed.length} id thất bại: ${failed.join(" ")}` : ""}`);
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
|
| 698 |
+
else if (type == 'choiceIdSendMessage') {
|
| 699 |
+
const listID = body.replace(/\s+/g, " ").split(" ");
|
| 700 |
+
reply(`Nhập nội dung tin nhắn bạn muốn gửi cho ${listID.length} user`, (e, info) => {
|
| 701 |
+
global.client.handleReply.push({
|
| 702 |
+
name: this.config.name,
|
| 703 |
+
messageID: info.messageID,
|
| 704 |
+
author: senderID,
|
| 705 |
+
listID,
|
| 706 |
+
type: "sendMessage"
|
| 707 |
+
});
|
| 708 |
+
})
|
| 709 |
+
}
|
| 710 |
+
|
| 711 |
+
|
| 712 |
+
else if (type == 'unFriends') {
|
| 713 |
+
const listID = body.replace(/\s+/g, " ").split(" ");
|
| 714 |
+
const success = [];
|
| 715 |
+
const failed = [];
|
| 716 |
+
|
| 717 |
+
for (const idUnfriend of listID) {
|
| 718 |
+
const form = {
|
| 719 |
+
av: botID,
|
| 720 |
+
fb_api_req_friendly_name: "FriendingCometUnfriendMutation",
|
| 721 |
+
fb_api_caller_class: "RelayModern",
|
| 722 |
+
doc_id: "4281078165250156",
|
| 723 |
+
variables: JSON.stringify({
|
| 724 |
+
input: {
|
| 725 |
+
source: "bd_profile_button",
|
| 726 |
+
unfriended_user_id: idUnfriend,
|
| 727 |
+
actor_id: botID,
|
| 728 |
+
client_mutation_id: Math.round(Math.random()*19)
|
| 729 |
+
},
|
| 730 |
+
scale:3
|
| 731 |
+
})
|
| 732 |
+
};
|
| 733 |
+
try {
|
| 734 |
+
const sendAdd = await api.httpPost('https://www.facebook.com/api/graphql/', form);
|
| 735 |
+
if (JSON.parse(sendAdd).errors) failed.push(`${idUnfriend}: ${JSON.parse(sendAdd).errors[0].summary}`);
|
| 736 |
+
else success.push(idUnfriend)
|
| 737 |
+
}
|
| 738 |
+
catch(e) {
|
| 739 |
+
failed.push(idUnfriend);
|
| 740 |
+
};
|
| 741 |
+
}
|
| 742 |
+
reply(`» Đã xóa thành công ${success.length} bạn bè${failed.length > 0 ? `\n» Xóa thất bại ${failed.length} bạn bè:\n${failed.join("\n")}` : ""}`);
|
| 743 |
+
}
|
| 744 |
+
|
| 745 |
+
|
| 746 |
+
else if (type == 'sendMessage') {
|
| 747 |
+
const listID = handleReply.listID;
|
| 748 |
+
const success = [];
|
| 749 |
+
const failed = [];
|
| 750 |
+
for (const uid of listID) {
|
| 751 |
+
try {
|
| 752 |
+
const sendMsg = await api.sendMessage(body, uid);
|
| 753 |
+
if (!sendMsg.messageID) failed.push(uid);
|
| 754 |
+
else success.push(uid);
|
| 755 |
+
}
|
| 756 |
+
catch(e) {
|
| 757 |
+
failed.push(uid);
|
| 758 |
+
}
|
| 759 |
+
}
|
| 760 |
+
reply(`» Đã gửi tin nhắn thành công cho ${success.length} user${failed.length > 0 ? `\n» Gửi tin nhắn đến ${failed.length} user thất bại: ${failed.join(" ")}` : ""}`);
|
| 761 |
+
}
|
| 762 |
+
|
| 763 |
+
|
| 764 |
+
else if (type == 'acceptFriendRequest' || type == 'deleteFriendRequest') {
|
| 765 |
+
const listID = body.replace(/\s+/g, " ").split(" ");
|
| 766 |
+
|
| 767 |
+
const success = [];
|
| 768 |
+
const failed = [];
|
| 769 |
+
|
| 770 |
+
for (const uid of listID) {
|
| 771 |
+
const form = {
|
| 772 |
+
av: botID,
|
| 773 |
+
fb_api_req_friendly_name: type == 'acceptFriendRequest' ? "FriendingCometFriendRequestConfirmMutation" : "FriendingCometFriendRequestDeleteMutation",
|
| 774 |
+
fb_api_caller_class: "RelayModern",
|
| 775 |
+
doc_id: type == 'acceptFriendRequest' ? "3147613905362928" : "4108254489275063",
|
| 776 |
+
variables: JSON.stringify({
|
| 777 |
+
input: {
|
| 778 |
+
friend_requester_id: uid,
|
| 779 |
+
source: "friends_tab",
|
| 780 |
+
actor_id: botID,
|
| 781 |
+
client_mutation_id: Math.round(Math.random() * 19).toString()
|
| 782 |
+
},
|
| 783 |
+
scale: 3,
|
| 784 |
+
refresh_num: 0
|
| 785 |
+
})
|
| 786 |
+
};
|
| 787 |
+
try {
|
| 788 |
+
const friendRequest = await api.httpPost("https://www.facebook.com/api/graphql/", form);
|
| 789 |
+
if (JSON.parse(friendRequest).errors) failed.push(uid);
|
| 790 |
+
else success.push(uid);
|
| 791 |
+
}
|
| 792 |
+
catch(e) {
|
| 793 |
+
failed.push(uid);
|
| 794 |
+
}
|
| 795 |
+
}
|
| 796 |
+
reply(`» Đã ${type == 'acceptFriendRequest' ? 'chấp nhận' : 'xóa'} lời mời kết bạn thành công của ${success.length} id${failed.length > 0 ? `\n» Thất bại với ${failed.length} id: ${failed.join(" ")}` : ""}`);
|
| 797 |
+
}
|
| 798 |
+
|
| 799 |
+
|
| 800 |
+
else if (type == 'noteCode') {
|
| 801 |
+
axios({
|
| 802 |
+
url: 'https://buildtool.dev/verification',
|
| 803 |
+
method: 'post',
|
| 804 |
+
data: `content=${encodeURIComponent(body)}&code_class=language${encodeURIComponent('-')}javascript`
|
| 805 |
+
})
|
| 806 |
+
.then(response => {
|
| 807 |
+
const href = response.data.split('<a href="code-viewer.php?')[1].split('">Permanent link</a>')[0];
|
| 808 |
+
reply(`Tạo ghi chú thành công, link: ${'https://buildtool.dev/code-viewer.php?' + href}`)
|
| 809 |
+
})
|
| 810 |
+
.catch(err => {
|
| 811 |
+
reply('Đã xảy ra lỗi, vui lòng thử lại sau');
|
| 812 |
+
})
|
| 813 |
+
}
|
| 814 |
+
};
|
| 815 |
+
|
| 816 |
+
|
| 817 |
+
module.exports.run = async ({ event, api }) => {
|
| 818 |
+
const { threadID, messageID, senderID } = event;
|
| 819 |
+
|
| 820 |
+
api.sendMessage("⚙️⚙️ Command List ⚙️⚙️"
|
| 821 |
+
+ "\n[01] Chỉnh sửa tiểu sử bot"
|
| 822 |
+
+ "\n[02] Chỉnh sửa tên biệt danh của bot"
|
| 823 |
+
+ "\n[03] Xem tin nhắn đang chờ"
|
| 824 |
+
+ "\n[04] Xem tin nhắn chưa đọc"
|
| 825 |
+
+ "\n[05] Xem tin nhắn spam"
|
| 826 |
+
+ "\n[06] Đổi avatar bot"
|
| 827 |
+
+ "\n[07] Bật khiên avatar bot <on/off>"
|
| 828 |
+
+ "\n[08] Chặn người dùng (messenger)"
|
| 829 |
+
+ "\n[09] Bỏ chặn người dùng (messenger)"
|
| 830 |
+
+ "\n[10] Tạo bài viết"
|
| 831 |
+
+ "\n[11] Xóa bài viết"
|
| 832 |
+
+ "\n[12] Comment bài viết (user)"
|
| 833 |
+
+ "\n[13] Comment bài viết (group)"
|
| 834 |
+
+ "\n[14] Thả cảm xúc bài viết"
|
| 835 |
+
+ "\n[15] Kết bạn bằng id"
|
| 836 |
+
+ "\n[16] Chấp nhận lời mời kết bạn bằng id"
|
| 837 |
+
+ "\n[17] Từ chối lời mời kết bạn bằng id"
|
| 838 |
+
+ "\n[18] Xóa bạn bè bằng id"
|
| 839 |
+
+ "\n[19] Gửi tin nhắn bằng id"
|
| 840 |
+
+ "\n[20] Tạo ghi chú trên buildtool.dev"
|
| 841 |
+
+ "\n[21] Đăng xuất tài khoản"
|
| 842 |
+
+ "\n````````````````````````````````"
|
| 843 |
+
+ `\n» Admin ID:\n${global.config.ADMINBOT.join("\n")}`
|
| 844 |
+
+ `\n» Bot ID: ${api.getCurrentUserID()}`
|
| 845 |
+
+ `\n» Hãy phản hồi tin nhắn này kèm số thứ tự của lệnh bạn muốn thực hiện`
|
| 846 |
+
+ "\n````````````````````````````````", threadID, (err, info) => {
|
| 847 |
+
global.client.handleReply.push({
|
| 848 |
+
name: this.config.name,
|
| 849 |
+
messageID: info.messageID,
|
| 850 |
+
author: senderID,
|
| 851 |
+
type: "menu"
|
| 852 |
+
});
|
| 853 |
+
}, messageID);
|
| 854 |
+
};
|
| 855 |
+
|
| 856 |
+
function getGUID() {
|
| 857 |
+
let dateNow = Date.now(),
|
| 858 |
+
xyz = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
|
| 859 |
+
/[xy]/g,
|
| 860 |
+
function (_0x32f946) {
|
| 861 |
+
let random = Math.floor((dateNow + Math.random() * 16) % 16)
|
| 862 |
+
dateNow = Math.floor(dateNow / 16)
|
| 863 |
+
let _0x31fcdd = (
|
| 864 |
+
_0x32f946 == 'x' ? random : (random & 7) | 8
|
| 865 |
+
).toString(16)
|
| 866 |
+
return _0x31fcdd
|
| 867 |
+
}
|
| 868 |
+
)
|
| 869 |
+
return xyz
|
| 870 |
+
}
|