GraiaProject / Application

一个设计精巧, 协议实现完备的, 基于 mirai-api-http 的即时聊天软件自动化框架.
https://graia-document.vercel.app/
GNU Affero General Public License v3.0
438 stars 63 forks source link

无法正常使用本项目 #155

Closed mzqmountainn closed 2 years ago

mzqmountainn commented 3 years ago

描述你遇到的问题: 无法运行python程序

复现步骤: 该 BUG 会在进行以下操作后出现: 1.启动python程序时

发生错误的代码 为文档-入门-安装并配置开发环境中的bot.py from graia.broadcast import Broadcast from graia.application import GraiaMiraiApplication, Session from graia.application.message.chain import MessageChain import asyncio

from graia.application.message.elements.internal import Plain from graia.application.friend import Friend

loop = asyncio.get_event_loop()

bcc = Broadcast(loop=loop) app = GraiaMiraiApplication( broadcast=bcc, connect_info=Session( host="http://192.168.1.2:8080", # 填入 httpapi 服务运行的地址 authKey="INITKEYOrOSMXGG", # 填入 authKey account=1405789952, # 你的机器人的 qq 号 websocket=True # Graia 已经可以根据所配置的消息接收的方式来保证消息接收部分的正常运作. ) )

@bcc.receiver("FriendMessage") async def friend_message_listener(app: GraiaMiraiApplication, friend: Friend): await app.sendFriendMessage(friend, MessageChain.create([ Plain("Hello, World!") ]))

app.launch_blocking()

控制台日志输出截图: Traceback (most recent call last): File "D:\mirai-cli-1\bot.py", line 2, in from graia.application import GraiaMiraiApplication, Session File "D:\新建文件夹 (2)\lib\site-packages\graia\application__init__.py", line 18, in from graia.application.event.lifecycle import ( # for init lifecycle events File "D:\新建文件夹 (2)\lib\site-packages\graia\application\event\lifecycle.py", line 3, in from graia.broadcast.entities.event import Dispatchable, BaseDispatcher ImportError: cannot import name 'BaseDispatcher' from 'graia.broadcast.entities.event' (D:\新建文件夹 (2)\lib\site-packages\graia\broadcast\entities\event.py)

运行环境:

  • 操作系统: win 10
  • mirai-core 版本:
  • mirai-api-http 版本: 1.10.0
  • graia-application-mirai 版本: 最新
  • 是否出现在机器人长期运行后: 否

额外信息:

karakoo commented 3 years ago

新版的bug还未修复,可以先回退版本

147

myholiday commented 3 years ago

应该是版本问题,卸载装个低版本试试,我刚刚启动成功了 pip uninstall graia-application-mirai pip install graia-application-mirai==0.18.4