put notes/8a77457c-a176-4bf0-8a1f-b8f89f944fed.json
Browse files
notes/8a77457c-a176-4bf0-8a1f-b8f89f944fed.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": "8a77457c-a176-4bf0-8a1f-b8f89f944fed",
|
| 3 |
+
"title": "hi.js",
|
| 4 |
+
"content": "this.config = {\n name: \"hi\",\n aliases: [\"hi\"],\n version: \"1.2.9\",\n role: 1,\n author: \"DongDev\",\n info: \"Hi chào thành viên\",\n Category: \"Quản trị viên\",\n guides: \"[]\",\n cd: 5,\n hasPrefix: true,\n images: [],\n};\nconst fs = require(\"fs\");\nconst path = require(\"path\");\nconst moment = require(\"moment-timezone\");\nconst KEY = [\n \"hello\", \"hi\", \"hai\", \"chào\", \"hí\", \"híí\", \"lô\", \"hii\", \"helo\", \"hê nhô\"\n];\n\nlet filePath;\nthis.onLoad = () => {\n filePath = path.join(__dirname, \"../../system/data/hi.json\");\n if (!fs.existsSync(filePath)) {\n fs.writeFileSync(filePath, \"{}\");\n }\n};\nthis.onEvent = async function ({ event, api, Users }) {\n let { threadID, messageID } = event;\n const jsonData = fs.readFileSync(filePath, \"utf-8\");\n const savedData = JSON.parse(jsonData);\n if (event.senderID === api.getCurrentUserID()) return;\n if (typeof savedData[threadID]?.hi === \"undefined\" || savedData[threadID].hi) {\n if (event.body && KEY.includes(event.body.toLowerCase())) {\n let hours = moment.tz('Asia/Ho_Chi_Minh').format('HHmm');\n let data2 = [\"tốt lành\", \"vui vẻ\"];\n let text = data2[Math.floor(Math.random() * data2.length)];\n let session = (hours > 0 && hours <= 400 ? \"sáng tinh mơ\" :\n hours > 400 && hours <= 700 ? \"sáng sớm\" :\n hours > 700 && hours <= 1000 ? \"sáng\" :\n hours > 1000 && hours <= 1200 ? \"trưa\" :\n hours > 1200 && hours <= 1700 ? \"chiều\" :\n hours > 1700 && hours <= 1800 ? \"chiều tà\" :\n hours > 1800 && hours <= 2100 ? \"tối\" :\n hours > 2100 && hours <= 2400 ? \"tối muộn\" :\n \"lỗi\");\n let name = await Users.getNameUser(event.senderID);\n let mentions = [{ tag: name, id: event.senderID }];\n let msg = {\n body: `Xin chào ${name}, chúc bạn một buổi ${session} ${text} ❤️`,\n mentions,\n };\n api.sendMessage(msg, threadID, messageID);\n }\n }\n};\nthis.onRun = async ({ event, api }) => {\n let { threadID, messageID } = event;\n const jsonData = fs.readFileSync(filePath, \"utf-8\");\n const savedData = JSON.parse(jsonData);\n if (typeof savedData[threadID]?.hi === \"undefined\" || savedData[threadID].hi) {\n savedData[threadID] = { hi: false };\n fs.writeFileSync(filePath, JSON.stringify(savedData, null, 2));\n api.sendMessage(`☑️ Tắt hi thành công!`, threadID, messageID);\n } else {\n savedData[threadID] = { hi: true };\n fs.writeFileSync(filePath, JSON.stringify(savedData, null, 2));\n api.sendMessage(`☑️ Bật hi thành công!`, threadID, messageID);\n }\n};",
|
| 5 |
+
"language": "javascript",
|
| 6 |
+
"createdAt": 1759375313627,
|
| 7 |
+
"updatedAt": 1759375313627
|
| 8 |
+
}
|