Code Monkey home page Code Monkey logo

spit_chatbot's People

Contributors

lumoxu avatar pigeoner avatar

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

spit_chatbot's Issues

端口问题

请问端口查询该如何进行查找,我运用了作者提供的办法和网络上的办法,只找到了VPN的ip,而无法查找到VPN端口,这令我十分困惑。希望能得到作者的解答。

qqbot.py运行时,出现报错

运行日志如下
`当前进程pid: 2268

#################################################################
██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██╔═══██╗██╔══██╗██╔═══██╗╚══██╔══╝
██████╔╝ ╚████╔╝ ██║ ██║ ██║██████╔╝██║ ██║ ██║
██╔═══╝ ╚██╔╝ ██║ ██║▄▄ ██║██╔══██╗██║ ██║ ██║
██║ ██║ ╚██████╗╚██████╔╝██████╔╝╚██████╔╝ ██║
╚═╝ ╚═╝ ╚═════╝ ╚══▀▀═╝ ╚═════╝ ╚═════╝ ╚═╝
v0.5.1.1 BY FengLiu
#################################################################

[2023-07-12 18:52:56,531][go-cqhttp/WARNING] PyCqBot: go-cqhttp 警告 Protocol -> device lock is disable. http api may fail.
[2023-07-12 18:53:12,036][MainThread/INFO] PyCqBot: 正在连接 go-cqhttp websocket 服务
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\websockets\legacy\client.py", line 139, in read_http_response
status_code, reason, headers = await read_response(self.reader)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\websockets\legacy\http.py", line 130, in read_response
raise ValueError(f"unsupported HTTP version: {d(version)}")
ValueError: unsupported HTTP version: HTTP/1.0

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\Spit_chatBot\qqbot.py", line 447, in
bot.start()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\pycqBot\cqHttpApi.py", line 361, in start
self._websocket_start()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\pycqBot\cqHttpApi.py", line 401, in _websocket_start
asyncio.run(main_logic())
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\pycqBot\cqHttpApi.py", line 375, in main_logic
async with websockets.connect(self.__host) as websocket:
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\websockets\legacy\client.py", line 637, in aenter
return await self
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\websockets\legacy\client.py", line 655, in await_impl_timeout
return await self.await_impl()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\websockets\legacy\client.py", line 662, in await_impl
await protocol.handshake(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\websockets\legacy\client.py", line 323, in handshake
status_code, response_headers = await self.read_http_response()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\websockets\legacy\client.py", line 145, in read_http_response
raise InvalidMessage("did not receive a valid HTTP response") from exc
websockets.exceptions.InvalidMessage: did not receive a valid HTTP response
PS D:\Spit_chatBot> Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.
Failed to write to log, write /dev/stdout: The pipe is being closed.`

ChatGPT Connect 返回 EOF 解释

在于 ChatGPT 中若进行本地的 Request 不论任何平台例如 NodeJs & Python
出现了返回 unexpected EOF 字样, 则可能出现了如下情况:

  1. Proxy 服务器配置错误或过期
  2. 本地配置 Proxy 错误 (少见)
  3. 输错了 Proxy 地址

tips:(对于要将 Spit_chatBot 库转换成 NodeJs 平台上的开发者)
在于 NodeJs 平台中获取 ChatGPT 的 Response 时, 出现了 Circle Parse 等字样.
不用担心, 那是 OpenAI 的原生库造成的, 它使用了 Axios 库进行请求, 但是在处理 TCP Connect 出现了循环 Object.
即无限套娃, 但是在通常中 Js 解释器不会发现, 除非调用了 JSON.stringify.
你可以尝试 try catch 块捕捉该错误, 并让 bot 干其他事 (发送表情或者什么都不用做)

bot发送消息失败,提示发生错误,私聊还是好的,群里就发不出去了

Ready to answer...
bot回复: 你好啊,怎么一直在重复发相同的消息? (Tokens used: 402)
处理后回复: ['你好啊', '怎么一直在重复发相同的消息()']
[2023-05-30 23:07:16,048][cqhttp_shell/WARNING] PyCqBot: go-cqhttp ]
[2023-05-30 23:07:16,049][asyncHttp_loop/ERROR] PyCqBot: api 发生错误 SEND_MSG_API_ERROR: send group message failed: blocked by server code: 100
[2023-05-30 23:07:27,329][cqhttp_shell/WARNING] PyCqBot: go-cqhttp ]
[2023-05-30 23:07:27,330][asyncHttp_loop/ERROR] PyCqBot: api 发生错误 SEND_MSG_API_ERROR: send group message failed: blocked by server code: 100
e:\BOTS\pycqBot\qqbot.py:85: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
counter.loc[group_id]['api_used'] += api_used
e:\BOTS\pycqBot\qqbot.py:86: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
counter.loc[group_id]['msgs_sent'] += num_of_msgs
Replied sticker: 19
[2023-05-30 23:07:32,697][cqhttp_shell/WARNING] PyCqBot: go-cqhttp ]
[2023-05-30 23:07:32,698][asyncHttp_loop/ERROR] PyCqBot: api 发生错误 SEND_MSG_API_ERROR: send group message failed: blocked by server code: 100

