MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    nonebot装了adapter之后连不上mirai_api_http,求助

    使用交流
    4
    7
    603
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bny-alter last edited by

      mcl目前配置好了,然后按照https://github.com/ieew/nonebot_adapter_mirai2/wiki上面的教程给两边进行了配置,之后先起mcl再起nb,结果mcl这边可以收到消息,nb那边收不到。
      请求大佬帮忙看下配置和日志,是哪里出了问题?

      mirai-api-http的配置:

      adapters: 
        - ws
      debug: false
      enableVerify: true
      verifyKey: INITKEYgdQ7LPBm
      singleMode: false
      cacheSize: 2048
      adapterSettings:
        ws:
          host: localhost
          port: 5700
      

      nb这边的.env:

      ENVIRONMENT=dev
      VERIFY_KEY=INITKEYgdQ7LPBm
      driver=~fastapi+~websockets
      
      MIRAI_HOST=127.0.0.1
      MIRAI_PORT=5700 
      MIRAI_QQ=["xxxxxxxxxx"]
      SUPERUSERS=[] 
      

      mcl这边api插件的日志:

      2023-11-29 15:17:00 W/mirai-api-http: USING INITIAL KEY, please edit the key
      2023-11-29 15:17:00 I/Mirai HTTP API: ********************************************************
      2023-11-29 15:17:00 I/MahKtorAdapter[ws]: Autoreload is disabled because the development mode is off.
      2023-11-29 15:17:00 I/MahKtorAdapter[ws]: Application started in 0.063 seconds.
      2023-11-29 15:17:00 I/MahKtorAdapter[ws]: Responding at http://localhost:5700
      2023-11-29 15:17:00 I/ws adapter: >>> [ws adapter] is listening at ws://localhost:5700
      2023-11-29 15:17:00 I/Mirai HTTP API: Http api server is running with verifyKey: INITKEYgdQ7LPBm
      2023-11-29 15:17:00 I/Mirai HTTP API: adaptors: [ws]
      2023-11-29 15:17:00 I/Mirai HTTP API: ********************************************************
      

      mcl这边接受消息的日志:

      2023-11-29 15:17:18 I/Bot.xxxxxxxxxx: Saved account secrets to local cache for fast login.
      2023-11-29 15:17:18 I/Bot.xxxxxxxxxx: Login successful.
      2023-11-29 15:17:18 V/Bot.xxxxxxxxxx: Event: BotOnlineEvent(bot=Bot(xxxxxxxxxx))
      2023-11-29 15:17:18 I/Bot.xxxxxxxxxx: Bot login successful.
      xxxx(xxxxxxxxxx) Login successful
      2023-11-29 15:17:30 V/Bot.xxxxxxxxxx: xxxx(xxxxxxxxxx) -> 1
      2023-11-29 15:17:33 V/Bot.xxxxxxxxxx: xxxx(xxxxxxxxxx) -> 121
      

      nb这边的日志:

      11-29 15:17:48 [SUCCESS] nonebot | NoneBot is initializing...
      11-29 15:17:48 [INFO] nonebot | Current Env: dev
      11-29 15:17:48 [DEBUG] nonebot | Loaded Config: {'driver': '~fastapi', 'host': IPv4Address('127.0.0.1'), 'port': 8080, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': set(), 'nickname': set(), 'command_start': {'/'}, 'command_sep': {'.'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'mirai_host': '127.0.0.1', 'mirai_qq': ['xxxxxxxxxx'], 'verify_key': 'INITKEYgdQ7LPBm', 'mirai_port': 5700, 'environment': 'dev'}
      11-29 15:17:48 [DEBUG] nonebot | Succeeded to load adapter "mirai2"
      11-29 15:17:48 [SUCCESS] nonebot | Succeeded to load plugin "test" from "src.plugins.test"
      11-29 15:17:48 [WARNING] __main__ | Always use `nb run` to start the bot instead of manually running!
      11-29 15:17:48 [SUCCESS] nonebot | Running NoneBot...
      11-29 15:17:48 [DEBUG] nonebot | Loaded adapters: mirai2
      11-29 15:17:49 [INFO] uvicorn | Started server process [21180]
      11-29 15:17:49 [INFO] uvicorn | Waiting for application startup.
      11-29 15:17:49 [INFO] uvicorn | Application startup complete.
      11-29 15:17:49 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:8080 (Press CTRL+C to quit)
      
      1 Reply Last reply Reply Quote 0
      • Mr.喜
        Mr.喜 ⭐2021⭐ last edited by

        试试把mirai这边的监听换成127.0.0.1?

        B 1 Reply Last reply Reply Quote 0
        • B
          bny-alter @Mr.喜 last edited by

          @Mr-喜 改成127.0.0.1了,还是不行。之前两边也都试过localhost、127.0.0.1和0.0.0.0,都没成功。
          另外我把mirai-api-http里面的http监听加上去了,about页面可以正常打开,是不是说明我的mirai-api-http服务起得没有问题?

          Mr.喜 1 Reply Last reply Reply Quote 0
          • Mr.喜
            Mr.喜 ⭐2021⭐ @bny-alter last edited by

            @bny-alter mirai这边能看到监听ip和端口应该就没问题,nb我没用过,所以也提不出什么建议,抱歉啦

            B 1 Reply Last reply Reply Quote 0
            • B
              bny-alter @Mr.喜 last edited by

              @Mr-喜 还是谢谢你ღ( ´・ᴗ・` )

              1 Reply Last reply Reply Quote 0
              • S
                smoadrareun last edited by

                image.png
                感觉像是nonebot的websocket没开起来?

                1 Reply Last reply Reply Quote 0
                • fate0361
                  fate0361 last edited by

                  你看下nb的日志用的是8080端口,试试.env里加多一行
                  HOST=127.0.0.1 # nonebot 的 ip
                  PORT=5701 # nonebot 的端口
                  可能是8080端口已经被占用了

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact