{"id":24907484,"url":"https://github.com/txthinkinginc/zhi.js","last_synced_at":"2025-03-27T23:16:11.510Z","repository":{"id":272396552,"uuid":"916396065","full_name":"TxThinkingInc/zhi.js","owner":"TxThinkingInc","description":"Bot of Zhi","archived":false,"fork":false,"pushed_at":"2025-02-26T03:48:55.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-26T04:28:04.626Z","etag":null,"topics":["bot","chat","chatbot","instant-messaging","zhi"],"latest_commit_sha":null,"homepage":"https://www.txthinking.com/zhi.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TxThinkingInc.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-14T02:24:58.000Z","updated_at":"2025-02-26T03:48:58.000Z","dependencies_parsed_at":"2025-01-14T07:18:55.002Z","dependency_job_id":"48fb14ef-2018-4d11-8531-332563cfd973","html_url":"https://github.com/TxThinkingInc/zhi.js","commit_stats":null,"previous_names":["txthinkinginc/zhi.js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TxThinkingInc%2Fzhi.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TxThinkingInc%2Fzhi.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TxThinkingInc%2Fzhi.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TxThinkingInc%2Fzhi.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TxThinkingInc","download_url":"https://codeload.github.com/TxThinkingInc/zhi.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245938227,"owners_count":20697008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","chat","chatbot","instant-messaging","zhi"],"created_at":"2025-02-02T01:17:29.970Z","updated_at":"2025-03-27T23:16:11.505Z","avatar_url":"https://github.com/TxThinkingInc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bot of Zhi\n\nhttps://www.txthinking.com/zhi.html\n\n## Install bun via [nami](https://github.com/txthinking/nami)\n\n```\nnami install bun bun.plus\n```\n\n## Make AvatarUUID\n\n\u003e You only need to make AvatarUUID once for each Chat\n\n```\nimport zhi from 'https://raw.githubusercontent.com/TxThinkingInc/zhi.js/refs/heads/master/lib.js';\n\nvar BotToken = \"\"   // get from https://www.txthinking.com/zhi.html\nvar ChatUUID = \"\"   // get from https://www.txthinking.com/zhi.html\nvar Key = \"\"        // your Chat Key\nvar UserUUID = \"\"   // get from https://www.txthinking.com/zhi.html\nvar avatar = \"\"     // local avatar image path\n\nvar b = await Bun.file(avatar).bytes()\nvar res = await fetch(`https://upload.zhi.shiliew.com/?ChatUUID=${ChatUUID}\u0026Kind=avatar\u0026Token=${BotToken}`, {\n    method: \"PUT\",\n    body: await zhi.encrypt_file(Key, ChatUUID, UserUUID, b),\n})\nif (res.status != 200) {\n    throw await res.text()\n}\nvar AvatarUUID = await res.text()\n\nconsole.log(AvatarUUID)\n```\n\n```\nbun --preload ~/.nami/bin/_bun_import_url.js your.js\n```\n\n## Run Bot\n\n```\nimport Bot from 'https://raw.githubusercontent.com/TxThinkingInc/zhi.js/refs/heads/master/bot.js'\n\nvar bot = await Bot.init(\"Bot Token\", [ // get from https://www.txthinking.com/zhi.html, one Bot Token can be used in multiple Chats\n    {\n        ChatUUID: \"\",   // get from https://www.txthinking.com/zhi.html\n        Key: \"\",        // your Chat Key\n        UserUUID: \"\",   // get from https://www.txthinking.com/zhi.html\n        Name: \"\",       // bot name\n        AvatarUUID:\"\",  // AvatarUUID you maked\n    },\n])\nawait bot.connect()\nbot.on_message(function(m) { // must call this method, ACK will be responded inside.\n    console.log(m)\n})\nawait bot.send_text(\"The ChatUUID\", \"Hello\")\nbot.close()\n```\n\n```\nbun --preload ~/.nami/bin/_bun_import_url.js your.js\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxthinkinginc%2Fzhi.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftxthinkinginc%2Fzhi.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxthinkinginc%2Fzhi.js/lists"}