diff --git a/royalpack/bolts/login.py b/royalpack/bolts/login.py index 4d1d8d64..8b3fc93b 100644 --- a/royalpack/bolts/login.py +++ b/royalpack/bolts/login.py @@ -3,13 +3,15 @@ """ from __future__ import annotations -import typing as t + import functools +import logging + +import royalnet.engineer as engi +import royalnet_telethon import sqlalchemy.orm as so import sqlalchemy.sql as ss -import royalnet.engineer as engi -import logging -import royalnet_telethon + import royalpack.database as db log = logging.getLogger(__name__) @@ -26,6 +28,7 @@ def use_ryglogin(allow_anonymous=False): an error instead. :return: The decorator to use to decorate the function. """ + def decorator(f): @functools.wraps(f) async def decorated(_session: so.Session, _imp: engi.PDAImplementation, _msg: engi.Message, **f_kwargs): @@ -56,7 +59,9 @@ def use_ryglogin(allow_anonymous=False): return return await f(_session=_session, _imp=_imp, _msg=_msg, **f_kwargs, _account=account, _user=user) + return decorated + return decorator diff --git a/royalpack/commands/cat.py b/royalpack/commands/cat.py index dbb98501..e48bfa16 100644 --- a/royalpack/commands/cat.py +++ b/royalpack/commands/cat.py @@ -1,8 +1,8 @@ -import royalnet.engineer as engi -import royalnet.engineer.conversation as c -import aiohttp -import logging import io +import logging + +import aiohttp +import royalnet.engineer as engi log = logging.getLogger(__name__) diff --git a/royalpack/commands/color.py b/royalpack/commands/color.py index 4dfd27c6..d0ab2e4d 100644 --- a/royalpack/commands/color.py +++ b/royalpack/commands/color.py @@ -1,5 +1,4 @@ import royalnet.engineer as engi -import royalnet.engineer.conversation as c @engi.TeleportingConversation @@ -7,7 +6,7 @@ async def color(*, _msg: engi.Message, **__): """ Invia un colore in chat...? """ - + await _msg.reply( text="I am sorry, unknown error occured during working with your request, Admin were notified" ) diff --git a/royalpack/commands/dog.py b/royalpack/commands/dog.py index 360df3ac..11f37a6b 100644 --- a/royalpack/commands/dog.py +++ b/royalpack/commands/dog.py @@ -1,7 +1,8 @@ -import royalnet.engineer as engi -import aiohttp import io +import aiohttp +import royalnet.engineer as engi + @engi.TeleportingConversation async def dog_any(*, _msg: engi.Message, **__): diff --git a/royalpack/commands/login.py b/royalpack/commands/login.py index 035d1195..b398be46 100644 --- a/royalpack/commands/login.py +++ b/royalpack/commands/login.py @@ -10,9 +10,9 @@ import logging import arrow import async_timeout - log = logging.getLogger(__name__) + # FIXME: Properly handle errors in this function! @@ -22,6 +22,7 @@ async def login(*, _msg: engi.Message, _session: so.Session, _imp, **__): """ Fai il login al tuo RYGaccount. """ + log.debug("Evaluating config...") config = cfg.lazy_config.evaluate() @@ -140,10 +141,10 @@ async def prompt_login(channel: engi.Channel, verification_url: str, user_code: log.debug("Asking user to login...") await channel.send_message( - text=f"🌍 Effettua il RYGlogin al seguente URL, poi premi Confirm:\n" - f"{verification_url}\n" - f"\n" - f"(Codice: {user_code})" + text=f"🌍 Effettua il RYGlogin al seguente URL, poi premi Confirm:\n" + f"{verification_url}\n" + f"\n" + f"(Codice: {user_code})" ) diff --git a/royalpack/commands/ship.py b/royalpack/commands/ship.py index ec97d9be..87fa9212 100644 --- a/royalpack/commands/ship.py +++ b/royalpack/commands/ship.py @@ -1,7 +1,8 @@ -import royalnet.engineer as engi import logging import re +import royalnet.engineer as engi + log = logging.getLogger(__name__)