diff --git a/tg/controllers.py b/tg/controllers.py index 71bcdae..92e68cb 100644 --- a/tg/controllers.py +++ b/tg/controllers.py @@ -104,13 +104,13 @@ class Controller: "p": lambda _: self.forward_msgs(), } - def forward_msgs(self, _: int): + def forward_msgs(self): # TODO: check flag chat_id = self.model.chats.id_by_index(self.model.current_chat) if not chat_id: return from_chat_id, msg_ids = self.model.yanked_msgs - if from_chat_id is None: + if not msg_ids: return self.tg.forward_msgs(chat_id, from_chat_id, msg_ids) self.present_info(f"Forwarded {len(msg_ids)} messages") @@ -139,7 +139,6 @@ class Controller: self.model.selected[chat_id].append(msg.msg_id) self.model.next_msg() self.refresh_msgs() - self.present_info("Removed selections") def discard_selected_msgs(self): chat_id = self.model.chats.id_by_index(self.model.current_chat) @@ -147,6 +146,7 @@ class Controller: return self.model.selected[chat_id] = [] self.refresh_msgs() + self.present_info("Discarded selected messages") def jump_bottom(self): if self.model.jump_bottom(): diff --git a/tg/models.py b/tg/models.py index a9e18cd..91758ec 100644 --- a/tg/models.py +++ b/tg/models.py @@ -17,7 +17,7 @@ class Model: self.current_chat = 0 self.downloads: Dict[int, Tuple[int, int]] = {} self.selected: Dict[int, List[int]] = defaultdict(list) - self.yanked_msgs: Tuple[Optional[int], List[int]] = (None, []) + self.yanked_msgs: Tuple[int, List[int]] = (0, []) def get_me(self): return self.users.get_me()