mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 11:34:18 +00:00
🧹 Cleanup code a bit
This commit is contained in:
parent
8961b58078
commit
093618bc39
1 changed files with 10 additions and 5 deletions
|
@ -210,7 +210,6 @@ async def register_user_telethon(
|
||||||
return tg
|
return tg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@engi.use_database(db.lazy_session_class)
|
@engi.use_database(db.lazy_session_class)
|
||||||
@engi.TeleportingConversation
|
@engi.TeleportingConversation
|
||||||
async def login(*, _msg: engi.Message, _session: so.Session, _imp, **__):
|
async def login(*, _msg: engi.Message, _session: so.Session, _imp, **__):
|
||||||
|
@ -261,6 +260,12 @@ async def login(*, _msg: engi.Message, _session: so.Session, _imp, **__):
|
||||||
|
|
||||||
user = await register_user_generic(session=_session, user_info=ui)
|
user = await register_user_generic(session=_session, user_info=ui)
|
||||||
|
|
||||||
|
log.debug(f"Committing session...")
|
||||||
|
_session.commit()
|
||||||
|
|
||||||
|
log.debug(f"Done, notifying the user...")
|
||||||
|
await private.send_message(text=f"✅ Login riuscito! Sei loggato come {user.name}!")
|
||||||
|
|
||||||
if isinstance(_imp, royalnet_telethon.TelethonPDAImplementation):
|
if isinstance(_imp, royalnet_telethon.TelethonPDAImplementation):
|
||||||
sender = await _msg.sender
|
sender = await _msg.sender
|
||||||
tg = await register_user_telethon(session=_session, user_info=ui, telethon_user=sender._user)
|
tg = await register_user_telethon(session=_session, user_info=ui, telethon_user=sender._user)
|
||||||
|
@ -269,7 +274,7 @@ async def login(*, _msg: engi.Message, _session: so.Session, _imp, **__):
|
||||||
_session.commit()
|
_session.commit()
|
||||||
|
|
||||||
log.debug(f"Done, notifying the user...")
|
log.debug(f"Done, notifying the user...")
|
||||||
await private.send_message(text=f"✅ Login riuscito! Sei loggato come {user.name}!")
|
await private.send_message(text=f"↔️ Sincronizzazione con Telegram riuscita! Sei loggato come {tg.mention()}!")
|
||||||
|
|
||||||
|
|
||||||
__all__ = ("login",)
|
__all__ = ("login",)
|
||||||
|
|
Loading…
Reference in a new issue