Giter Site home page Giter Site logo

benx1n / hikaribot Goto Github PK

View Code? Open in Web Editor NEW
177.0 2.0 24.0 1.51 MB

战舰世界HikariBot,支持战绩查询,基于Nonebot2全平台兼容

License: MIT License

Python 61.89% Batchfile 2.88% Dockerfile 4.13% Shell 31.11%
bot python qqbot wws world-of-warships

hikaribot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hikaribot's Issues

uvicorn报错

最开始报错

[WARNING] nonebot_plugin_gocqhttp | [**********] 连接到反向WebSocket Universal服务器 ws://127.0.0.1:8080/onebot/v11/ws 时出现错误: dial tcp 127.0.0.1:8080: connect: connection refused

然后报错

07-18 12:45:19 [WARNING] uvicorn | Invalid HTTP request received.
07-18 12:51:59 [WARNING] uvicorn | Invalid HTTP request received.
07-18 13:10:19 [WARNING] uvicorn | Invalid HTTP request received.
07-18 13:43:06 [WARNING] uvicorn | Invalid HTTP request received.
07-18 14:22:20 [WARNING] uvicorn | Invalid HTTP request received.
07-18 14:56:30 [WARNING] uvicorn | Invalid HTTP request received.

这可能不是HikariBot自身的问题,但是另一个kokomibot并没有出现这个问题

群晖Docker部署运行卡住无法继续

从Windows上运行了一下机器人正常使用,想部署到群晖上

通过命令启动镜像 token和qq都配置无误
docker run -d -p 12345:8080 12hydrogen/hikari-bot:latest -t token -i qqid
运行容器后卡到running nonebot 无法继续下去
04-09 14:56:15 [SUCCESS] nonebot | Running NoneBot...

通过端口进入网页提示 {"detail":"Not Found"}

Docker部署,Nonebot FastAPI ImportError

Docker部署HikariBot,更新后报Nonebot FastAPI ImportError。
删除image后重新pull未能解决。
Win10 21H2,WSL 2,Docker Desktop 4.16.3

C:\Users\SinCerely>docker pull 12hydrogen/hikari-bot:latest
latest: Pulling from 12hydrogen/hikari-bot
Digest: sha256:d482d7c1080223ccfbc7f330d131d2625d6365f99c0830fac73fa3a60ec8c135
Status: Image is up to date for 12hydrogen/hikari-bot:latest
docker.io/12hydrogen/hikari-bot:latest

C:\Users\SinCerely>docker run -d -p 10888:8080 12hydrogen/hikari-bot:latest -t TOKENTOKENTOKENTOKEN -i 526909856
0f29f02d12db31e3a8da888fcafcef4379f26e813e700b30173b4ad1c3df0c89

