Move core of "leave" command into Portal method

This commit is contained in:
Andrew Ferrazzutti 2022-05-09 03:26:40 -04:00
parent 5b16694f78
commit c90f86849e
2 changed files with 5 additions and 2 deletions

View File

@ -311,5 +311,4 @@ async def leave(evt: CommandEvent) -> None:
await evt.reply("This command may only be used in a KakaoTalk channel portal room")
return
await evt.mark_read()
await evt.sender.client.leave_channel(evt.portal.channel_props)
await evt.sender.on_channel_left(evt.portal.ktid, evt.portal.kt_type)
await evt.portal.leave_kakaotalk_channel()

View File

@ -1386,6 +1386,10 @@ class Portal(DBPortal, BasePortal):
else:
self.log.debug(f"{user.mxid} left portal to {self.ktid}")
async def leave_kakaotalk_channel(self, user: u.User) -> None:
await user.client.leave_channel(self.channel_props)
await user.on_channel_left(self.ktid, self.kt_type)
# endregion
# region KakaoTalk event handling