put notes/1a4a018f-a5cf-41b0-bbaf-6cb984f0881f.json
Browse files
notes/1a4a018f-a5cf-41b0-bbaf-6cb984f0881f.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
{
|
2 |
"id": "1a4a018f-a5cf-41b0-bbaf-6cb984f0881f",
|
3 |
"title": "note.js",
|
4 |
-
"content": "const axios = require(\"axios\");\nconst fs = require(\"fs\");\nconst path = require(\"path\");\n\nconst BASE = \"https://twannote.vercel.app\";\nconst langByExt = e => ({\n js: \"javascript\", mjs: \"javascript\", cjs: \"javascript\",\n ts: \"typescript\", py: \"python\", json: \"json\",\n html: \"html\", htm: \"html\", css: \"css\",\n md: \"markdown\", sh: \"bash\", bash: \"bash\", txt: \"text\"\n}[e] || \"text\");\nconst sendOf = o => m => new Promise(r =>\n o.api.sendMessage(m, o.event.threadID, (_, res) => r(res), o.event.messageID)\n);\n\nasync function createNote(filePath) {\n const content = fs.readFileSync(filePath, \"utf8\");\n const title = path.basename(filePath);\n const language = langByExt(path.extname(filePath).slice(1).toLowerCase());\n const { data } = await axios.post(`${BASE}/api/code`, { title, content, language }, { timeout: 20_000 });\n const id = data?.id; if (!id) throw new Error(\"API trả về không có id\");\n return { id, raw: `${BASE}/code/${id}/raw`, page: `${BASE}/code/${id}` };\n}\n\nthis.zuckbotconfig = {\n name: \"note\",\n version: \"2.0.0\",\n role: 90,\n author: \"twan\",\n info: \"
|
5 |
"language": "javascript",
|
6 |
"createdAt": 1755664516238,
|
7 |
-
"updatedAt":
|
8 |
}
|
|
|
1 |
{
|
2 |
"id": "1a4a018f-a5cf-41b0-bbaf-6cb984f0881f",
|
3 |
"title": "note.js",
|
4 |
+
"content": "const axios = require(\"axios\");\nconst fs = require(\"fs\");\nconst path = require(\"path\");\n\nconst BASE = \"https://twannote.vercel.app\";\nconst langByExt = e => ({\n js: \"javascript\", mjs: \"javascript\", cjs: \"javascript\",\n ts: \"typescript\", py: \"python\", json: \"json\",\n html: \"html\", htm: \"html\", css: \"css\",\n md: \"markdown\", sh: \"bash\", bash: \"bash\", txt: \"text\"\n}[e] || \"text\");\nconst sendOf = o => m => new Promise(r =>\n o.api.sendMessage(m, o.event.threadID, (_, res) => r(res), o.event.messageID)\n);\n\nasync function createNote(filePath) {\n const content = fs.readFileSync(filePath, \"utf8\");\n const title = path.basename(filePath);\n const language = langByExt(path.extname(filePath).slice(1).toLowerCase());\n const { data } = await axios.post(`${BASE}/api/code`, { title, content, language }, { timeout: 20_000 });\n const id = data?.id; if (!id) throw new Error(\"API trả về không có id\");\n return { id, raw: `${BASE}/code/${id}/raw`, page: `${BASE}/code/${id}` };\n}\n\nthis.zuckbotconfig = {\n name: \"note\",\n version: \"2.0.0\",\n role: 90,\n author: \"twan\",\n info: \"notdbhdndnfnfjfjfnfnfnne\",\n Category: \"Tiện ích\",\n usages: \"..\",\n cd: 5\n};\n\nthis.onRun = async function (o) {\n const s = sendOf(o), name = this.zuckbotconfig.name;\n const file = path.join(__dirname, o.args[0] || \"\");\n try {\n const { id, raw, page } = await createNote(file);\n const res = await s(\n `📝 Đã tạo note\n• Raw: ${raw}\n• Page: ${page}\n────────────────\n📄 Nguồn: ${file}\n\n📌 Thả cảm xúc để **tải Raw và ghi đè** file.`\n );\n global.zuckbot.onReaction.push({ ...res, name, path: file, o, url: raw, action: \"confirm_from_url\" });\n } catch (e) { console.error(e); s(String(e)); }\n};\n\nthis.onReaction = async function (o) {\n const _ = o.onReaction, s = sendOf(o);\n try {\n if (o.event.userID !== _.o.event.senderID) return;\n if (_.action === \"confirm_from_url\") {\n const { data } = await axios.get(_.url, { responseType: \"text\", timeout: 20_000 });\n fs.writeFileSync(_.path, data);\n s(`✅ Đã ghi đè file\\n🔗 ${_.path}`);\n }\n } catch (e) { console.error(e); s(String(e)); }\n};",
|
5 |
"language": "javascript",
|
6 |
"createdAt": 1755664516238,
|
7 |
+
"updatedAt": 1755664537048
|
8 |
}
|