丢给cloud后:
这段日志显示:

  1. 您的机器人继续尝试发送群消息,但仍被服务器拦截,错误码为100。
  2. 您的代码中出现SettingWithCopyWarning警告。这表明您正在试图修改DataFrame的切片副本,这可能导致意外行为。
  3. 您的机器人回复了贴纸消息,消息ID为19。
    根据这些信息,我的建议是:
  4. 继续检查消息内容和频率,确保符合相关政策。如果问题持续,联系腾讯支持。
  5. 修复SettingWithCopyWarning警告。通常的解决方法是:
  • 使用.loc进行索引,而不是[]。。loc基于标签索引,可以避免副本问题。
  • 使用.assign()或iloc来设置值,而不是直接.loc[ ] = 。
  • 调用.loc只读一次,不要进行多次设置调用。
  1. 检查getGroupMsgHistory和SEND_MSG接口调用,确认贴纸消息已成功发送。如果未发送,机器人代码可能需要修复。
  2. 使用CQHTTP API的相关接口,进一步检查群设置、消息历史和机器人在该群的权限。这可以帮助判断问题原因。
  3. 除检查机器人代码和服务外,也请检查go-cqhttp服务是否正常启动。go-cqhttp服务的正常运行对发送消息至关重要。
    我希望这些建议能帮助您进一步诊断和解决问题。熟悉API和相关工具可以有效帮助分析和解决各类bot问题。如果您有任何其他疑问,欢迎与我讨论。
    祝您项目顺利!熟练使用工具,理解并修复相关Warning,解决bot在使用过程中出现的各种问题。成为bot开发高手!

===================

这个需要怎么解决?

表情包发送问题

发送表情包的时候,机器人发[CQ:image,file=10,cache=1,url=......]这种怎么解决?
image

服务器如何使用vpn

我想在linux服务器上一直挂起这个bot,我买的服务器怎么使用vpn呢?我在本地window可以使用,但是不能一直开机呀

服务启动成功,接收成功,但是 OpenAI 没有返回。

环境

阿里云深圳 Ubuntu 20.04
python 3.9
go-cqhttp v1.0.1
pycqbot v0.4.5
spit_chatbot main

修改说明

  1. api_base:为我的 OpenAI 代理地址(在其他项目亲测成功)
  2. proxy:为空,并注释代码

实际情况

能接收群聊的消息,但是没有 OpenAI 返回的消息,等很久都没发现。(另外:服务启动很慢,不知道什么原因)

期望结果

成功调用 OpenAI 并根据接收群聊的消息返回消息。(服务和返回都比较迅速)

图示

image

使用的问题。

我在安装的过程中,使用的是神灯VPN,但是这个VPN我只知道ip,不知道端口,代理服务器的话我只知道ip,不知道端口。这样的话,配置文件该怎么写。

连接超时

[2023-05-10 19:52:51,495][MainThread/WARNING] PyCqBot: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000024448B1E3B0>, 'Connection to 50.114.56.133 timed out. (connect timeout=600)')': /v1/chat/completions
[2023-05-10 19:53:12,698][MainThread/WARNING] PyCqBot: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000024448B1E5F0>, 'Connection to 50.114.56.133 timed out. (connect timeout=600)')': /v1/chat/completions
Internet issues! Will not answer this time.
,连接节点查了ip和端口号,用的是免费的chatgpt的接口,求助,调了一下午了,

关于导入模块错误的问题

在运行qqbot.py时,出现了以下报错
Traceback (most recent call last): File "D:\Spit_chatBot\qqbot.py", line 11, in <module> from pycqBot.cqApi import cqHttpApi, cqLog ImportError: cannot import name 'cqHttpApi' from 'pycqBot.cqApi' (C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\pycqBot\cqApi.py)

文件导入奇怪问题

Uploading 屏幕截图 2023-05-24 164029.png…
如图,显示文件导入失败,但是如果运行Dbug模式的话这个bug 就会神奇消失。但是无法连接成功。用普通运行的话就会显示找不到包

[功能请求] 加入自动删除前缀功能

能不能加一个在配置文件里添加前缀关键词然后
如果在输出之前识别到要输出的文字前几个字符包含这个前缀自动删除这个前缀的功能
非常感谢🙏

连接成功但bot无回复

使用的是国外的windows server服务器搭建,已将chat.py与bot配置文件里的proxy字段相关代码全部注释,配置文件也填写完毕,运行结束之后出现如下图的情况,bot后台可以看到发给bot的消息,但bot不会回复,我无法判断这是否搭建成功,亦或者问题是出在go-cq还是qqbot,多有叨扰,但希望能得到大佬解答,谢谢
YVE$ KX)4)}NR~G2K@TZAUS

三个奇怪的问题

有两个很奇怪的问题
第一个是每次回复会有几率在语句最前面加上,号或者你:(一下子就暴漏了身份
SU7)CIRX9%1ZBJ82K%UB D
A7LXUVKCQ $I`H05V02$6
第二个是每次回复都会给主人发送一个API使用(感觉完全没有意义
)}~95C$3STG671C 802BZ0
还有个是指令识别的问题,因为群里有两个bot所以要用#触发指令。但是就会出现以下情况
Z3)1NSP%S9M7CU$Q5KOZ0_W
这不就暴漏了嘛

运行时遇到SSLError和reportMissingImports错误

UP主你好,我很感谢你分享了这个有趣的项目。我在使用它的时候遇到了一个问题,希望你能帮我解决。当我运行Spit_chatBot时,我收到了一些错误提示,如下:

[2023-05-24 23:00:41,774][MainThread/WARNING] PyCqBot: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:997)’))’: /v1/chat/completions 
[2023-05-24 23:00:42,014][MainThread/WARNING] PyCqBot: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:997)’))’: /v1/chat/completions Internet issues! 
Will not answer this time.

我不知道这是什么原因造成的,也不知道该怎么解决。请问你能给我一些指导吗?非常感谢你的帮助。
QQ图片20230524230142

这个qqbot.py和go-cqhttp冲突怎么解决

当前进程pid: 5528

#################################################################
██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██╔═══██╗██╔══██╗██╔═══██╗╚══██╔══╝
██████╔╝ ╚████╔╝ ██║ ██║ ██║██████╔╝██║ ██║ ██║
██╔═══╝ ╚██╔╝ ██║ ██║▄▄ ██║██╔══██╗██║ ██║ ██║
██║ ██║ ╚██████╗╚██████╔╝██████╔╝╚██████╔╝ ██║
╚═╝ ╚═╝ ╚═════╝ ╚══▀▀═╝ ╚═════╝ ╚═════╝ ╚═╝
v0.5.1.1 BY FengLiu
#################################################################

[2023-05-25 12:34:15,409][go-cqhttp/ERROR] PyCqBot: go-cqhttp 发生致命错误 open cache image db failed: The process cannot access the file because it is being used by another process.

这个就是问题的输出,在图片缓存库。

安装了库但是无法找到cqlog和Message

Traceback (most recent call last):
File "C:\Users\Lenovo\Desktop\JhotTest\Spit_chatBot-main\Spit_chatBot-main\qqbot.py", line 11, in
from pycqBot.cqApi import cqHttpApi, cqLog
ImportError: cannot import name 'cqHttpApi' from 'pycqBot.cqApi' (C:\Users\Lenovo\AppData\Local\Programs\Python\Python311\Lib\site-packages\pycqBot\cqApi.py)

Protocol -> unexpected disconnect: EOF协议错误

upup,孩子试了大半天,还是有这个错误,到底怎么办呐
[2023-05-11 01:39:51] [INFO]: 正在检查协议更新...
Protocol -> connect to server: 58.212.179.125:8080
[2023-05-11 01:40:06] [ERROR]: Protocol -> unexpected disconnect: EOF
[2023-05-11 01:40:06] [INFO]: Protocol -> connect to server: 180.102.191.69:8080
[2023-05-11 01:40:07] [ERROR]: Protocol -> unexpected disconnect: EOF
[2023-05-11 01:40:07] [INFO]: Protocol -> connect to server: 180.109.192.45:8080
[2023-05-11 01:40:08] [ERROR]: Protocol -> unexpected disconnect: EOF
[2023-05-11 01:40:08] [INFO]: Protocol -> connect to server: 117.62.242.81:8080
[2023-05-11 01:40:09] [ERROR]: Protocol -> unexpected disconnect: EOF
[2023-05-11 01:40:09] [INFO]: Protocol -> connect to server: [::ffff:123.151.54.194]:443
[2023-05-11 01:40:10] [ERROR]: Protocol -> parse incoming packet error: return code unsuccessful: -10005
[2023-05-11 01:40:22] [ERROR]: Protocol -> parse incoming packet error: return code unsuccessful: -10005

运行后显示缺少pycqBot模块

C:\桌面\潜伏机器人\1\Spit_chatBot>qqbot.py
Traceback (most recent call last):
File "C:\桌面\潜伏机器人\1\Spit_chatBot\qqbot.py", line 11, in
from pycqBot.cqApi import cqHttpApi, cqLog
ModuleNotFoundError: No module named 'pycqBot'
QQ图片20230514170945
也已添加了环境变量和运行了pip install pycqBot

配置文件问题,

查看pdf后发现里面需要admin_qq, bot_group_info这两个信息,请问这两个该使用的是什么qq和信息。是bot的QQ吗

期待您的回复

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.