@@ -93,7 +93,7 @@ def __init__(
9393
9494 self .api : MisskeyAPI | None = None
9595 self ._running = False
96- self .client_self_id = ""
96+ self .bot_self_id = ""
9797 self ._bot_username = ""
9898 self ._user_cache = {}
9999
@@ -138,10 +138,10 @@ async def run(self) -> None:
138138
139139 try :
140140 user_info = await self .api .get_current_user ()
141- self .client_self_id = str (user_info .get ("id" , "" ))
141+ self .bot_self_id = str (user_info .get ("id" , "" ))
142142 self ._bot_username = user_info .get ("username" , "" )
143143 logger .info (
144- f"[Misskey] 已连接用户: { self ._bot_username } (ID: { self .client_self_id } )" ,
144+ f"[Misskey] 已连接用户: { self ._bot_username } (ID: { self .bot_self_id } )" ,
145145 )
146146 except Exception as e :
147147 logger .error (f"[Misskey] 获取用户信息失败: { e } " )
@@ -312,9 +312,9 @@ async def _handle_chat_message(self, data: dict[str, Any]) -> None:
312312 )
313313 room_id = data .get ("toRoomId" )
314314 logger .debug (
315- f"[Misskey] 收到聊天事件: sender_id={ sender_id } , room_id={ room_id } , is_self={ sender_id == self .client_self_id } " ,
315+ f"[Misskey] 收到聊天事件: sender_id={ sender_id } , room_id={ room_id } , is_self={ sender_id == self .bot_self_id } " ,
316316 )
317- if sender_id == self .client_self_id :
317+ if sender_id == self .bot_self_id :
318318 return
319319
320320 if room_id :
@@ -354,13 +354,13 @@ def _is_bot_mentioned(self, note: dict[str, Any]) -> bool:
354354 mentions = note .get ("mentions" , [])
355355 if self ._bot_username and f"@{ self ._bot_username } " in text :
356356 return True
357- if self .client_self_id in [str (uid ) for uid in mentions ]:
357+ if self .bot_self_id in [str (uid ) for uid in mentions ]:
358358 return True
359359
360360 reply = note .get ("reply" )
361361 if reply and isinstance (reply , dict ):
362362 reply_user_id = str (reply .get ("user" , {}).get ("id" , "" ))
363- if reply_user_id == self .client_self_id :
363+ if reply_user_id == self .bot_self_id :
364364 return bool (self ._bot_username and f"@{ self ._bot_username } " in text )
365365
366366 return False
@@ -598,7 +598,7 @@ async def _upload_comp(comp) -> object | None:
598598 visibility , visible_user_ids = resolve_message_visibility (
599599 user_id = user_id_for_cache ,
600600 user_cache = self ._user_cache ,
601- self_id = self .client_self_id ,
601+ self_id = self .bot_self_id ,
602602 default_visibility = self .default_visibility ,
603603 )
604604 logger .debug (
@@ -637,14 +637,14 @@ async def convert_message(self, raw_data: dict[str, Any]) -> AstrBotMessage:
637637 message = create_base_message (
638638 raw_data ,
639639 sender_info ,
640- self .client_self_id ,
640+ self .bot_self_id ,
641641 is_chat = False ,
642642 )
643643 cache_user_info (
644644 self ._user_cache ,
645645 sender_info ,
646646 raw_data ,
647- self .client_self_id ,
647+ self .bot_self_id ,
648648 is_chat = False ,
649649 )
650650
@@ -656,7 +656,7 @@ async def convert_message(self, raw_data: dict[str, Any]) -> AstrBotMessage:
656656 message ,
657657 raw_text ,
658658 self ._bot_username ,
659- self .client_self_id ,
659+ self .bot_self_id ,
660660 )
661661 message_parts .extend (text_parts )
662662
@@ -685,14 +685,14 @@ async def convert_chat_message(self, raw_data: dict[str, Any]) -> AstrBotMessage
685685 message = create_base_message (
686686 raw_data ,
687687 sender_info ,
688- self .client_self_id ,
688+ self .bot_self_id ,
689689 is_chat = True ,
690690 )
691691 cache_user_info (
692692 self ._user_cache ,
693693 sender_info ,
694694 raw_data ,
695- self .client_self_id ,
695+ self .bot_self_id ,
696696 is_chat = True ,
697697 )
698698
@@ -713,7 +713,7 @@ async def convert_room_message(self, raw_data: dict[str, Any]) -> AstrBotMessage
713713 message = create_base_message (
714714 raw_data ,
715715 sender_info ,
716- self .client_self_id ,
716+ self .bot_self_id ,
717717 is_chat = False ,
718718 room_id = room_id ,
719719 )
@@ -722,10 +722,10 @@ async def convert_room_message(self, raw_data: dict[str, Any]) -> AstrBotMessage
722722 self ._user_cache ,
723723 sender_info ,
724724 raw_data ,
725- self .client_self_id ,
725+ self .bot_self_id ,
726726 is_chat = False ,
727727 )
728- cache_room_info (self ._user_cache , raw_data , self .client_self_id )
728+ cache_room_info (self ._user_cache , raw_data , self .bot_self_id )
729729
730730 raw_text = raw_data .get ("text" , "" )
731731 message_parts = []
@@ -736,7 +736,7 @@ async def convert_room_message(self, raw_data: dict[str, Any]) -> AstrBotMessage
736736 message ,
737737 raw_text ,
738738 self ._bot_username ,
739- self .client_self_id ,
739+ self .bot_self_id ,
740740 )
741741 message_parts .extend (text_parts )
742742 else :
0 commit comments