C:\Users\SinCerely>docker start -a 0f29
OK
02-12 03:38:18 [SUCCESS] nonebot | NoneBot is initializing...
Traceback (most recent call last):
  File "/home/HikariBot/bot.py", line 9, in <module>
    nonebot.init()
  File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 256, in init
    DriverClass = _resolve_combine_expr(config.driver)
  File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 195, in _resolve_combine_expr
    DriverClass = _resolve_dot_notation(
  File "/usr/local/lib/python3.10/site-packages/nonebot/__init__.py", line 184, in _resolve_dot_notation
    module = importlib.import_module(modulename)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 41, in <module>
    raise ImportError(
ImportError: Please install FastAPI by using `pip install nonebot2[fastapi]`

真寻bot加载插件报错

系统:CentOS 7.5 64位
通过pip install hikari-bot安装
nonebot.load_plugin('hikari_bot')引入插件
配置项已在.env.dev中添加
报错如图:
image

Docker部署,ocr报错

Docker部署HikariBot,启动时downlod_OcrResult()报JSONDecodeError

02-16 01:47:46 [SUCCESS] nonebot | Running NoneBot...
02-16 01:47:48 [ERROR] hikari_bot | Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/hikari_bot/__init__.py", line 262, in startup
    await downlod_OcrResult()
  File "/usr/local/lib/python3.10/site-packages/hikari_bot/game/ocr.py", line 78, in downlod_OcrResult
    ocr_filename_data = json.load(open(ocr_data_path, 'r', encoding='utf8'))
  File "/usr/local/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
02-16 01:53:10 [WARNING] nonebot_plugin_gocqhttp | [*QQ*ID*] 账号密码未配置, 将使用二维码登录.

收到群图片时pic2txt_byOCR()报NameError

02-16 01:53:59 [SUCCESS] nonebot | OneBot V11 *QQ*ID* | [message.group.normal]: Message *MESSAGE*ID* from *QQ*ID*@[群:*GROUP*ID*] '[*IMAGE*URL*]'
02-16 01:53:59 [ERROR] hikari_bot | Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/hikari_bot/game/ocr.py", line 26, in pic2txt_byOCR
    if filename in ocr_filename_data:
NameError: name 'ocr_filename_data' is not defined
02-16 01:54:02 [SUCCESS] nonebot | OneBot V11 *QQ*ID* | [message.group.normal]: Message *下*一*条*消*息*

Windows部署,env.prod中使用如下ocr设置时,相同图片可以正常触发查询。

ocr_on = true
ocr_offline = false
ocr_url = http://mc.youthnp.cn:23338/OCR/

Win10 21H2,WSL 2,Docker Desktop 4.16.3
Docker image: 12hydrogen/hikari-bot:latest
sha256:0a16f81294d70505e5bf54ea84622705b1f57236321e0bfc630acc6781c249d9

请更新env配置项列表

如题
当插件配置新版本时发现缺配置项
从一件包的env找着了
(emm太长时间没发言被从群里撅出去了 悲)

无法启动bot

try to launch the HikariBot
01-08 04:39:04 [SUCCESS] nonebot | NoneBot is initializing...
Traceback (most recent call last):
File "C:\HikariBot\bot.py", line 13, in
driver.register_adapter(ONEBOT_V11Adapter)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\internal\driver\driver.py", line 69, in register_adapter
self._adapters[name] = adapter(self, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\adapters\onebot\v11\adapter.py", line 72, in init
self._setup()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\adapters\onebot\v11\adapter.py", line 85, in _setup
self.setup_http_server(http_setup)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\internal\adapter\adapter.py", line 76, in setup_http_server
self.driver.setup_http_server(setup)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\drivers\fastapi.py", line 116, in setup_http_server
self._server_app.add_api_route(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\fastapi\applications.py", line 304, in add_api_route
self.router.add_api_route(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\fastapi\routing.py", line 572, in add_api_route
route = route_class(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\fastapi\routing.py", line 400, in init
self.response_field = create_response_field(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\fastapi\utils.py", line 90, in create_response_field
raise fastapi.exceptions.FastAPIError(
fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that <class 'starlette.responses.Response'> is a valid pydantic field type

特定表情会误触发hikaribot

01-07 18:34:45 [SUCCESS] nonebot | OneBot V11 ***| [message.private.friend]: Message 538493596 from ***'[image:file=5839febb6cf0ebc577fae63ea595cc78.image,url=https://c2cpicdw.qpic.cn/offpic_new///-3463767722...]'
01-07 18:34:45 [INFO] nonebot | Event will be handled by Matcher(type='message', module=hikari_bot, lineno=53)
01-07 18:34:45 [INFO] nonebot | Matcher(type='message', module=hikari_bot, lineno=53) running complete
01-07 18:34:45 [INFO] nonebot | Event will be handled by Matcher(type='message', module=hikari_bot, lineno=54)
01-07 18:34:45 [SUCCESS] hikari_bot | filename匹配,跳过OCR:5839febb6cf0ebc577fae63ea595cc78
01-07 18:34:45 [INFO] hikari_core | POST https://v3-api.wows.shinoaki.com:8443/api/wows/cache/check
01-07 18:34:45 [INFO] hikari_core | 本次响应的状态码:200 HTTP/2 <Request('POST', 'https://v3-api.wows.shinoaki.com:8443/api/wows/cache/check')>
01-07 18:34:45 [SUCCESS] hikari_core | 跳过上报数据,直接请求
{'server': 'QQ', 'accountId': '***', 'dateTime': '2024-01-07', 'day': 0, 'shipId': 0}
01-07 18:34:45 [INFO] hikari_core | GET https://recent.wows.shinoaki.com:8890/api/wows/recent/day/info?server=QQ&accountId=***&dateTime=2024-01-07&day=0&shipId=0
01-07 18:34:46 [INFO] hikari_core | 本次响应的状态码:200 HTTP/2 <Request('GET', 'https://recent.wows.shinoaki.com:8890/api/wows/recent/day/info?server=QQ&accountId=***&dateTime=2024-01-07&day=0&shipId=0')>
01-07 18:34:46 [INFO] nonebot | Matcher(type='message', module=hikari_bot, lineno=54) running complete

敏感信息已打码处理

触发的表情:
QQ图片20240107183801

image

【报错】自动更新失败

指令wws 更新Hikari,由于启动是python3而不是python,导致的错误
没截全)

xt', data={'text': '正在更新Hikari,完成后将自动重启,如果没有回复您已上线的消息,请登录服务器查看'})]}
sh: 1: python: not found
sh: 1: python: not found
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.9/multiprocessing/spawn.py", line 115, in spawn_main
    parent_sentinel = os.dup(pipe_handle)
OSError: [Errno 9] Bad file descriptor

更新到0.3.9.1之后无法载入插件

更到0.3.9.1之后无法启动插件,Python版本是3.11
代码如下

`05-11 13:12:39 [ERROR] nonebot | Failed to import "hikari_bot"
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\test\first\bot.py", line 18, in
nonebot.load_from_toml("pyproject.toml")
File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\load.py", line 125, in load_from_toml
return load_all_plugins(plugins, plugin_dirs)
File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\load.py", line 62, in load_all_plugins
return manager.load_all_plugins()
File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\manager.py", line 175, in load_all_plugins
return set(
File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\manager.py", line 176, in
filter(None, (self.load_plugin(name) for name in self.available_plugins))

File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\manager.py", line 141, in load_plugin
module = importlib.import_module(name)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\manager.py", line 240, in exec_module
super().exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\hikari_bot_init
.py", line 29, in
from .command_select import select_command
File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\hikari_bot\command_select.py", line 4, in
from .game.ban_search import get_BanInfo
File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\hikari_bot\game\ban_search.py", line 13, in
from ..HttpClient_pool import client_yuyuko
File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\hikari_bot\HttpClient_pool.py", line 31, in
http2 = config.http2
AttributeError: 'Config' object has no attribute 'http2'`

在将这个路径
C:\Users\Administrator\Desktop\test\first\.venv\Lib\site-packages\hikari_bot\HttpClient_pool.py下的 http2 = config.http2改为
http2 = getattr(config, 'http2', None)之后可以载入了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.