ehForwarderBot / efb-qq-plugin-go-cqhttp

Go-cqhttp Plugin for EFB QQ Slave.
GNU Affero General Public License v3.0
32 stars 20 forks source link

efb与cqhttp断线,efb可以接收消息但无法发送 #4

Closed Orokapei closed 3 years ago

Orokapei commented 3 years ago

efb与cqhttp断线,efb提示断线,但是cqhttp的消息依旧可以发送到efb,efb无法发送到cqhttp image efb extra中查询到的命令/h_1_relogin无法重登

2021-07-02 02:26:11,192 [ERROR]: efb_telegram_master (__init__.error; __init__.py:552)
    Unhandled telegram bot error!
Update {'message': {'group_chat_created': False, 'supergroup_chat_created': False, 'text': '/h_1_relogin', 'channel_chat_created': False, 'date': 1625192770, 'new_chat_members': [], 'chat': {'type': 'private', 'id': xxxxx, 'username': 'xxxxx', 'first_name': 'xxxxx'}, 'message_id': 2252, 'new_chat_photo': [], 'entities': [{'type': 'bot_command', 'length': 12, 'offset': 0}], 'photo': [], 'caption_entities': [], 'delete_chat_photo': False, 'from': {'language_code': 'zh-hans', 'is_bot': False, 'id': xxxxx, 'username': 'xxxxx', 'first_name': 'xxxxx'}}, 'update_id': 532963185} caused error 'function' object has no attribute 'name'. Exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/efb_telegram_master/__init__.py", line 480, in error
    raise error
  File "/usr/local/lib/python3.9/site-packages/telegram/ext/dispatcher.py", line 555, in process_update
    handler.handle_update(update, self, check, context)
  File "/usr/local/lib/python3.9/site-packages/telegram/ext/handler.py", line 198, in handle_update
    return self.callback(update, context)
  File "/usr/local/lib/python3.9/site-packages/efb_telegram_master/commands.py", line 219, in extra_usage
    html.escape(command.name),
AttributeError: 'function' object has no attribute 'name'

efb、efb-telegram-master、efb-qq-slave都是pip install git+ 最新commit = =

milkice233 commented 3 years ago

请给出配置

Orokapei commented 3 years ago

请给出配置

Client: GoCQHttp
GoCQHttp:
    type: HTTP
    access_token:
    api_root: http://go-cqhttp:5700
    host: 0.0.0.0
    port: 5701
# go-cqhttp 默认配置文件

account: # 账号相关
  uin: xxxxxxxx # QQ账号
  password: 'xxxxxxx' # 密码为空时使用扫码登录
  encrypt: false  # 是否开启密码加密
  status: 0      # 在线状态 请参考 https://docs.go-cqhttp.org/guide/config.html#在线状态
  relogin: # 重连设置
    delay: 3   # 首次重连延迟, 单位秒
    interval: 3   # 重连间隔
    max-times: 0  # 最大重连次数, 0为无限制

  # 是否使用服务器下发的新地址进行重连
  # 注意, 此设置可能导致在海外服务器上连接情况更差
  use-sso-address: true

heartbeat:
  # 心跳频率, 单位秒
  # -1 为关闭心跳
  interval: 5

message:
  # 上报数据类型
  # 可选: string,array
  post-format: array
  # 是否忽略无效的CQ码, 如果为假将原样发送
  ignore-invalid-cqcode: false
  # 是否强制分片发送消息
  # 分片发送将会带来更快的速度
  # 但是兼容性会有些问题
  force-fragment: false
  # 是否将url分片发送
  fix-url: false
  # 下载图片等请求网络代理
  proxy-rewrite: ''
  # 是否上报自身消息
  report-self-message: true
  # 移除服务端的Reply附带的At
  remove-reply-at: false
  # 为Reply附加更多信息
  extra-reply-data: false

output:
  # 日志等级 trace,debug,info,warn,error
  log-level: info
  # 是否启用 DEBUG
  debug: false # 开启调试模式

