mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Fix bug due to the previous telegram refactor
This commit is contained in:
parent
d3ee249bc9
commit
1a38465d3d
2 changed files with 7 additions and 5 deletions
|
@ -1,11 +1,11 @@
|
||||||
import os
|
import os
|
||||||
import asyncio
|
import asyncio
|
||||||
from royalnet.bots import TelegramBot
|
from royalnet.bots import TelegramBot, DiscordBot
|
||||||
from royalnet.commands import *
|
from royalnet.commands import *
|
||||||
from royalnet.commands.debug_create import DebugCreateCommand
|
from royalnet.commands.debug_create import DebugCreateCommand
|
||||||
from royalnet.commands.error_handler import ErrorHandlerCommand
|
from royalnet.commands.error_handler import ErrorHandlerCommand
|
||||||
from royalnet.network import RoyalnetServer
|
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()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ commands = [PingCommand, ShipCommand, SmecdsCommand, ColorCommand, CiaoruoziComm
|
||||||
|
|
||||||
master = RoyalnetServer("localhost", 1234, "sas")
|
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)
|
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(master.run())
|
||||||
loop.create_task(tg_bot.run())
|
loop.create_task(tg_bot.run())
|
||||||
print("Commands enabled:")
|
print("Commands enabled:")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import typing
|
import typing
|
||||||
from telegram import Update, User
|
from telegram import Update, User
|
||||||
|
from discord import Message, Member
|
||||||
from ..utils import Command, Call, asyncify, UnsupportedError
|
from ..utils import Command, Call, asyncify, UnsupportedError
|
||||||
from ..database.tables import Royal, Telegram
|
from ..database.tables import Royal, Telegram
|
||||||
|
|
||||||
|
@ -35,9 +36,9 @@ class SyncCommand(Command):
|
||||||
# Avatar is WIP
|
# Avatar is WIP
|
||||||
telegram = call.alchemy.Telegram(royal=royal,
|
telegram = call.alchemy.Telegram(royal=royal,
|
||||||
tg_id=user.id,
|
tg_id=user.id,
|
||||||
tg_first_name=user.first_name,
|
first_name=user.first_name,
|
||||||
tg_last_name=user.last_name,
|
last_name=user.last_name,
|
||||||
tg_username=user.username)
|
username=user.username)
|
||||||
call.session.add(telegram)
|
call.session.add(telegram)
|
||||||
await call.reply(f"✅ Connessione completata: {str(royal)} ⬌ {str(telegram)}")
|
await call.reply(f"✅ Connessione completata: {str(royal)} ⬌ {str(telegram)}")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue