Skip to content

Commit

Permalink
fix bug in on_core_event()
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Mar 26, 2024
1 parent 52e5884 commit 1c2bc55
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions text2img_bot/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ def on_core_event(bot: Bot, accid: int, event: AttrDict) -> None:
elif event.kind == EventType.MSG_DELIVERED:
bot.rpc.delete_messages(accid, [event.msg_id])
elif event.kind == EventType.SECUREJOIN_INVITER_PROGRESS:
if event.progress == 1000 and not bot.rpc.get_contact(event.contact_id).is_bot:
bot.logger.debug("QR scanned by contact id=%s", event.contact_id)
chatid = bot.rpc.create_chat_by_contact_id(accid, event.contact_id)
bot.rpc.send_msg(accid, chatid, {"text": HELP})
if event.progress == 1000:
if not bot.rpc.get_contact(accid, event.contact_id).is_bot:
bot.logger.debug("QR scanned by contact id=%s", event.contact_id)
chatid = bot.rpc.create_chat_by_contact_id(accid, event.contact_id)
bot.rpc.send_msg(accid, chatid, {"text": HELP})


@cli.on(events.NewMessage(is_bot=None))
Expand Down

0 comments on commit 1c2bc55

Please sign in to comment.