# 默认中间件锚点
default-middlewares: &default
  # 访问密钥, 强烈推荐在公网的服务器设置
  access-token: ''
  # 事件过滤器文件目录
  filter: ''
  # API限速设置
  # 该设置为全局生效
  # 原 cqhttp 虽然启用了 rate_limit 后缀, 但是基本没插件适配
  # 目前该限速设置为令牌桶算法, 请参考:
  # https://baike.baidu.com/item/%E4%BB%A4%E7%89%8C%E6%A1%B6%E7%AE%97%E6%B3%95/6597000?fr=aladdin
  rate-limit:
    enabled: false # 是否启用限速
    frequency: 1  # 令牌回复频率, 单位秒
    bucket: 1     # 令牌桶大小

database: # 数据库相关设置
  leveldb:
    # 是否启用内置leveldb数据库
    # 启用将会增加10-20MB的内存占用和一定的磁盘空间
    # 关闭将无法使用 撤回 回复 get_msg 等上下文相关功能
    enable: true

# 连接服务列表
servers:
  # 添加方式,同一连接方式可添加多个,具体配置说明请查看文档
  #- http: # http 通信
  #- ws:   # 正向 Websocket
  #- ws-reverse: # 反向 Websocket
  #- pprof: #性能分析服务器
  # HTTP 通信设置
  - http:
      # 服务端监听地址
      host: 0.0.0.0
      # 服务端监听端口
      port: 5700
      # 反向HTTP超时时间, 单位秒
      # 最小值为5,小于5将会忽略本项设置
      timeout: 5
      middlewares:
        <<: *default # 引用默认中间件
      # 反向HTTP POST地址列表
      post:
      - url: 'ehforwarderbot:5701' # 地址
        secret: ''           # 密钥
      #- url: 127.0.0.1:5701 # 地址
      #  secret: ''          # 密钥

ehforwarderbot是efb所在容器host,go-cqhttp是cqhttp所在容器host

milkice233 commented 3 years ago

go-cqhttp 应该不在一个 docker 内网里,最好用 docker-compose 你看日志的内容是找不到 go-cqhttp 所指向的 IP

XYenon commented 3 years ago

go-cqhttp 应该不在一个 docker 内网里,最好用 docker-compose 你看日志的内容是找不到 go-cqhttp 所指向的 IP

不是的,我本地复现出来了,看我提的 pr,是 func 外面包了一层 method 导致 func 上 set 的 attr 拿不到了

Orokapei commented 3 years ago

go-cqhttp 应该不在一个 docker 内网里,最好用 docker-compose 你看日志的内容是找不到 go-cqhttp 所指向的 IP

在的是用docker-compose一起部署的,而且是启动后是正常的,过一段时间才会这样(可能是网络波动掉线后没法重连?)

XYenon commented 3 years ago

哦这里有两个问题

  1. 找不到 go-cqhttp 的服务器
  2. 执行 extra 的命令报错

第一个问题你先看下 go-cqhttp 的日志,有没有异常退出之类的情况

Orokapei commented 3 years ago

哦这里有两个问题

  1. 找不到 go-cqhttp 的服务器
  2. 执行 extra 的命令报错

第一个问题你先看下 go-cqhttp 的日志,有没有异常退出之类的情况

但是按理说启动后可以正常使用说明两边的网络是通的,而且efb是能够接收到cqhttp的消息的,只是没法发送,因为我cqhttp没开debug所以看不到更详细的日志,只能看到如下类似的(感觉这个错误和出现的问题不相干,看起来是cqhttp发送到efb错误),我日志开了debug后再等问题复现看看^v^

[2021-07-02 02:37:59] [WARNING]: 上报Event数据 {"interval":5000,"meta_event_type":"heartbeat","post_type":"meta_event","self_id":1540042330,"status":{"app_enabled":true,"app_good":true,"app_initialized":true,"good":true,"online":true,"plugins_good":null,"stat":{"packet_received":3189,"packet_sent":3175,"packet_lost":0,"message_received":2,"message_sent":0,"disconnect_times":0,"lost_times":0,"last_message_time":1625192025}},"time":1625193479}
 到 ehforwarderbot:5701 失败: Post "http://ehforwarderbot:5701": dial tcp 172.19.0.11:5701: connect: connection refused
XYenon commented 3 years ago

看起来是 docker 的问题,和 efb,go-cqhttp 应该都没有什么关系

Orokapei commented 3 years ago

看起来是 docker 的问题,和 efb,go-cqhttp 应该都没有什么关系

好吧,晚点本地部署看看,感谢^v^

Orokapei commented 3 years ago

根据新的pr更改后已经两天没出现提示了,似乎问题已经解决(