From dfe9bd94b149a6e57ec8ccdda9fc15578008e00e Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 21 Dec 2021 13:03:02 +0200 Subject: [PATCH] Fix /id command in private chats --- mautrix_telegram/abstract_user.py | 3 ++- mautrix_telegram/bot.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mautrix_telegram/abstract_user.py b/mautrix_telegram/abstract_user.py index 2957541a..3799512f 100644 --- a/mautrix_telegram/abstract_user.py +++ b/mautrix_telegram/abstract_user.py @@ -570,7 +570,8 @@ class AbstractUser(ABC): if self.is_relaybot: if update.is_private: if not self.config["bridge.relaybot.private_chat.invite"]: - self.log.debug(f"Ignoring private message to bot from {sender.id}") + if sender: + self.log.debug(f"Ignoring private message to bot from {sender.id}") return elif not portal.mxid and self.config["bridge.relaybot.ignore_unbridged_group_chat"]: self.log.debug( diff --git a/mautrix_telegram/bot.py b/mautrix_telegram/bot.py index f42dcf50..93565443 100644 --- a/mautrix_telegram/bot.py +++ b/mautrix_telegram/bot.py @@ -225,7 +225,7 @@ class Bot(AbstractUser): elif isinstance(message.to_id, PeerChat): return reply(str(-message.to_id.chat_id)) elif isinstance(message.to_id, PeerUser): - return reply(f"Your user ID is {message.from_id}.") + return reply(f"Your user ID is {message.to_id.user_id}.") else: return reply("Failed to find chat ID.")