{"id":13762344,"url":"https://github.com/aimerneige/MiraiChess","last_synced_at":"2025-05-10T15:31:12.783Z","repository":{"id":37827526,"uuid":"500492477","full_name":"aimerneige/MiraiChess","owner":"aimerneige","description":"使用 MiraiGo-Template 实现的国际象棋机器人。","archived":true,"fork":false,"pushed_at":"2023-08-21T00:58:48.000Z","size":1942,"stargazers_count":14,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-03T14:05:23.336Z","etag":null,"topics":["chatbot","chatbots","chess","chess-game","go","mirai-bot","python"],"latest_commit_sha":null,"homepage":"https://aimerneige.com/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aimerneige.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}},"created_at":"2022-06-06T15:38:50.000Z","updated_at":"2023-10-14T21:15:14.000Z","dependencies_parsed_at":"2024-01-15T03:58:44.241Z","dependency_job_id":"e4f83e22-8057-4f40-a606-2aa908805c15","html_url":"https://github.com/aimerneige/MiraiChess","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimerneige%2FMiraiChess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimerneige%2FMiraiChess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimerneige%2FMiraiChess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimerneige%2FMiraiChess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aimerneige","download_url":"https://codeload.github.com/aimerneige/MiraiChess/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224974208,"owners_count":17401100,"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":["chatbot","chatbots","chess","chess-game","go","mirai-bot","python"],"created_at":"2024-08-03T14:00:39.135Z","updated_at":"2024-11-16T21:30:23.812Z","avatar_url":"https://github.com/aimerneige.png","language":"Go","funding_links":[],"categories":["其他优秀项目"],"sub_categories":[],"readme":"# MiraiChess\n\n\u003e **Warning**\\\n\u003e 由于上游仓库 [MiraiGo-Template](https://github.com/Logiase/MiraiGo-Template) 已长久无人维护，本项目计划使用新的框架重构。\n\u003e\n\u003e 请查阅 [yukichan-bot](https://github.com/aimerneige/yukichan-bot)，本项目终止维护。\n\n![MiraiChess](https://socialify.git.ci/aimerneige/MiraiChess/image?description=1\u0026font=Bitter\u0026forks=1\u0026issues=1\u0026owner=1\u0026pattern=Circuit%20Board\u0026pulls=1\u0026stargazers=1\u0026theme=Light)\n\n\u003e 本来想起名为「MiraiGoChess」的，意为 Mirai 框架 + Go 语言 + 国际象棋，但是社区内有一个项目 [MiraiGoChess](https://github.com/Minxyzgo/MiraiGoChess) 已经用了这个名字，所以咱就叫 「MiraiChess」了。\n\n\u003e **Note**\\\n\u003e 目前的代码非常屎，仅供参考，不要学。\\\n\u003e 因为刚开始功能比较少就偷懒了，后面加了好多功能，懒得重构就越写越屎了。\u003csub\u003e~能跑就行了要什么可扩展性~\u003c/sub\u003e\\\n\u003e 这个项目的功能已经很完善了，后续也不会有大功能更新，已经没必要花时间重构。\n\u003e 如果您愿意花时间重构这个项目，欢迎 pr。\n\n使用 [MiraiGo-Template](https://github.com/Logiase/MiraiGo-Template) 实现的国际象棋机器人。\n\n\u003cimg src=\"https://raw.githubusercontent.com/aimerneige/MiraiChess/master/img/bot.jpeg\" alt=\"bot\"\u003e\n\n## Language\n\nI assume that most of the users of this repo are Chinese, so there will be no English support for README and documents. If you need, post a issue.\n\n## 模块化支持\n\n如果你希望以模块化的方式将本 bot 集成到已有项目中，可以使用如下仓库：\n\n[MiraiGo-module-chess](https://github.com/yukichan-bot-module/MiraiGo-module-chess)\n\n## 如何使用\n\n### 安装\n\n准备如下环境：\n\n1. Linux 服务器 （笔记本啥的也可以，关键要有 Linux 环境）\n2. [python](https://www.python.org/downloads/)\n\n安装 python 库 [python-chess](https://github.com/niklasf/python-chess)：\n\n```bash\npip install python-chess\n```\n\n安装 python 库 [pgn2gif](https://github.com/dn1z/pgn2gif)\n\n\u003e **Warning**\\\n\u003e 这个库不可以通过 pip 安装，必须 clone 源码后手动安装\n\n```bash\ngit clone https://github.com/dn1z/pgn2gif.git\ncd pgn2gif\nsudo python setup.py install\n```\n\n下载最新 [release](https://github.com/aimerneige/MiraiChess/releases) 或 [自己编译](https://github.com/aimerneige/MiraiChess#%E5%A6%82%E4%BD%95%E7%BC%96%E8%AF%91)。\n\n解压 release：\n\n```bash\nmkdir -p /opt/MiraiChess\ntar -xzvf MiraiChess-linux-amd64-v1.9.0.tar.gz -C /opt/MiraiChess\ncd /opt/MiraiChess\n```\n\n按需适当修改 `./config` 下配置文件（默认配置可以直接运行）：\n\n```\nvim ./config/application.yaml\nvim ./config/chess.go\n```\n\n运行启动脚本，下载依赖并确保机器人正常运行（必需至少运行一次启动脚本）：\n\n```bash\n./start.sh\n```\n\n机器人运行无误后，可以安装 service 文件：\n\n```bash\ncp ./mirai-chess.service /etc/systemd/system/mirai-chess.service\n```\n\n启动机器人：\n\n```bash\nsystemctl start mirai-chess.service\n```\n\n开机自启：\n\n```bash\nsystemctl enable mirai-chess.service\n```\n\n### 升级\n\n下载解压 [release](https://github.com/aimerneige/MiraiChess/releases) 后直接执行 `update.sh` 即可。\n\n:warning: 升级脚本只简单地执行了如下任务：\n\n1. 关闭服务\n2. 替换新的可执行文件\n3. 替换 README 文件\n4. 重启服务\n\n更新脚本不会修改配置文件，当有功能更新时请注意手动更改配置文件。\n\n请不要依赖这个脚本，如果遇到问题请备份配置文件后重新安装。\n\n## 如何编译\n\n\u003e **Warning**\\\n\u003e 如果你打算手动编译，请在 [release](https://github.com/aimerneige/MiraiChess/releases) 下载一份最新稳定代码，不要直接使用 master 分支。\n\n环境依赖：\n\n1. [golang](https://go.dev/dl/)\n2. [python](https://www.python.org/downloads/)\n3. [make](https://www.gnu.org/software/make/)\n\n编译可执行文件：\n\n```bash\nmake build\n```\n\n发布 release：\n\n```bash\nmake release\n```\n\n测试运行：\n\n```bash\nmake run\n```\n\n## Q\u0026A\n\n### 是否会支持群内多盘对局同时进行\n\n每个群内同时只能存在一盘对局，如果有多盘对局同时进行的需求可以 fork 之后自己改。\\\n本项目主要是希望提供一个在群内下棋的环境，重要的是大家一起围观、交流和讨论棋局，而不是单纯实现对局。太多的对局同时进行不仅会导致群消息过多炸群，而且也不利于交流。如果只是需要下棋，chess.com 的邀请链接完全可以创建无限的棋局。\u003csub\u003e~绝对不是开发者懒得写~\u003c/sub\u003e\n\n### 扫码登录时被风控如何处理\n\n如果服务器网络环境被风控，在本地执行后将生成的 `device.json` 及 `session.token` 上传至服务器即可。\n\n#### ~~本地也跑不起来怎么办~~\n\n可以尝试换个帐号，腾讯的风控很玄学的，本项目也没有什么好的办法。\n\n以下是个人总结的一些玄学方法：\n\n1. 尽量不要使用刚注册的小号\n2. 帐号要实名并绑定手机号\n3. 开启设备锁、人脸识别等安全工具\n4. 不要频繁切换登录 IP\n5. 帐号多加点好友和群\n\n### 是否支持 Windows\n\n本项目只建议使用 Linux 服务器运行本项目，如果你一定要使用 Windows，请按照下面的方法安装使用：\n\n#### 安装依赖\n\n1. [inkscape](https://inkscape.org/release/)\n2. [python](https://www.python.org/downloads/)\n3. [python-chess](https://github.com/niklasf/python-chess)\n4. [pgn2gif](https://github.com/dn1z/pgn2gif)\n\n#### 编译\n\n将本项目 clone 之后，在项目路径下执行如下指令：\n\n```bash\ngo build -o bin/device.exe cmd/device/device.go\ngo build -o bin/bot.exe cmd/bot/bot.go\n```\n\n注意，编译本项目需要安装配置 Go 和 MinGW\n\n#### 修改配置文件\n\n在 `config/chess.yaml` 文件中修改 inkscape 可执行文件路径为安装路径。\n\n#### 生成设备文件\n\n在项目路径下执行 `device.exe`\n\n```bat\n.\\bin\\device.exe\n```\n\n#### 启动机器人\n\n```bat\n.\\bin\\bot.exe\n```\n\n### 无法生成 PNG\n\n您的发行版无法运行 AppImage 封装的 Inkscape，常见于 Ubuntu。一般地，使用下面的指令安装 `libfuse2` 即可。（仅 Ubuntu）\n\n```bash\nsudo add-apt-repository universe\nsudo apt install libfuse2\n```\n\n有任何疑问请参考 https://github.com/AppImage/AppImageKit/wiki/FUSE#install-fuse\n\n## 交流群\n\n点击链接或扫码加入 QQ 群:\n\n[857066811](https://qm.qq.com/cgi-bin/qm/qr?k=rMtw1SlmoFOp08i5Zw5bM361ljIyzVA-\u0026authKey=9OUzro5oH5CnnFaAbIMwa60987+8ZMwu5GvUAlFUzDIQKVL91z9zUhWp6m1Kayf8\u0026noverify=0)\n\n![qrcode 857066811](img/qr-code.png)\n\n## LICENSE\n\n\u003ca href=\"https://www.gnu.org/licenses/agpl-3.0.en.html\"\u003e\n\u003cimg src=\"https://www.gnu.org/graphics/agplv3-155x51.png\"\u003e\n\u003c/a\u003e\n\n本项目使用 `AGPLv3` 协议开源，您可以在 [GitHub](https://github.com/aimerneige/MiraiChess) 获取本项目源代码。为了整个社区的良性发展，我们强烈建议您做到以下几点：\n\n- **间接接触（包括但不限于使用 `Http API` 或 跨进程技术）到本项目的软件使用 `AGPLv3` 开源**\n- **不鼓励，不支持一切商业使用**\n\n## 开源相关\n\n- [MiraiGo-Template](https://github.com/Logiase/MiraiGo-Template)\n- [chess](https://github.com/notnil/chess)\n- [python-chess](https://github.com/niklasf/python-chess)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimerneige%2FMiraiChess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faimerneige%2FMiraiChess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimerneige%2FMiraiChess/lists"}