Skip to content

Commit

Permalink
mark seen messages
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Feb 6, 2024
1 parent 21db8be commit 1ab3f5a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions faqbot/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,18 @@ def _save(bot: Bot, accid: int, event: AttrDict) -> None:
bot.rpc.send_msg(accid, msg.chat_id, reply)


@cli.on(events.NewMessage(is_info=False))
def markseen_commands(bot: Bot, accid: int, event: AttrDict) -> None:
if not is_not_known_command(bot, event):
bot.rpc.markseen_msgs(accid, [event.msg.id])


@cli.on(events.NewMessage(is_info=False, func=is_not_known_command))
def _answer(bot: Bot, accid: int, event: AttrDict) -> None:
msg = event.msg
chat = bot.rpc.get_basic_chat_info(accid, msg.chat_id)
if chat.chat_type == const.ChatType.SINGLE:
bot.rpc.markseen_msgs(accid, [msg.id])
_help(bot, accid, event)
return
if event.command or not msg.text:
Expand Down

0 comments on commit 1ab3f5a

Please sign in to comment.