|
@@ -119,6 +119,10 @@ class ChattoAdapter(BasePlatformAdapter):
|
|
|
# SDK runtime handle (injected by Hermes); annotate for Pylance
|
|
# SDK runtime handle (injected by Hermes); annotate for Pylance
|
|
|
self.sdk: Any = getattr(self, "sdk", None)
|
|
self.sdk: Any = getattr(self, "sdk", None)
|
|
|
|
|
|
|
|
|
|
+ # Our own user, filled in by connect(). Events arriving before connect()
|
|
|
|
|
+ # completes must not blow up on an undefined attribute.
|
|
|
|
|
+ self.me: Optional[User] = None
|
|
|
|
|
+
|
|
|
# --- Runtime state ---
|
|
# --- Runtime state ---
|
|
|
self._user_id: str = ""
|
|
self._user_id: str = ""
|
|
|
self._user_display: str = ""
|
|
self._user_display: str = ""
|
|
@@ -430,7 +434,7 @@ class ChattoAdapter(BasePlatformAdapter):
|
|
|
logger.info("message_body: %s room_kind: %s", message_body, room_kind)
|
|
logger.info("message_body: %s room_kind: %s", message_body, room_kind)
|
|
|
|
|
|
|
|
mentioned = False
|
|
mentioned = False
|
|
|
- if (room_kind == RoomKind.CHANNEL and self.chatto_config.require_mention.value):
|
|
|
|
|
|
|
+ if (room_kind == RoomKind.CHANNEL and self.chatto_config.require_mention.value and self.me):
|
|
|
if self.me.login and not mentioned:
|
|
if self.me.login and not mentioned:
|
|
|
mentioned = bool(f"@{self.me.login}" in message_body)
|
|
mentioned = bool(f"@{self.me.login}" in message_body)
|
|
|
if self.me.display_name and not mentioned:
|
|
if self.me.display_name and not mentioned:
|
|
@@ -494,7 +498,7 @@ class ChattoAdapter(BasePlatformAdapter):
|
|
|
# Self-event filter — the actor_id on the envelope is authoritative
|
|
# Self-event filter — the actor_id on the envelope is authoritative
|
|
|
# (chattolib does NOT filter this itself; see chatto-bridge notes).
|
|
# (chattolib does NOT filter this itself; see chatto-bridge notes).
|
|
|
actor_id = event.actor_id
|
|
actor_id = event.actor_id
|
|
|
- if actor_id and actor_id == self.me.id:
|
|
|
|
|
|
|
+ if actor_id and self.me and actor_id == self.me.id:
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
await self._dispatch_message_posted(event_payload)
|
|
await self._dispatch_message_posted(event_payload)
|