├── .gitignore ├── watch.json ├── _config.yml ├── LICENSE ├── package.json ├── README.md └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | .env 3 | *.tgz 4 | *.mp3 5 | *.mp4 6 | *.png 7 | *.gif 8 | node_modules/ -------------------------------------------------------------------------------- /watch.json: -------------------------------------------------------------------------------- 1 | { 2 | "restart": { 3 | "include": [ 4 | "\\.json" 5 | ] 6 | }, 7 | "throttle": 3000 8 | } -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | title: OneFile 2 | description: Con bot này chỉ có 1 file !! 3 | show_downloads: true 4 | google_analytics: G-X65EPQSEF0 5 | theme: jekyll-theme-hacker 6 | github: 7 | zip_url: https://github.com/ProCoderMew/OneFile/archive/refs/heads/main.zip -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Nguyễn Mậu Minh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MewBot", 3 | "version": "1.1.3", 4 | "main": "index.js", 5 | "scripts": { 6 | "login": "node --trace-warnings index --login", 7 | "start": "node --trace-warnings index" 8 | }, 9 | "license": "MIT", 10 | "engines": { 11 | "node": "12.x" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/ProCoderMew/OneFile.git" 16 | }, 17 | "author": "ProCoderMew", 18 | "bugs": { 19 | "url": "https://github.com/ProCoderMew/OneFile/issues" 20 | }, 21 | "homepage": "https://github.com/ProCoderMew/OneFile#readme", 22 | "dependencies": { 23 | "@procodermew/fca-onefile": "", 24 | "axios": "*", 25 | "chalk": "*", 26 | "child_process": "*", 27 | "fs-extra": "*", 28 | "readline": "*", 29 | "string-similarity": "*", 30 | "totp-generator": "*", 31 | "ytdl-core": "*" 32 | }, 33 | "devDependencies": { 34 | "@procodermew/meewmeew-cli": "" 35 | }, 36 | "data": { 37 | "default": { 38 | "email": "", 39 | "password": "", 40 | "token": "", 41 | "name": "MewBot", 42 | "prefix": "/", 43 | "admin": "", 44 | "apikey": { 45 | "meewmeew": "" 46 | } 47 | }, 48 | "allCmds": [ 49 | "adduser", 50 | "all", 51 | "ban", 52 | "cmds", 53 | "covid", 54 | "log", 55 | "img", 56 | "rerun", 57 | "say", 58 | "setprefix", 59 | "sim", 60 | "sing", 61 | "sl", 62 | "uid", 63 | "unban", 64 | "uptime" 65 | ], 66 | "threads": [], 67 | "users": [], 68 | "cookies": [] 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Mew Bot

2 | 3 |

