diff --git a/royalnet/bots/telegram.py b/royalnet/bots/telegram.py index 6ee40566..43ac64df 100644 --- a/royalnet/bots/telegram.py +++ b/royalnet/bots/telegram.py @@ -6,7 +6,7 @@ from .generic import GenericBot from ..commands import NullCommand from ..utils import asyncify, Call, Command from ..error import UnregisteredError, InvalidConfigError -from ..network import Message, RoyalnetConfig +from ..network import Message, RoyalnetConfig, Reply from ..database import DatabaseConfig loop = asyncio.get_event_loop() @@ -55,7 +55,7 @@ class TelegramBot(GenericBot): async def net_request(call, message: Message, destination: str): if self.network is None: raise InvalidConfigError("Royalnet is not enabled on this bot") - response: Message = await self.network.request(message, destination) + response: Reply = await self.network.request(message, destination) response.raise_on_error() return response diff --git a/royalnet/commands/kv.py b/royalnet/commands/kv.py index e14d554a..a006b876 100644 --- a/royalnet/commands/kv.py +++ b/royalnet/commands/kv.py @@ -18,6 +18,7 @@ class KvCommand(Command): active = await asyncify(call.session.query(call.alchemy.ActiveKvGroup).filter_by(royal=author).one_or_none) if active is None: await call.reply("⚠️ Devi prima attivare un gruppo con il comando [c]kvactive[/c]!") + return keyvalue = await asyncify(call.session.query(call.alchemy.Keyvalue).filter_by(group=active.group, key=key).one_or_none) if value is None: # Get diff --git a/royalnet/commands/sync.py b/royalnet/commands/sync.py index b8c73fa8..8e19a4dd 100644 --- a/royalnet/commands/sync.py +++ b/royalnet/commands/sync.py @@ -47,7 +47,7 @@ class SyncCommand(Command): telegram.first_name = user.first_name telegram.last_name = user.last_name telegram.username = user.username - await call.reply(f"✅ Dati di {str(telegram)} aggiornati.") + await call.reply(f"✅ Connessione aggiornata: {str(royal)} ⬌ {str(telegram)}") # Commit the session await asyncify(call.session.commit) @@ -76,6 +76,6 @@ class SyncCommand(Command): discord.username = user.name discord.discriminator = user.discriminator discord.avatar_hash = user.avatar - await call.reply(f"✅ Dati di {str(discord)} aggiornati.") + await call.reply(f"✅ Connessione aggiornata: {str(royal)} ⬌ {str(discord)}") # Commit the session await asyncify(call.session.commit) diff --git a/royalnet/royalgames.py b/royalnet/royalgames.py index 2cfb4cb5..6c15f15b 100644 --- a/royalnet/royalgames.py +++ b/royalnet/royalgames.py @@ -35,6 +35,7 @@ tg_bot = TelegramBot(telegram_config=TelegramConfig(os.environ["TG_AK"]), database_config=DatabaseConfig(os.environ["DB_PATH"], Royal, Telegram, "tg_id"), commands=commands, error_command=ErrorHandlerCommand) +print(tg_bot.botfather_command_string) loop.run_until_complete(master.start()) loop.create_task(tg_bot.run()) loop.create_task(ds_bot.run())