1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Fix bug due to the previous telegram refactor

This commit is contained in:
Steffo 2019-04-11 19:04:49 +02:00
parent d3ee249bc9
commit 1a38465d3d
2 changed files with 7 additions and 5 deletions

View file

@ -1,11 +1,11 @@
import os
import asyncio
from royalnet.bots import TelegramBot
from royalnet.bots import TelegramBot, DiscordBot
from royalnet.commands import *
from royalnet.commands.debug_create import DebugCreateCommand
from royalnet.commands.error_handler import ErrorHandlerCommand
from royalnet.network import RoyalnetServer
from royalnet.database.tables import Royal, Telegram
from royalnet.database.tables import Royal, Telegram, Discord
loop = asyncio.get_event_loop()
@ -15,6 +15,7 @@ commands = [PingCommand, ShipCommand, SmecdsCommand, ColorCommand, CiaoruoziComm
master = RoyalnetServer("localhost", 1234, "sas")
tg_bot = TelegramBot(os.environ["TG_AK"], "localhost:1234", "sas", commands, os.environ["DB_PATH"], Royal, Telegram, "tg_id", error_command=ErrorHandlerCommand)
ds_bot = DiscordBot(os.environ["DS_AK"], "localhost:1234", "sas", commands, os.environ["DB_PATH"], Royal, Discord, "discord_ig", error_command=ErrorHandlerCommand)
loop.create_task(master.run())
loop.create_task(tg_bot.run())
print("Commands enabled:")

View file

@ -1,5 +1,6 @@
import typing
from telegram import Update, User
from discord import Message, Member
from ..utils import Command, Call, asyncify, UnsupportedError
from ..database.tables import Royal, Telegram
@ -35,9 +36,9 @@ class SyncCommand(Command):
# Avatar is WIP
telegram = call.alchemy.Telegram(royal=royal,
tg_id=user.id,
tg_first_name=user.first_name,
tg_last_name=user.last_name,
tg_username=user.username)
first_name=user.first_name,
last_name=user.last_name,
username=user.username)
call.session.add(telegram)
await call.reply(f"✅ Connessione completata: {str(royal)}{str(telegram)}")
else: