{"id":27363654,"url":"https://github.com/love-kogasa/trc.js","last_synced_at":"2025-10-24T04:23:59.975Z","repository":{"id":287548487,"uuid":"964900420","full_name":"Love-Kogasa/trc.js","owner":"Love-Kogasa","description":"使用NodeJs编写tshock插件(外接)","archived":false,"fork":false,"pushed_at":"2025-04-12T11:31:47.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T12:39:14.612Z","etag":null,"topics":["javascript","rest-api","tshock","tshock-chinese"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Love-Kogasa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-04-12T01:54:03.000Z","updated_at":"2025-04-12T11:31:50.000Z","dependencies_parsed_at":"2025-04-12T12:49:52.570Z","dependency_job_id":null,"html_url":"https://github.com/Love-Kogasa/trc.js","commit_stats":null,"previous_names":["love-kogasa/trc.js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Love-Kogasa%2Ftrc.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Love-Kogasa%2Ftrc.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Love-Kogasa%2Ftrc.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Love-Kogasa%2Ftrc.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Love-Kogasa","download_url":"https://codeload.github.com/Love-Kogasa/trc.js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248663863,"owners_count":21141853,"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":["javascript","rest-api","tshock","tshock-chinese"],"created_at":"2025-04-13T04:32:07.537Z","updated_at":"2025-10-24T04:23:59.846Z","avatar_url":"https://github.com/Love-Kogasa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TRC.js\n基于RESTAPI的JavaScript Tshock插件库  \n**无需魔改服务端或客户端，全JavaScript实现，基于Nodejs**.  \n*TIP: 本库部分功能依赖tshock插件 ChattyBridge 聊天桥*.  \nExample(.js):\n```js\nvar server = new VRestServer( 7171, \"localhost\", \"private-token-for-lovekogasa\" )\n// 后两者是可选的，但是您需要提供token才能够使用绝大部分功能\nserver.on( \"message\", ( event ) =\u003e {\n  console.log( event.sender + \"@terraria# \" + event )\n  if( event.toString() == \"hi\" ){\n    event.reply( \"hey!\", \"lovekogasa\" ).catch(console.error)\n    event.firework( \"B\" ).catch(console.error)\n    event.firework( \"G\" ).catch(console.error)\n  } else if( event.toString() == \"#status\" ){\n    server.status().then( ( s ) =\u003e event.reply( s.world ) )\n  } else if( event.toString() == \"#player\" ){\n    event.read().then(console.log)\n  }\n})\nserver.listen( 7373, () =\u003e {\n  console.log( \"127.0.0.1:7373\")\n})\n```\n在本地启动服务器后，将ChattyBridge配置文件中的REST地址设置一条为localhost:7373  \n打开游戏输入hi进行测试  \n*如果后面有更好的相关的插件出来，本项目也会添加更多事件支持*.  \n\n# 支持的事件列表\n* message - 聊天栏消息事件，返回消息对象(EventChatMsg)，可用event.message.type 检测是玩家聊天还是退出或进入，启用指令转发后可用于检测不存在的命令\n* chat - 聊天事件\n* player\\_join - 玩家进入\n* player\\_leave - 玩家退出\n* tick - 服务器REST启动后每t(enableTick中自定义，默认为1000(ms))在执行一次，返回TickEvent对象，无依赖，需要启用tick事件  \n调用VRestServer对象的enableTick以启动tick事件\n* connect - 启用tick后当服务器rest可以被请求则执行该事件，返回TickEvent对象\n* disconnect - 词面意思\n\n# TRModule 目录\n本目录为TRC扩展功能列表，非依赖库\n\n# TODO 正在整\n* 完善Tick事件\n* 增加更多类\n* 增加更多功能","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flove-kogasa%2Ftrc.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flove-kogasa%2Ftrc.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flove-kogasa%2Ftrc.js/lists"}