Lanly109 / headimg_generator

基于HoshinoBot的制作头像相关的表情包插件,移植自nonebot-plugin-petpet
MIT License
50 stars 11 forks source link

AttributeError: 'Event' object has no attribute 'to_me' #48

Closed WindStill closed 9 months ago

WindStill commented 9 months ago

Event对象没有to_me属性,把event.to_me换成event['to_me']也不行。这个地方的判断有没有其他方式实现?

71DFBD1AC1AAF24087E4C2106F5337B1

[2023-11-30 17:52:58,788 头像表情包] ERROR: <class 'AttributeError'> occured when
 handle handling message 1740221763.                                             
[2023-11-30 17:52:58,788 头像表情包] ERROR: 'Event' object has no attribute 'to_m
e'                                                                               
Traceback (most recent call last):                                               
  File "/HoshinoBot/hoshino/service.py", line 189, in wrapper                    
    return await func(self.bot, ctx)                                             
  File "/HoshinoBot/hoshino/modules/headimg_generator/__init__.py", line 332, in 
handle                                                                           
    split_msg = await split_msg_v11(bot, ev, msg, meme, trigger)                 
  File "/HoshinoBot/hoshino/modules/headimg_generator/depends.py", line 73, in sp
lit_msg_v11                                                                      
    restore_last_at_me_seg(event, msg)                                           
  File "/HoshinoBot/hoshino/modules/headimg_generator/depends.py", line 29, in re
store_last_at_me_seg                                                             
    if event.to_me:                                                              
AttributeError: 'Event' object has no attribute 'to_me' 
Lanly109 commented 9 months ago

to_menonebot2才有的,这里貌似不需要restore_last_at_me_seg这个函数,它貌似不会吞掉at的消息,不需要restore

WindStill commented 9 months ago

to_menonebot2才有的,这里貌似不需要restore_last_at_me_seg这个函数,它貌似不会吞掉at的消息,不需要restore

好的,多谢。已经去掉了 restore_last_at_me_seg