Fix small mistakes
This commit is contained in:
@@ -74,7 +74,12 @@ async def id(evt: CommandEvent) -> Dict:
|
|||||||
portal = po.Portal.get_by_mxid(evt.room_id)
|
portal = po.Portal.get_by_mxid(evt.room_id)
|
||||||
if not portal:
|
if not portal:
|
||||||
return await evt.reply("This is not a portal room.")
|
return await evt.reply("This is not a portal room.")
|
||||||
await evt.reply(f"This room is bridged to Telegram chat ID `{portal.tgid}`.")
|
tgid = portal.tgid
|
||||||
|
if portal.peer_type == "chat":
|
||||||
|
tgid = -tgid
|
||||||
|
elif portal.peer_type == "channel":
|
||||||
|
tgid = f"-100{tgid}"
|
||||||
|
await evt.reply(f"This room is bridged to Telegram chat ID `{tgid}`.")
|
||||||
|
|
||||||
|
|
||||||
@command_handler(help_section=SECTION_PORTAL_MANAGEMENT,
|
@command_handler(help_section=SECTION_PORTAL_MANAGEMENT,
|
||||||
|
|||||||
@@ -1841,9 +1841,11 @@ class Portal:
|
|||||||
del self.by_tgid[self.tgid_full]
|
del self.by_tgid[self.tgid_full]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
existing = self.by_tgid[(new_id, new_id)]
|
try:
|
||||||
if existing:
|
existing = self.by_tgid[(new_id, new_id)]
|
||||||
existing.delete()
|
existing.delete()
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
self.db_instance.update(tgid=new_id, tg_receiver=new_id)
|
self.db_instance.update(tgid=new_id, tg_receiver=new_id)
|
||||||
old_id = self.tgid
|
old_id = self.tgid
|
||||||
self.tgid = new_id
|
self.tgid = new_id
|
||||||
|
|||||||
Reference in New Issue
Block a user