4 | size 5 | version 6 | commits 7 | 8 | # Introduce 9 | 10 | - Bot này chỉ có 1 file thôi :) 11 | - Bot không nhiều tính lăng. 12 | 13 | # Installation 14 | 15 | - Yêu cầu: 16 | - Nodejs >= 12 17 | - 1 tài khoản facebook, bật 2fa tránh pay acc. 18 | - Hết rồi :). 19 | 20 | - Cài đặt: 21 | 22 | 1. Tải về [Nodejs](https://nodejs.org/en) và [git](https://git-scm.com) sau đó cài đặt. 23 | 24 | 2. Tải source bot về qua git. 25 | ```sh 26 | git clone https://github.com/ProCoderMew/OneFile.git 27 | ``` 28 | 29 | 3. Cài đặt các package cần thiết. 30 | ```sh 31 | npm install 32 | ``` 33 | 34 | 4. Chỉnh sửa data trong package.json. 35 | 1. Tùy chỉnh email, password, token (2fa key), tên bot, ... 36 | 2. Lưu và đóng lại. 37 | 38 | 5. Lấy cookies (appstate). 39 | - Lấy cookies bằng cách đăng nhập: 40 | ```sh 41 | npm run login 42 | ``` 43 | 44 | - Nếu bạn có sẵn cookies từ trước, hãy dán vào phần cookies trong package.json. 45 | - Extension lấy cookies: [fbstate](https://github.com/c3cbot/c3c-fbstate). 46 | 47 | 6. Chạy bot. 48 | ```sh 49 | npm start 50 | ``` 51 | - Đến đây thì bạn đã có 1 con bot rồi :D 52 | 53 | - Support Termux 54 | - Xem script [tại đây](https://github.com/ProCoderMew/storage-data). 55 | 56 | # Update 57 | 58 | - Chạy lệnh sau ở command line/terminal. 59 | ```sh 60 | meewmeew --onefile --update 61 | ``` 62 | - Quá trình update chỉ mất khoảng 15s. 63 | 64 | # Note 65 | 66 | ## Hướng Dẫn Tạo APIKEY 67 | - Để sử dụng được một số lệnh cần apikey, cần tạo một apikey mới để có thể sử dụng lệnh. 68 | - Dưới đây là video hướng dẫn. 69 | - Web login: [MeewMeew](https://meewmeew.info/site) 70 | 71 | [![Generator APIKEY](https://img.youtube.com/vi/HPiA_Pdtmcw/0.jpg)](https://youtu.be/HPiA_Pdtmcw) 72 | 73 | # Author 74 | 75 | - **ProCoderMew** - [GitHub](https://github.com/ProCoderMew) - [Facebook](https://www.facebook.com/ProCoder.Mew) - [Website](https://meewmeew.info) 76 | 77 | # License 78 | 79 | - [LICENSE](LICENSE) 80 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const chalk = require("chalk"); 3 | const login = require("@procodermew/fca-onefile"); 4 | const BigData = require("./package.json"); 5 | const readline = require("readline"); 6 | const totp = require("totp-generator"); 7 | const ytdl = require("ytdl-core"); 8 | const { execSync } = require('child_process'); 9 | const { writeFileSync, createReadStream, unlinkSync, createWriteStream, removeSync, mkdirSync, copySync } = require("fs-extra"); 10 | const { existsSync } = require("fs"); 11 | var { data: botData } = BigData; 12 | 13 | var rl = readline.createInterface({ 14 | input: process.stdin, 15 | output: process.stdout 16 | }); 17 | 18 | const GLOBAL = { 19 | logEvent: false, 20 | reply: new Map(), 21 | threadData: {}, 22 | userData: {}, 23 | default: botData.default, 24 | wait: false, 25 | simsimi: {} 26 | }; 27 | 28 | const Data = { 29 | loginCookieOptions: { 30 | forceLogin: true, 31 | listenEvents: true, 32 | logLevel: "error", 33 | updatePresence: true, 34 | selfListen: true, 35 | userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" 36 | }, 37 | loginEmailOptions: { 38 | logLevel: "silent", 39 | forceLogin: true, 40 | userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" 41 | } 42 | } 43 | 44 | const modules = { 45 | simsimi: async function (msg) { 46 | const d = axios, { meewmeew: e } = GLOBAL.default.apikey, g = (a) => encodeURIComponent(a); 47 | try { 48 | var { data: j } = await d({ url: `https://meewmeew.info/simsimi/api?ask=${g(msg)}&apikey=${e}`, method: "GET" }); 49 | return { data: j } 50 | } catch { 51 | return { error: !0 } 52 | } 53 | }, 54 | logger: function (data, option, more) { 55 | const color = more == 0 ? "greenBright" : more == 1 ? "redBright" : more == 2 ? "cyanBright" : more == 3 ? "magentaBright" : more == 4 ? "yellow" : undefined; 56 | if (option == 0) return console.log(chalk.yellow("\x1b[1m" + data)); 57 | else if (option == undefined) return console.log(chalk.greenBright(`[ ${data.toUpperCase()} ] » \x1b[1m`) + data); 58 | else return console.log(chalk[color == undefined ? "greenBright" : color](`[ ${option.toUpperCase()} ] » \x1b[1m`) + `${data}`); 59 | }, 60 | getName: function (api, id) { 61 | return new Promise(async (resolve, reject) => { 62 | if (botData.users.some(i => i.userID == id)) { 63 | resolve(botData.users.find(e => e.userID == id).name); 64 | } else if (!botData.users.some(i => i.userID == id)) { 65 | var name = (await api.getUserInfo(id))[id].name; 66 | resolve(name); 67 | } else { 68 | reject() 69 | } 70 | }); 71 | }, 72 | checkUpdate: async function () { 73 | try { 74 | const { data } = await axios.get("https://raw.githubusercontent.com/ProCoderMew/OneFile/main/package.json"); 75 | if (data.version != BigData.version) { 76 | modules.logger("Đã có bản cập nhật mới. Sử dụng 'meewmeew --onefile --update' để cập nhật.", "update", 1); 77 | } else modules.logger("Bạn đang sử dụng phiên bản mới nhất.", "update", 3); 78 | } catch { 79 | modules.logger("Đã có lỗi xảy ra.", "update", 1); 80 | } 81 | }, 82 | loginFunction: function ({ email, password, token, otp }) { 83 | return login({ email, password }, Data.loginEmailOptions, (err, api) => { 84 | if (err) { 85 | switch (err.error) { 86 | case "login-approval": 87 | if (otp) err.continue(otp); 88 | else if (token) err.continue(totp(token)); 89 | else { 90 | rl.question("\x1b[0m\x1b[1m\x1b[35mNhập mã xác minh 2 lớp: \x1b[0m\x1b[1m", line => { 91 | err.continue(line); 92 | console.clear(); 93 | console.log("\n\x1b[46m===================================\x1b[0m\n"); 94 | rl.close(); 95 | }); 96 | } 97 | break; 98 | default: 99 | if (process.env.API_SERVER_EXTERNAL == 'https://api.glitch.com') return modules.logger(err.error, "login", 1); 100 | else { 101 | modules.logger(err.error, "login", 1); 102 | return process.exit(); 103 | } 104 | } 105 | return; 106 | } 107 | botData.cookies = api.getAppState(); 108 | writeFileSync("./package.json", JSON.stringify(BigData, null, 4)); 109 | modules.logger("Đã ghi thành công cookie mới.", "cookie"); 110 | return modules.loginWithCookie(); 111 | }); 112 | }, 113 | loginWithEmail: async function () { 114 | var otp; 115 | var email = botData.default.email; 116 | var password = botData.default.password; 117 | var token = botData.default.token.replace(/\s+/g, ''); 118 | 119 | if (email == "" || !email) { 120 | console.log("\x1b[46m===================================\x1b[0m\n"); 121 | console.log("\x1b[1mNhập đầy đủ thông tin để đang nhập.\n"); 122 | console.log("\x1b[46m===================================\x1b[0m\n"); 123 | rl.question("\x1b[1m\x1b[32mNhập email: \x1b[0m\x1b[1m", (mail) => { 124 | email = mail; 125 | rl.question("\n\x1b[32mNhập password: \x1b[0m\x1b[1m", (pass) => { 126 | password = pass; 127 | rl.question("\n\x1b[0m\x1b[1m\x1b[35mNhập mã xác minh 2 lớp: \x1b[0m\x1b[1m", (code) => { 128 | otp = code; 129 | console.clear(); 130 | console.log("\n\x1b[46m===================================\x1b[0m\n"); 131 | console.log("\x1b[1mĐang đăng nhập.."); 132 | modules.loginFunction({ email, password, otp }); 133 | rl.close(); 134 | }); 135 | }); 136 | }); 137 | } else { 138 | return modules.loginFunction({ email, password, token }); 139 | } 140 | }, 141 | loginWithCookie: async function () { 142 | return login({ appState: botData.cookies }, { pauseLog: true }, function (err, api) { 143 | if (err) { 144 | return modules.logger(err, "login", 1); 145 | } 146 | var prevEvent; 147 | botData.cookies = api.getAppState(); 148 | writeFileSync("./package.json", JSON.stringify(BigData, null, 4)); 149 | api.setOptions(Data.loginCookieOptions); 150 | modules.loadData(); 151 | modules.logger("Bot ID: " + api.getCurrentUserID(), "info"); 152 | modules.logger("Bắt đầu nhận tin.", "status"); 153 | const listen = modules.listen({ api }); 154 | const temp = ["presence", "typ", "read_receipt"]; 155 | const handleListen = async function (error, event) { 156 | if (error) return modules.logger(error.error, "listen", 1); 157 | if (temp.includes(event.type)) return; 158 | if (prevEvent && prevEvent.timestamp == event.timestamp) 159 | await api.listenMqtt().stopListening(); 160 | await new Promise(e => setTimeout(e, 2000)); 161 | prevEvent = event; 162 | listen(prevEvent); 163 | if (GLOBAL.logEvent == true) console.log(prevEvent); 164 | }; 165 | api.listenMqtt(handleListen); 166 | setInterval(async function () { 167 | api.listenMqtt().stopListening(); 168 | await restart(); 169 | }, 3600000); 170 | async function restart() { 171 | await new Promise(resolve => setTimeout(resolve, 20000)); 172 | modules.logger("Bắt đầu nhận tin.", "status"); 173 | return api.listenMqtt(handleListen); 174 | }; 175 | }) 176 | }, 177 | listen: function ({ api }) { 178 | return function (event) { 179 | switch (event.type) { 180 | case "message": 181 | case "message_reply": 182 | case "message_unsend": 183 | Message({ api })({ event }); 184 | noPrefix({ api })({ event }); 185 | Reply({ api })({ event }); 186 | break; 187 | case "event": { 188 | switch (event.logMessageType) { 189 | case "log:subscribe": { 190 | if (event.logMessageData.addedParticipants.some(i => i.userFbId == api.getCurrentUserID())) { 191 | return api.sendMessage(`Đã kết nối thành công >w<`, event.threadID, () => { 192 | api.changeNickname(GLOBAL.default.name, event.threadID, api.getCurrentUserID()); 193 | }); 194 | } 195 | } 196 | } 197 | break; 198 | } 199 | } 200 | } 201 | }, 202 | createThread: async function ({ event, api }) { 203 | if (GLOBAL.wait == true) return; 204 | var { threadID, isGroup } = event; 205 | threadID = parseInt(threadID); 206 | if (!botData.hasOwnProperty('threads')) botData['threads'] = []; 207 | let threads = botData.threads; 208 | if (!threads.some(e => e.threadID == threadID) && isGroup) { 209 | GLOBAL.wait = true; 210 | let threadInfo = await api.getThreadInfo(threadID); 211 | threads.push({ threadID, name: threadInfo.name, prefix: GLOBAL.default.prefix, block: false, selfListen: false, blockCmd: [], shortcuts: [] }); 212 | modules.logger(threadID + " | " + threadInfo.name, "thread", 2); 213 | GLOBAL.wait = false; 214 | } 215 | writeFileSync("./package.json", JSON.stringify(BigData, null, "\t")); 216 | modules.loadData(); 217 | }, 218 | createUser: async function ({ event, api }) { 219 | if (GLOBAL.wait == true) return; 220 | var { senderID } = event; 221 | senderID = parseInt(senderID); 222 | if (!botData.hasOwnProperty('users')) botData['users'] = []; 223 | let users = botData.users; 224 | if (!users.some(e => e.userID == senderID)) { 225 | GLOBAL.wait = true; 226 | var userData = (await api.getUserInfo(senderID))[senderID]; 227 | let name = userData.name; 228 | let sex = userData.gender; 229 | users.push({ userID: senderID, name, sex, block: false }); 230 | modules.logger(senderID + " | " + name, "user", 2); 231 | GLOBAL.wait = false; 232 | } 233 | writeFileSync("./package.json", JSON.stringify(BigData, null, "\t")); 234 | modules.loadData(); 235 | }, 236 | loadData: function () { 237 | if (botData.hasOwnProperty('threads')) { 238 | for (const thread of botData.threads) { 239 | if (!GLOBAL.threadData.hasOwnProperty(thread.threadID)) { 240 | GLOBAL.threadData[thread.threadID] = thread; 241 | } 242 | } 243 | } 244 | if (botData.hasOwnProperty('users')) { 245 | for (const user of botData.users) { 246 | if (!GLOBAL.userData.hasOwnProperty(user.userID)) { 247 | GLOBAL.userData[user.userID] = user; 248 | } 249 | } 250 | } 251 | }, 252 | getData: function ({ event }) { 253 | var thread = botData.threads.find(e => e.threadID == event.threadID); 254 | var user = botData.users.find(e => e.userID == event.senderID); 255 | return { 256 | thread, 257 | user 258 | } 259 | } 260 | } 261 | 262 | function Message({ api }) { 263 | const botID = api.getCurrentUserID(); 264 | return async function ({ event }) { 265 | const { threadID, senderID, messageID, body: content } = event; 266 | if (!event.isGroup) return; 267 | if ((Object.keys(GLOBAL.threadData)).some(e => e == threadID) && GLOBAL.threadData[threadID].block == true && senderID != GLOBAL.default.admin) return; 268 | if ((Object.keys(GLOBAL.userData)).some(e => e == senderID) && GLOBAL.userData[senderID].block == true && senderID != GLOBAL.default.admin) return; 269 | // create thread 270 | if (!(Object.keys(GLOBAL.threadData)).some(e => e == threadID)) { 271 | await modules.createThread({ event, api }); 272 | } 273 | // create user 274 | await modules.createUser({ event, api }); 275 | 276 | //out 277 | 278 | var out = function (data, callback = function () { }, mid) { 279 | if (!data) return; 280 | mid = typeof mid == "undefined" ? messageID : mid; 281 | typeof callback == "string" ? mid = callback : callback; 282 | typeof callback != "function" ? callback = function () { } : callback; 283 | return api.sendMessage(data, threadID, callback, mid); 284 | } 285 | 286 | // check admin 287 | var isAdmin = function () { 288 | var list = GLOBAL.default.admin; 289 | if (list == senderID) return true; 290 | else { 291 | out("Bạn không đủ quyền sử dụng lệnh này."); 292 | return false; 293 | } 294 | } 295 | 296 | if (GLOBAL.threadData[threadID].selfListen == false && api.getCurrentUserID() == senderID) return; 297 | var prefix = GLOBAL.threadData[threadID].prefix || GLOBAL.default.prefix; 298 | if (!content.startsWith(prefix)) return; 299 | var args = content.slice(prefix.length).trim().split(/ +/); 300 | // auto correct 301 | var { bestMatch } = require("string-similarity").findBestMatch(args[0], botData.allCmds); 302 | if (bestMatch.rating >= 0.4) args = [bestMatch.target, ...args.slice(1)]; 303 | else return; 304 | 305 | // check cmd 306 | if (GLOBAL.threadData[threadID].blockCmd.includes(args[0])) return out("Lệnh '" + args[0] + "' đã bị cấm dùng."); 307 | 308 | try { 309 | var { user: DataUser, thread: DataThread } = modules.getData({ event }); 310 | // all 311 | if (args[0] == "all") { 312 | var all = event.participantIDs; 313 | var body = args.slice(1).join(" ") || '‎', mentions = []; 314 | all = all.filter(e => e != api.getCurrentUserID()); 315 | for (let i in all) { 316 | if (i == body.length) body += body.charAt(body.length - 1); 317 | if (typeof body[i] != "undefined") mentions.push({ tag: body[i], id: all[i], fromIndex: i }); 318 | } 319 | return out({ body, mentions }); 320 | } 321 | // cmds 322 | if (args[0] == "cmds") { 323 | var cmds = botData.allCmds.sort((a, b) => a.localeCompare(b)).join(", "); 324 | return out(`Có ${botData.allCmds.length} lệnh:\n${cmds}`); 325 | } 326 | // uid 327 | if (args[0] == "uid") { 328 | var msg = ''; 329 | if (Object.keys(event.mentions).length == 0) return out(senderID); 330 | else { 331 | for (let e of Object.keys(event.mentions)) { 332 | msg += `\n${event.mentions[e].replace(/@/g, "")}: ${e}` 333 | } 334 | return out(msg); 335 | } 336 | } 337 | // uptime 338 | if (args[0] == "uptime") { 339 | var sec_num = parseInt(process.uptime(), 10); 340 | var days = Math.floor(sec_num / (3600 * 24)) 341 | var hours = Math.floor(sec_num % (3600 * 24) / 3600); 342 | var minutes = Math.floor(sec_num / 60) % 60; 343 | var seconds = sec_num % 60; 344 | return out([days, hours, minutes, seconds].map(v => (v < 10 ? "0" + v : v)).filter((v, i) => v !== "00" || i > 0).join(":")); 345 | } 346 | // on/off log 347 | if (args[0] == "log" && isAdmin()) { 348 | if (GLOBAL.logEvent == true) { 349 | GLOBAL.logEvent = false; 350 | return out("Đã tắt log event."); 351 | } else { 352 | GLOBAL.logEvent = true; 353 | return out("Đã bật log event."); 354 | } 355 | } 356 | // set prefix 357 | if (args[0] == "setprefix" && isAdmin()) { 358 | if (!args[1]) return out("Prefix cần set where :D?"); 359 | GLOBAL.threadData[threadID].prefix = args[1]; 360 | botData.threads.find(e => e.threadID == threadID).prefix = args[1]; 361 | writeFileSync("./package.json", JSON.stringify(BigData, null, 4)); 362 | return out("Đổi prefix thành công."); 363 | } 364 | // sing 365 | if (args[0] == "sing") { 366 | const regexYoutube = /^(https?:\/\/)?(www\.)?(m\.)?(youtube\.com|youtu\.?be)\/.+$/gi; 367 | if (regexYoutube.test(args[1])) { 368 | var videoInfo = await ytdl.getInfo(args[1]); 369 | var { videoId, lengthSeconds } = videoInfo.videoDetails; 370 | if (lengthSeconds > 1200) return out("Độ dài video vượt quá mức cho phép, tối đa là 20 phút!"); 371 | else return api.sendTypingIndicator(threadID, () => ytdl(videoId, { filter: format => format.itag == '140' }).pipe(createWriteStream(`./${videoId}.m4a`)).on("close", () => out({ body: videoInfo.videoDetails.title, attachment: createReadStream(`./${videoId}.m4a`) }, () => unlinkSync(`./${videoId}.m4a`))).on("error", (e) => out(e))); 372 | } else return out("Vui lòng nhập 1 link youtube."); 373 | } 374 | // rerun 375 | if (args[0] == "rerun") { 376 | if (event.type != "message_reply") return out("Vui lòng reply 1 tin nhắn"); 377 | return modules.listen({ api })({ 378 | type: 'message', 379 | threadID: threadID, 380 | messageID: event.messageReply.messageID, 381 | senderID: senderID, 382 | attachments: event.messageReply.attachments, 383 | body: event.messageReply.body, 384 | isGroup: true, 385 | mentions: event.messageReply.mentions, 386 | timestamp: Date.now() 387 | }); 388 | } 389 | // selfListen 390 | if (args[0] == "sl") { 391 | if (GLOBAL.threadData[threadID].selfListen == false) { 392 | GLOBAL.threadData[threadID].selfListen = true; 393 | DataThread.selfListen = true; 394 | out("Đã bật selfListen."); 395 | } else if (GLOBAL.threadData[threadID].selfListen == true) { 396 | GLOBAL.threadData[threadID].selfListen = false; 397 | DataThread.selfListen = false; 398 | out("Đã tắt selfListen."); 399 | } 400 | writeFileSync("./package.json", JSON.stringify(BigData, null, 4)) 401 | } 402 | // say 403 | if (args[0] == "say") { 404 | var dataSay = args.slice(1).join(" "); 405 | var name = Math.floor(Math.random() * 99999999999999999999999999999999); 406 | var { data } = await axios(`https://translate.google.com/translate_tts?ie=UTF-8&q=${encodeURIComponent(dataSay)}&tl=vi&client=tw-ob`, { responseType: 'arraybuffer' }); 407 | writeFileSync(`./${name}.mp3`, Buffer.from(data, 'utf-8')); 408 | return api.sendMessage({ attachment: createReadStream(`./${name}.mp3`) }, event.threadID, () => unlinkSync(`./${name}.mp3`)); 409 | } 410 | // ban 411 | if (args[0] == "ban" && isAdmin()) { 412 | switch (args[1]) { 413 | case "cmd": 414 | if (!args[2]) return out("Chưa nhập lệnh cần cấm."); 415 | if (!botData.allCmds.some(e => e == args[2])) return out("Lệnh cần cấm không tồn tại."); 416 | if (GLOBAL.threadData[threadID].blockCmd.includes(args[2])) return out("Lệnh này đã bị cấm từ trước."); 417 | GLOBAL.threadData[threadID].blockCmd.push(args[2]); 418 | out("Đã cấm sử dụng lệnh '" + args[2] + "' trong nhóm này."); 419 | break; 420 | case "user": 421 | var mention = Object.keys(event.mentions)[0]; 422 | if (!mention) { 423 | if (isNaN(args[2])) return out("ID cần là 1 dãy số."); 424 | if (!botData.users.some(e => e.userID == args[2])) return out("Không có dữ liệu của người dùng."); 425 | if (GLOBAL.userData[args[2]].block == true) return out(GLOBAL.userData[args[2]].name + " đã bị cấm từ trước."); 426 | GLOBAL.userData[args[2]].block = true; 427 | botData.users.find(e => e.userID == args[2]).block = true; 428 | out("Đã cấm người dùng: " + GLOBAL.userData[args[2]].name); 429 | } else { 430 | if (!botData.users.some(e => e.userID == mention)) return out("Không có dữ liệu của người dùng."); 431 | if (GLOBAL.userData[mention].block == true) return out(GLOBAL.userData[args[2]].name + " đã bị cấm từ trước."); 432 | GLOBAL.userData[mention].block = true; 433 | botData.users.find(e => e.userID == mention).block = true; 434 | out("Đã cấm người dùng: " + GLOBAL.userData[args[2]].name); 435 | } 436 | break; 437 | case "thread": 438 | if (!args[2]) { 439 | if (GLOBAL.threadData[threadID].block == true) return out("Nhóm này đã bị cấm từ trước."); 440 | GLOBAL.threadData[threadID].block = true; 441 | botData.threads.find(e => e.threadID == threadID).block = true; 442 | out("Đã cấm nhóm: " + GLOBAL.threadData[threadID].name); 443 | } else { 444 | if (isNaN(args[2])) return out("ID cần là 1 dãy số."); 445 | if (!botData.threads.some(e => e.threadID == args[2])) return out("Không có dữ liệu của nhóm."); 446 | if (GLOBAL.threadData[args[2]].block == true) return out(GLOBAL.threadData[args[2]].name + " đã bị cấm từ trước."); 447 | GLOBAL.threadData[args[2]].block = true; 448 | botData.threads.find(e => e.threadID == args[2]).block = true; 449 | out("Đã cấm nhóm: " + GLOBAL.threadData[args[2]].name); 450 | } 451 | break; 452 | default: 453 | return out("Lệnh bạn nhập không đúng, vui lòng thử lại."); 454 | break; 455 | } 456 | writeFileSync("./package.json", JSON.stringify(BigData, null, 4)); 457 | } 458 | // unban 459 | if (args[0] == "unban" && isAdmin()) { 460 | switch (args[1]) { 461 | case "cmd": 462 | if (!args[2]) return out("Chưa nhập lệnh cần bỏ cấm."); 463 | if (!botData.allCmds.some(e => e == args[2])) return out("Lệnh cần bỏ cấm không tồn tại."); 464 | if (!GLOBAL.threadData[threadID].blockCmd.includes(args[2])) return out("Lệnh này chưa bị cấm."); 465 | GLOBAL.threadData[threadID].blockCmd.splice(GLOBAL.threadData[threadID].blockCmd.indexOf(args[2])); 466 | out("Đã bỏ cấm lệnh '" + args[2] + "' trong nhóm này."); 467 | break; 468 | case "user": 469 | var mention = Object.keys(event.mentions)[0]; 470 | if (!mention) { 471 | if (isNaN(args[2])) return out("ID cần là 1 dãy số."); 472 | if (!botData.users.some(e => e.userID == args[2])) return out("Không có dữ liệu của người dùng."); 473 | if (GLOBAL.userData[args[2]].block == false) return out(GLOBAL.userData[args[2]].name + " chưa bị cấm."); 474 | GLOBAL.userData[args[2]].block = false; 475 | botData.users.find(e => e.userID == args[2]).block = false; 476 | out("Đã bỏ cấm người dùng: " + GLOBAL.userData[args[2]].name); 477 | } else { 478 | if (!botData.users.some(e => e.userID == mention)) return out("Không có dữ liệu của người dùng."); 479 | if (GLOBAL.userData[mention].block == false) return out(GLOBAL.userData[mention].name + " đã bị cấm từ trước."); 480 | GLOBAL.userData[mention].block = false; 481 | botData.users.find(e => e.userID == mention).block = false; 482 | out("Đã bỏ cấm người dùng: " + GLOBAL.userData[mention].name); 483 | } 484 | break; 485 | case "thread": 486 | if (!args[2]) { 487 | if (GLOBAL.threadData[threadID].block == false) return out("Nhóm này chưa bị cấm."); 488 | GLOBAL.threadData[threadID].block = false; 489 | botData.threads.find(e => e.threadID == threadID).block = false; 490 | out("Đã bỏ cấm nhóm: " + GLOBAL.threadData[threadID].name); 491 | } else { 492 | if (isNaN(args[2])) return out("ID cần là 1 dãy số."); 493 | if (!botData.threads.some(e => e.threadID == args[2])) return out("Không có dữ liệu của nhóm."); 494 | if (GLOBAL.threadData[args[2]].block == false) return out(GLOBAL.threadData[args[2]].name + " chưa bị cấm."); 495 | GLOBAL.threadData[args[2]].block = false; 496 | botData.threads.find(e => e.threadID == args[2]).block = false; 497 | out("Đã bỏ cấm nhóm: " + GLOBAL.threadData[args[2]].name); 498 | } 499 | break; 500 | default: 501 | return out("Lệnh bạn nhập không đúng, vui lòng thử lại."); 502 | break; 503 | } 504 | writeFileSync("./package.json", JSON.stringify(BigData, null, 4)); 505 | } 506 | 507 | //img 508 | if (args[0] == "img") { 509 | var type; 510 | switch (args[1]) { 511 | case "boy": 512 | case "trai": 513 | type = "boy"; 514 | break; 515 | case "girl": 516 | case "gái": 517 | type = "girl"; 518 | break; 519 | case "cosplay": 520 | type = "cosplay"; 521 | break; 522 | case "wibu": 523 | type = "wibu"; 524 | break; 525 | case "mèo": 526 | case "meow": 527 | type = "meow"; 528 | break; 529 | case "dog": 530 | case "chó": 531 | type = "dog"; 532 | break; 533 | default: 534 | type = "girl"; 535 | break; 536 | } 537 | 538 | var { data } = await axios.get(`https://meewmeew.info/image/${type}?apikey=${GLOBAL.default.apikey.meewmeew}`); 539 | var path = `./${type}.png`; 540 | if (data.success == false) return api.sendMessage(data.error, threadID, messageID); 541 | else { 542 | writeFileSync(path, Buffer.from(data.data, 'utf-8')); 543 | return api.sendMessage({ attachment: createReadStream(path) }, threadID, () => unlinkSync(path), messageID); 544 | } 545 | } 546 | //adduser 547 | if (args[0] == "adduser") { 548 | const botID = api.getCurrentUserID(); 549 | var { participantIDs, approvalMode, adminIDs } = await api.getThreadInfo(threadID); 550 | var participantIDs = participantIDs.map(e => parseInt(e)); 551 | async function getUID(url) { const _0x1255 = ['\x68\x74\x74\x70\x47\x65\x74', '\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f', '\x68\x74\x74\x70\x3a\x2f\x2f', '\x20\x66\x61\x63\x65\x62\x6f\x6f\x6b\x2e', '\x6e\x61\x6d\x65', '\x4e\x68\u1ead\x70\x20\x31\x20\x55\x52\x4c', '\x32\x31\x37\x30\x35\x36\x5a\x75\x42\x64\x6e\x48', '\x35\x33\x6d\x69\x71\x53\x75\x72', '\x69\x6e\x63\x6c\x75\x64\x65\x73', '\x31\x32\x39\x39\x33\x4f\x68\x5a\x70\x58\x6a', '\x74\x61\x62\x6c\x65', '\x69\x6e\x64\x65\x78\x4f\x66', '\x22\x72\x65\x64\x69\x72\x65\x63\x74\x22', '\x66\x62\x2e\x63\x6f\x6d', '\x63\x74\x6f\x72\x28\x22\x72\x65\x74\x75', '\x31\x62\x4b\x6d\x78\x56\x54', '\x69\x6e\x66\x6f', '\x72\x65\x74\x75\x72\x6e\x20\x28\x66\x75', '\x66\x6f\x72\x20\x28\x3b\x3b\x29\x3b\x7b', '\x7b\x22\x6e\x61\x6d\x65\x22\x3a\x20\x22', '\x74\x6f\x53\x74\x72\x69\x6e\x67', '\x31\x5a\x67\x51\x66\x6c\x44', '\x6d\x61\x74\x63\x68', '\x31\x6d\x49\x6c\x5a\x4f\x66', '\x31\x63\x70\x73\x61\x57\x51', '\x72\x65\x70\x6c\x61\x63\x65', '\x38\x37\x30\x30\x34\x76\x52\x6d\x74\x76\x4e', '\x31\x37\x33\x34\x32\x32\x65\x6e\x4c\x76\x75\x44', '\x65\x78\x63\x65\x70\x74\x69\x6f\x6e', '\x7b\x7d\x2e\x63\x6f\x6e\x73\x74\x72\x75', '\x65\x78\x65\x63', '\x31\x33\x37\x36\x37\x33\x75\x72\x41\x64\x76\x76', '\x63\x6f\x6e\x73\x6f\x6c\x65', '\x77\x61\x72\x6e', '\x61\x70\x70\x6c\x79', '\x73\x6c\x69\x63\x65', '\x34\x30\x34\x36\x31\x34\x49\x69\x4e\x44\x50\x53', '\x5f\x5f\x70\x72\x6f\x74\x6f\x5f\x5f', '\x65\x72\x72\x6f\x72', '\x31\x31\x37\x34\x37\x4c\x57\x56\x6a\x61\x71', '\x70\x61\x72\x73\x65', '\x66\x61\x63\x65\x62\x6f\x6f\x6b\x2e\x63', '\x68\x74\x74\x70\x73\x3a\x2f\x2f', '\x62\x69\x6e\x64']; (function (_0x363f9d, _0x179379) { function _0x2df602(_0x2cf281, _0x2ded75) { return _0x3c3b(_0x2cf281 - -0x1b, _0x2ded75); } while (!![]) { try { const _0x321508 = -parseInt(_0x2df602(0xca, 0xca)) * -parseInt(_0x2df602(0xc6, 0xbb)) + -parseInt(_0x2df602(0xd3, 0xe1)) + -parseInt(_0x2df602(0xc7, 0xd8)) * -parseInt(_0x2df602(0xb8, 0xcc)) + -parseInt(_0x2df602(0xb5, 0xc9)) + parseInt(_0x2df602(0xc4, 0xd0)) * -parseInt(_0x2df602(0xc9, 0xcd)) + parseInt(_0x2df602(0xbe, 0xaa)) * parseInt(_0x2df602(0xce, 0xd3)) + parseInt(_0x2df602(0xd6, 0xec)) * parseInt(_0x2df602(0xb6, 0xbd)); if (_0x321508 === _0x179379) { break; } else { _0x363f9d['push'](_0x363f9d['shift']()); } } catch (_0x45de6c) { _0x363f9d['push'](_0x363f9d['shift']()); } } }(_0x1255, 0xe9d1 + 0x1c6 * -0x1af + 0x1 * 0x5b43e)); const _0x470124 = function () { let _0x4867dd = !![]; return function (_0x58d00d, _0x2e7ded) { const _0x53dcfc = _0x4867dd ? function () { function _0x1b8043(_0x2cf237, _0x49decb) { return _0x3c3b(_0x49decb - 0x127, _0x2cf237); } if (_0x2e7ded) { const _0x5c1372 = _0x2e7ded[_0x1b8043(0x215, 0x213)](_0x58d00d, arguments); _0x2e7ded = null; return _0x5c1372; } } : function () { }; _0x4867dd = ![]; return _0x53dcfc; }; }(); function _0x794d4f(_0x196b7f, _0x4ffbdc) { return _0x3c3b(_0x196b7f - -0xbb, _0x4ffbdc); } const _0x3aed39 = _0x470124(this, function () { function _0x5e9726(_0x209ce1, _0x44b70b) { return _0x3c3b(_0x44b70b - -0x4e, _0x209ce1); } const _0x2af5ae = function () { function _0x532370(_0x527e59, _0x4428e5) { return _0x3c3b(_0x4428e5 - -0xf, _0x527e59); } let _0x591008; try { _0x591008 = Function(_0x532370(0xd8, 0xcc) + '\x6e\x63\x74\x69\x6f\x6e\x28\x29\x20' + (_0x532370(0xe5, 0xd8) + _0x532370(0xc6, 0xc9) + '\x72\x6e\x20\x74\x68\x69\x73\x22\x29\x28' + '\x20\x29') + '\x29\x3b')(); } catch (_0x5cca5b) { _0x591008 = window; } return _0x591008; }; const _0x4c20e5 = _0x2af5ae(); const _0x48f58e = _0x4c20e5[_0x5e9726(0x97, 0x9c)] = _0x4c20e5['\x63\x6f\x6e\x73\x6f\x6c\x65'] || {}; const _0xf500cc = ['\x6c\x6f\x67', _0x5e9726(0xb3, 0x9d), _0x5e9726(0x88, 0x8c), _0x5e9726(0xa2, 0xa2), _0x5e9726(0xa4, 0x98), _0x5e9726(0x80, 0x86), '\x74\x72\x61\x63\x65']; for (let _0x391299 = 0x8d * -0x32 + -0xd * -0x12a + -0x2 * -0x634; _0x391299 < _0xf500cc['\x6c\x65\x6e\x67\x74\x68']; _0x391299++) { const _0xbd68d5 = _0x470124[_0x5e9726(0x8d, 0x7d) + '\x72']['\x70\x72\x6f\x74\x6f\x74\x79\x70\x65'][_0x5e9726(0xb9, 0xa7)](_0x470124); const _0x210f79 = _0xf500cc[_0x391299]; const _0x44482f = _0x48f58e[_0x210f79] || _0xbd68d5; _0xbd68d5[_0x5e9726(0xae, 0xa1)] = _0x470124[_0x5e9726(0xb1, 0xa7)](_0x470124); _0xbd68d5[_0x5e9726(0x8a, 0x90)] = _0x44482f[_0x5e9726(0x8e, 0x90)][_0x5e9726(0xab, 0xa7)](_0x44482f); _0x48f58e[_0x210f79] = _0xbd68d5; } }); _0x3aed39(); const regexName = new RegExp(/"title":"(.*?)"/s); function _0x3c3b(_0x3c3b23, _0x1a7c04) { _0x3c3b = function (_0xd7a227, _0x4a57cc) { _0xd7a227 = _0xd7a227 - (0x5 * -0x225 + 0x29 * -0x10 + 0xe13); let _0x41c9ce = _0x1255[_0xd7a227]; return _0x41c9ce; }; return _0x3c3b(_0x3c3b23, _0x1a7c04); } if (url['\x69\x6e\x63\x6c\x75\x64\x65\x73'](_0x794d4f(0x38, 0x38) + '\x6f\x6d') || url[_0x794d4f(0x17, 0xc)](_0x794d4f(0x1c, 0x26))) { try { if (url[_0x794d4f(0x1a, 0x2a)](_0x794d4f(0x11, 0x1b)) === -(-0x207c + -0xda3 * 0x2 + -0x3bc3 * -0x1) && url[_0x794d4f(0x1a, 0x17)](_0x794d4f(0x39, 0x3b)) === -(0x22 + -0x5 * 0x224 + 0xa93 * 0x1)) url = _0x794d4f(0x39, 0x38) + url; let data = await api['\x68\x74\x74\x70\x47\x65\x74'](url); let regex = /for \(;;\);{"redirect":"(.*?)"}/[_0x794d4f(0x2d, 0x2b)](data); if (data[_0x794d4f(0x17, 0xe)](_0x794d4f(0x21, 0x2b) + _0x794d4f(0x1b, 0x7) + '\x3a\x22')) data = await api[_0x794d4f(0xf, 0x22)](regex[-0x18c7 + -0xfeb + -0x28b3 * -0x1]['\x72\x65\x70\x6c\x61\x63\x65'](/\\/g, '')[_0x794d4f(0x28, 0x21)](/(?<=\?\s*)(.*)/, '')[_0x794d4f(0x32, 0x37)](0x1f * 0x92 + -0xfc4 + -0x7 * 0x46, -(-0x51 * -0x5d + 0x1 * 0x117a + -0x2ee6))); let regexid = /"userID":"(\d+)"/[_0x794d4f(0x2d, 0x41)](data); let name = JSON[_0x794d4f(0x37, 0x2e)](_0x794d4f(0x22, 0x27) + data[_0x794d4f(0x25, 0x3b)](regexName)[-0x3 * 0x8f3 + -0xe7 * 0x1d + -0x31 * -0x115] + '\x22\x7d')[_0x794d4f(0x13, 0xa)] || null; return [+regexid[-0x2 * 0xc1f + -0x592 + 0x1dd1], name, ![]]; } catch { return [null, null, !![]]; } } else { return [_0x794d4f(0x14, 0x23) + _0x794d4f(0x12, 0xc), null, !![]]; } } 552 | if (!args[1]) return out("Vui lòng nhập 1 id/link profile user cần add."); 553 | if (!isNaN(args[1])) return adduser(args[0], undefined); 554 | else { 555 | try { 556 | var [id, name, fail] = await getUID(args[1], api); 557 | if (fail == true && id != null) return out(id); 558 | else if (fail == true && id == null) return out("Không tìm thấy ID người dùng.") 559 | else { 560 | await adduser(id, name || "người dùng Facebook"); 561 | } 562 | } catch (e) { 563 | return out(`${e.name}: ${e.message}.`); 564 | } 565 | } 566 | 567 | async function adduser(id, name) { 568 | id = parseInt(id); 569 | if (participantIDs.includes(id)) return out(`${name ? name : "Thành viên"} đã có mặt trong nhóm.`); 570 | else { 571 | var admins = adminIDs.map(e => parseInt(e.id)); 572 | try { 573 | await api.addUserToGroup(id, threadID); 574 | } 575 | catch { 576 | return out(`Không thể thêm ${name ? name : "người dùng"} vào nhóm.`); 577 | } 578 | if (approvalMode === true && !admins.includes(botID)) return out(`Đã thêm ${name ? name : "thành viên"} vào danh sách phê duyệt !`); 579 | else return out(`Đã thêm ${name ? name : "thành viên"} vào vào nhóm !`); 580 | } 581 | } 582 | } 583 | //sim 584 | if (args[0] == "sim") { 585 | if (!args[1]) { 586 | if (GLOBAL.simsimi[threadID]) { 587 | delete GLOBAL.simsimi[threadID]; 588 | return out("\u0110\xE3 t\u1EAFt sim th\xE0nh c\xF4ng."); 589 | } else { 590 | GLOBAL.simsimi[threadID] = true; 591 | return out("\u0110\xE3 b\u1EADt sim th\xE0nh c\xF4ng."); 592 | } 593 | } else { 594 | var { data: g, error: h } = await modules.simsimi(args.slice(1).join(" ")); 595 | return !0 == h ? void 0 : !1 == g.success ? out(g.error) : out(g.msg); 596 | } 597 | } 598 | //covid 599 | if (args[0] == "covid") { 600 | var { data } = await axios.get(`https://meewmeew.info/covid?apikey=${GLOBAL.default.apikey.meewmeew}`); 601 | var world = data.world, 602 | vn = data.vietnam, 603 | news = data.news, 604 | nhiemtg = world.cases, 605 | chettg = world.deaths, 606 | hoiphuctg = world.recovered, 607 | nhiemvn = vn.cases, 608 | chetvn = vn.deaths, 609 | hoiphucvn = vn.recovered, 610 | dieutrivn = vn.recovering, 611 | ptchetvn = Math.round(chetvn.replace(/\./g, "") * 100 / nhiemvn.replace(/\./g, "")), 612 | pthoiphucvn = Math.round(hoiphucvn.replace(/\./g, "") * 100 / nhiemvn.replace(/\./g, "")), 613 | ptchettg = Math.round(chettg.replace(/\./g, "") * 100 / nhiemtg.replace(/\./g, "")), 614 | pthoiphuctg = Math.round(hoiphuctg.replace(/\./g, "") * 100 / nhiemtg.replace(/\./g, "")), 615 | pthoiphucvn = pthoiphucvn.toString().split(".")[0], 616 | ptdieutrivn = (100 - pthoiphucvn - ptchetvn).toString().split(".")[0]; 617 | ptchetvn = ptchetvn.toString().split(".")[0]; 618 | pthoiphuctg = pthoiphuctg.toString().split(".")[0]; 619 | ptchettg = ptchettg.toString().split(".")[0]; 620 | 621 | return out( 622 | '====== Thế Giới ======\n' + 623 | `😷 Nhiễm: ${nhiemtg}\n` + 624 | `💚 Hồi phục: ${hoiphuctg} (${pthoiphuctg}%)\n` + 625 | `💀 Tử vong: ${chettg} (${ptchettg}%)\n` + 626 | '====== Việt Nam ======\n' + 627 | `😷 Nhiễm: ${nhiemvn}\n` + 628 | `💉 Đang điều trị: ${dieutrivn} (${ptdieutrivn}%)\n` + 629 | `💚 Hồi phục: ${hoiphucvn} (${pthoiphucvn}%)\n` + 630 | `💀 Tử vong: ${chetvn} (${ptchetvn}%)\n\n` + 631 | `Tin tức: ${news.vietnam}\n` + 632 | `Cập nhật: ${data.time}` 633 | ); 634 | } 635 | } catch (e) { 636 | out(`${e.name}: ${e.message} tại lệnh ${args[0]}`); 637 | modules.logger(`${e.name}: ${e.message} tại lệnh ${args[0]}`, "message", 1); 638 | } 639 | } 640 | } 641 | 642 | function Reply({ api }) { 643 | var replyData = []; 644 | return async function ({ event }) { 645 | const { threadID, messageID, senderID, body: content } = event; 646 | if (event.type != "message_reply") return; 647 | for (var e of GLOBAL.reply.entries()) { 648 | if (!replyData.some(i => i == e[0])) replyData.push(e[0]); 649 | } 650 | 651 | var out = function (data, callback = function () { }, mid) { 652 | if (!data) return; 653 | mid = typeof mid == "undefined" ? messageID : mid; 654 | typeof callback == "string" ? mid = callback : callback; 655 | typeof callback != "function" ? callback = function () { } : callback; 656 | return api.sendMessage(data, threadID, callback, mid); 657 | } 658 | 659 | if (replyData.length > 0) { 660 | var DataInReplyData = GLOBAL.reply.get(event.messageReply.messageID); 661 | if (typeof DataInReplyData == "undefined") return; 662 | const { name: commandName } = DataInReplyData; 663 | switch (commandName) { 664 | case "name": 665 | break; 666 | } 667 | GLOBAL.reply.delete(event.messageReply.messageID); 668 | replyData.splice(replyData.indexOf(event.messageReply.messageID), 1); 669 | } 670 | } 671 | } 672 | 673 | function noPrefix({ api }) { 674 | return async function ({ event }) { 675 | const { threadID, senderID, messageID, body } = event; 676 | if (senderID == api.getCurrentUserID()) return; 677 | 678 | var out = function (data, callback = function () { }, mid) { 679 | if (!data) return; 680 | mid = typeof mid == "undefined" ? messageID : mid; 681 | typeof callback == "string" ? mid = callback : callback; 682 | typeof callback != "function" ? callback = function () { } : callback; 683 | return api.sendMessage(data, threadID, callback, mid); 684 | } 685 | 686 | if (body == "ahihi") return out("=))"); 687 | if (GLOBAL.simsimi[threadID]) { 688 | if (senderID == api.getCurrentUserID() || "" == body) return; 689 | var { data: h, error: i } = await modules.simsimi(body); 690 | return !0 == i ? void 0 : !1 == h.success ? out(h.error) : out(h.msg); 691 | } 692 | } 693 | } 694 | 695 | (async function () { 696 | // Open Server 697 | if (process.env.API_SERVER_EXTERNAL || process.env.REPL_ID) require('http').createServer((_, res) => res.writeHead(200).end("Hello World")).listen(process.env.PORT || 3000); 698 | console.log("\u001Bc"); 699 | // get cookie or start bot 700 | switch (process.argv[2]) { 701 | case '--login': 702 | case '-l': 703 | await modules.loginWithEmail(); 704 | break; 705 | default: 706 | if (botData.cookies.length == 0) { 707 | await modules.loginWithEmail(); 708 | break; 709 | } 710 | else { 711 | await modules.checkUpdate(); 712 | await modules.loginWithCookie(); 713 | break; 714 | } 715 | } 716 | })() 717 | --------------------------------------------------------------------------------