1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-26 13:04:20 +00:00

🐛 Fix discord login bolt

This commit is contained in:
Steffo 2021-04-30 13:46:38 +02:00
parent 54465954a0
commit 9348e1fb0e
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -8,6 +8,7 @@ import functools
import logging
import royalnet.engineer as engi
import royalnet_discordpy
import royalnet_telethon
import sqlalchemy.orm as so
import sqlalchemy.sql as ss
@ -40,6 +41,13 @@ def use_ryglogin(allow_anonymous=False):
ss.select(db.TelegramAccount).where(db.TelegramAccount.id == _sender._user.id)
).scalar()
elif isinstance(_imp, royalnet_discordpy.DiscordpyPDAImplementation):
_sender = await _msg.sender
supported = True
account = _session.execute(
ss.select(db.DiscordAccount).where(db.DiscordAccount.id == _sender._user.id)
).scalar()
else:
supported = False
account = None