宝剑系统(牛子系统和谐改版)
-
新人求鼓勵,采用了的大佬能不能給個star啊~~(作者卑微請求
第3个复刻了、、
但这种形式对qq用户真的有某种吸引力,就自己试着做了一个
数据库用的sqlite,代码上免除了配置数据库的过程
但是要装python
基本上装个httpapi,输个4行代码就能跑swordbot
一个基于
Mirai
和Graia
实现的宝剑游戏机器人(复刻https://github.com/Micalhl/NiuZi)python_version >= '3.8' and python_version < '4.0'
作者使用的是python3.11.1
使用方法
部署
首先确保
Mirai
已安装mirai-api-http
插件并配置正确将项目克隆到本地
git clone git@github.com:liu-zhou-L/swordbot.git
安装
pipenv
,如果已安装忽略此步pip3 install pipenv
使用
pipenv
创建虚拟环境并安装依赖pipenv install -r requirements.txt
配置
机器人的配置文件如下
QQ: 12345 # 你的机器人的 qq 号 VerifyKey: "12345" # 填入 VerifyKey Host: "http://localhost:7789" # adapterSetting下的host GroupBlackList: [] # 群聊黑名单 UserBlackList: [] # 用户黑名单
其中前三项启动后更改需重启机器人(不需要重启
Mirai
)
VerifyKey
和Host
需填入Mirai
路径下config/net.mamoe.mirai-api-http/setting.yml
文件中对应的值运行
前两步完成后,先运行
Mirai
然后在swordbot
路径下使用pipenv run python bot.py
启动机器人
使用
目前支持的指令
宝剑系统:查看可用指令 我的宝剑:查看自己的宝剑信息 白嫖宝剑:获得一把宝剑 比划比划@群内用户:和群内用户进行对决,赚取宝剑长度 随机比划: 与另一位随机宝剑对决,无需@ (群)宝剑榜:查看群内用户的宝剑排名 总宝剑榜:查看宝剑系统所有宝剑的排名 绑定对象+@群内用户:将自己的宝剑对象意向设定为某群内用户,互为彼此意向时,形成对象联系 双修功法:与对象一起修炼,赚取宝剑长度 冲咖啡:冲杯咖啡赚取宝剑长度 宝剑改名+新名称:接受长度在2~30的宝剑名称,会自动去除所有空格,改名成功会消耗 25cm 长度
对
python
、Mirai
、Graia
的使用均为小白级,代码一塌糊涂,qwq -
这算论坛的第3个复刻版了、、
-
大佬,能不能出一个安装教程,pip的指令用在我树莓派服务器上用不了
-
@baofengqwq 你指的是安装python么
-
@liu-zhou-L 不是,树莓派本身自带py3.7,也不知道是啥问题,前面两个pipenv的指令将pipenv换成了pip之后就正常了,而pipenv run python bot.py这条指令无论如何都会报错。
-
@baofengqwq pipenv是一个虚拟环境管理工具,不是pip一类的本地包管理工具
-
@baofengqwq 而且说了python版本至少为3.8,如果你不用pipenv也可以,没有报错的话最后执行python3 bot.py也可以,
-
请问在
pipenv install -r requirements.txt
这一步报错要怎么解决?网上搜了半天一点有关的都没搜到
报错信息如下:C:\swordbot-main>pipenv install -r requirements.txt Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1053, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 754, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\decorators.py", line 84, in new_func return ctx.invoke(f, obj, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 754, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\cli\command.py", line 239, in install do_install( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\core.py", line 2144, in do_install ensure_project( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\core.py", line 584, in ensure_project ensure_pipfile( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\core.py", line 236, in ensure_pipfile raise exceptions.PipenvOptionsError( pipenv.exceptions.PipenvOptionsError: ERROR:: --system is intended to be used fo r pre-existing Pipfile installation, not installation of specific packages. Abor ting. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Scripts\p ipenv.exe\__main__.py", line 7, in <module> File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1128, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\cli\options.py", line 57, in main return super().main(*args, **kwargs, windows_expand_args=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1070, in main e.show() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\exceptions.py", line 172, in show click.echo(self.ctx.get_usage() + "\n%s" % hint, file=file, color=color) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\utils.py", line 298, in echo file.write(out) # type: ignore ^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\vistir\misc.py", line 994, in write return io.TextIOWrapper.write(self, to_text(x, errors=self._errors)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ io.UnsupportedOperation: not writable C:\swordbot-main>pipenv install -r requirements.txt Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1053, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 754, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\decorators.py", line 84, in new_func return ctx.invoke(f, obj, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 754, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\cli\command.py", line 239, in install do_install( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\core.py", line 2144, in do_install ensure_project( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\core.py", line 584, in ensure_project ensure_pipfile( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\core.py", line 236, in ensure_pipfile raise exceptions.PipenvOptionsError( pipenv.exceptions.PipenvOptionsError: ERROR:: --system is intended to be used fo r pre-existing Pipfile installation, not installation of specific packages. Abor ting. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Scripts\p ipenv.exe\__main__.py", line 7, in <module> File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1128, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\cli\options.py", line 57, in main return super().main(*args, **kwargs, windows_expand_args=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1070, in main e.show() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\exceptions.py", line 172, in show click.echo(self.ctx.get_usage() + "\n%s" % hint, file=file, color=color) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\utils.py", line 298, in echo file.write(out) # type: ignore ^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\vistir\misc.py", line 994, in write return io.TextIOWrapper.write(self, to_text(x, errors=self._errors)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ io.UnsupportedOperation: not writable C:\swordbot-main>pipenv install -r requirements.txt Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1053, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 754, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\decorators.py", line 84, in new_func return ctx.invoke(f, obj, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 754, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\cli\command.py", line 239, in install do_install( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\core.py", line 2144, in do_install ensure_project( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\core.py", line 584, in ensure_project ensure_pipfile( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\core.py", line 236, in ensure_pipfile raise exceptions.PipenvOptionsError( pipenv.exceptions.PipenvOptionsError: ERROR:: --system is intended to be used fo r pre-existing Pipfile installation, not installation of specific packages. Abor ting. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Scripts\p ipenv.exe\__main__.py", line 7, in <module> File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1128, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\cli\options.py", line 57, in main return super().main(*args, **kwargs, windows_expand_args=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\core.py", line 1070, in main e.show() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\exceptions.py", line 172, in show click.echo(self.ctx.get_usage() + "\n%s" % hint, file=file, color=color) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\click\utils.py", line 298, in echo file.write(out) # type: ignore ^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site- packages\pipenv\vendor\vistir\misc.py", line 994, in write return io.TextIOWrapper.write(self, to_text(x, errors=self._errors)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ io.UnsupportedOperation: not writable
Python版本是3.11
麻烦大佬看一下 -
@mantou io.UnsupportedOperation: not writable
是说文件不可写,试试管理员 -
大佬怎么删了。