1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-26 21:14:19 +00:00

🧹 Run reformat code on the whole repository

This commit is contained in:
Steffo 2022-03-06 17:48:16 +01:00
parent b20f20f387
commit 94d0ae7d05
Signed by: steffo
GPG key ID: 6965406171929D01
36 changed files with 736 additions and 712 deletions

1002
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,18 +1,18 @@
import logging
import pathlib
import re
import coloredlogs
import discord import discord
import pkg_resources import pkg_resources
import royalnet.engineer as engi import royalnet.engineer as engi
import royalnet.scrolls as sc import royalnet.scrolls as sc
import royalnet_telethon as rt
import royalnet_discordpy as rd import royalnet_discordpy as rd
import pathlib import royalnet_telethon as rt
import re
import coloredlogs
import sentry_sdk
import sentry_sdk.integrations.atexit import sentry_sdk.integrations.atexit
import sentry_sdk.integrations.dedupe import sentry_sdk.integrations.dedupe
import sentry_sdk.integrations.modules import sentry_sdk.integrations.modules
import sentry_sdk.integrations.threading import sentry_sdk.integrations.threading
import logging
from . import commands from . import commands
from .database import engine, base from .database import engine, base
@ -101,11 +101,13 @@ register_telegram(tg_router, commands.whoami, ["whoami"])
register_telegram(tg_router, commands.fiorygi_balance_self, ["balance"]) register_telegram(tg_router, commands.fiorygi_balance_self, ["balance"])
register_telegram(tg_router, commands.fiorygi_balance_other, ["balance"], r"(?P<target>\S+)") register_telegram(tg_router, commands.fiorygi_balance_other, ["balance"], r"(?P<target>\S+)")
register_telegram(tg_router, commands.fiorygi_give, ["give"], r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)") register_telegram(tg_router, commands.fiorygi_give, ["give"], r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)")
register_telegram(tg_router, commands.fiorygi_magick, ["magick"], r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)") register_telegram(tg_router, commands.fiorygi_magick, ["magick"],
r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)")
register_telegram(tg_router, commands.fiorygi_transactions_self, ["transactions"]) register_telegram(tg_router, commands.fiorygi_transactions_self, ["transactions"])
register_telegram(tg_router, commands.fiorygi_transactions_other, ["transactions"], r"(?P<target>\S+)") register_telegram(tg_router, commands.fiorygi_transactions_other, ["transactions"], r"(?P<target>\S+)")
register_telegram(tg_router, commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]+)") register_telegram(tg_router, commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]+)")
register_telegram(tg_router, commands.fiorygi_bury, ["bury"], r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?") register_telegram(tg_router, commands.fiorygi_bury, ["bury"],
r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?")
register_telegram(tg_router, commands.version, ["version"]) register_telegram(tg_router, commands.version, ["version"])
register_telegram(tg_router, commands.cv, ["cv", "civù"]) register_telegram(tg_router, commands.cv, ["cv", "civù"])
register_telegram(tg_router, commands.rocoinflip, ["rocoinflip"], r'"(?P<teama>[^"]+)"\s+"(?P<teamb>[^"]+)"') register_telegram(tg_router, commands.rocoinflip, ["rocoinflip"], r'"(?P<teama>[^"]+)"\s+"(?P<teamb>[^"]+)"')
@ -135,11 +137,13 @@ register_discord(ds_router, commands.whoami, ["whoami"])
register_discord(ds_router, commands.fiorygi_balance_self, ["balance"]) register_discord(ds_router, commands.fiorygi_balance_self, ["balance"])
register_discord(ds_router, commands.fiorygi_balance_other, ["balance"], r"(?P<target>\S+)") register_discord(ds_router, commands.fiorygi_balance_other, ["balance"], r"(?P<target>\S+)")
register_discord(ds_router, commands.fiorygi_give, ["give"], r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)") register_discord(ds_router, commands.fiorygi_give, ["give"], r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)")
register_discord(ds_router, commands.fiorygi_magick, ["magick"], r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)") register_discord(ds_router, commands.fiorygi_magick, ["magick"],
r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)")
register_discord(ds_router, commands.fiorygi_transactions_self, ["transactions"]) register_discord(ds_router, commands.fiorygi_transactions_self, ["transactions"])
register_discord(ds_router, commands.fiorygi_transactions_other, ["transactions"], r"(?P<target>\S+)") register_discord(ds_router, commands.fiorygi_transactions_other, ["transactions"], r"(?P<target>\S+)")
register_discord(ds_router, commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]+)") register_discord(ds_router, commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]+)")
register_discord(ds_router, commands.fiorygi_bury, ["bury"], r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?") register_discord(ds_router, commands.fiorygi_bury, ["bury"],
r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?")
register_discord(ds_router, commands.version, ["version"]) register_discord(ds_router, commands.version, ["version"])
register_discord(ds_router, commands.rocoinflip, ["rocoinflip"], r'"(?P<teama>[^"]+)"\s+"(?P<teamb>[^"]+)"') register_discord(ds_router, commands.rocoinflip, ["rocoinflip"], r'"(?P<teama>[^"]+)"\s+"(?P<teamb>[^"]+)"')
register_discord(ds_router, commands.hack, ["hack"], r'(?P<activity>.+)') register_discord(ds_router, commands.hack, ["hack"], r'(?P<activity>.+)')
@ -149,5 +153,4 @@ register_discord(ds_router, commands.loginprogress, ["loginprogress"])
pda.implementations["telethon.1"].register_conversation(tg_router) pda.implementations["telethon.1"].register_conversation(tg_router)
pda.implementations["discordpy.2"].register_conversation(ds_router) pda.implementations["discordpy.2"].register_conversation(ds_router)
pda.run() pda.run()

View file

@ -1,3 +1,3 @@
from .login import * from .login import *
from .target import *
from .sentry import * from .sentry import *
from .target import *

View file

@ -6,6 +6,7 @@ from __future__ import annotations
import functools import functools
import logging import logging
import sentry_sdk import sentry_sdk
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View file

@ -3,21 +3,21 @@ from .answer import *
from .cat import * from .cat import *
from .ciaoruozi import * from .ciaoruozi import *
from .color import * from .color import *
from .ping import * from .cv import *
from .ship import * from .diobot import *
from .emojify import *
from .dog import * from .dog import *
from .emojify import *
from .fiorygi import *
from .fortune import * from .fortune import *
from .pmots import * from .hack import *
from .spell import *
from .smecds import *
from .man import *
from .login import * from .login import *
from .loginprogress import * from .loginprogress import *
from .whoami import * from .man import *
from .fiorygi import * from .ping import *
from .version import * from .pmots import *
from .cv import *
from .rocoinflip import * from .rocoinflip import *
from .hack import * from .ship import *
from .diobot import * from .smecds import *
from .spell import *
from .version import *
from .whoami import *

View file

@ -1,4 +1,5 @@
import royalnet.engineer as engi import royalnet.engineer as engi
import royalpack.bolts as rb import royalpack.bolts as rb

View file

@ -1,8 +1,9 @@
import royalnet.engineer as engi
import royalpack.bolts as rb
import datetime import datetime
import random import random
import royalnet.engineer as engi
import royalpack.bolts as rb
ANSWERS = [ ANSWERS = [
# Cerchiamo di tenere bilanciate le tre colonne, o almeno le prime due. # Cerchiamo di tenere bilanciate le tre colonne, o almeno le prime due.

View file

@ -3,6 +3,7 @@ import logging
import aiohttp import aiohttp
import royalnet.engineer as engi import royalnet.engineer as engi
import royalpack.bolts as rb import royalpack.bolts as rb
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View file

@ -1,6 +1,7 @@
import royalnet.engineer as engi import royalnet.engineer as engi
import royalnet_telethon import royalnet_telethon
import royalnet_telethon.bullet.contents import royalnet_telethon.bullet.contents
import royalpack.bolts as rb import royalpack.bolts as rb

View file

@ -1,4 +1,5 @@
import royalnet.engineer as engi import royalnet.engineer as engi
import royalpack.bolts as rb import royalpack.bolts as rb

View file

@ -1,10 +1,12 @@
import royalnet.royaltyping as t import itertools
import royalnet.engineer as engi
import royalnet_discordpy as rd
import royalpack.bolts as rb
import discord import discord
import discord.channel import discord.channel
import itertools import royalnet.engineer as engi
import royalnet.royaltyping as t
import royalnet_discordpy as rd
import royalpack.bolts as rb
@rb.capture_errors @rb.capture_errors

View file

@ -1,8 +1,9 @@
import royalnet.engineer as engi
import royalpack.bolts as rb
import datetime
import random import random
import royalnet.engineer as engi
import royalpack.bolts as rb
WHO = [ WHO = [
# A chi sarà diretto l'insulto # A chi sarà diretto l'insulto
["Dio", "o"], ["Dio", "o"],

View file

@ -2,6 +2,7 @@ import io
import aiohttp import aiohttp
import royalnet.engineer as engi import royalnet.engineer as engi
import royalpack.bolts as rb import royalpack.bolts as rb

View file

@ -1,7 +1,8 @@
import royalnet.engineer as engi
import royalpack.bolts as rb
import random import random
import royalnet.engineer as engi
import royalpack.bolts as rb
_emojis = { _emojis = {
"abcd": ["🔡", "🔠"], "abcd": ["🔡", "🔠"],

View file

@ -1,10 +1,12 @@
import royalnet.royaltyping as t
import royalnet.engineer as engi
import royalpack.database as db
import royalpack.bolts as rb
import sqlalchemy.sql as ss
import functools import functools
import arrow import arrow
import royalnet.engineer as engi
import royalnet.royaltyping as t
import sqlalchemy.sql as ss
import royalpack.bolts as rb
import royalpack.database as db
@rb.capture_errors @rb.capture_errors

View file

@ -1,8 +1,9 @@
import royalnet.engineer as engi
import random
import datetime import datetime
import royalpack.bolts as rb import random
import royalnet.engineer as engi
import royalpack.bolts as rb
# Tutte le fortunes qui devono essere positive :) # Tutte le fortunes qui devono essere positive :)
# O almeno neutrali... # O almeno neutrali...

View file

@ -1,10 +1,9 @@
import royalnet.royaltyping as t
import royalnet.engineer as engi
import royalnet_discordpy
import royalnet_discordpy.bullet.contents
import discord import discord
import discord.http import discord.http
import royalnet.engineer as engi
import royalnet.royaltyping as t
import royalnet_discordpy
import royalnet_discordpy.bullet.contents
activities = { activities = {
"yt": 755600276941176913, "yt": 755600276941176913,

View file

@ -1,17 +1,19 @@
import discord
import royalnet.royaltyping as t
import royalnet.engineer as engi
import sqlalchemy.orm as so
import royalpack.database as db
import royalpack.config as cfg
import royalnet_telethon.bullet.contents
import royalnet_discordpy
import royalpack.bolts as rb
import aiohttp
import asyncio import asyncio
import logging import logging
import aiohttp
import arrow import arrow
import async_timeout import async_timeout
import discord
import royalnet.engineer as engi
import royalnet.royaltyping as t
import royalnet_discordpy
import royalnet_telethon.bullet.contents
import sqlalchemy.orm as so
import royalpack.bolts as rb
import royalpack.config as cfg
import royalpack.database as db
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View file

@ -1,9 +1,9 @@
import royalnet.engineer as engi import royalnet.engineer as engi
import royalpack.database as db
import sqlalchemy.orm as so import sqlalchemy.orm as so
import sqlalchemy.sql as ss import sqlalchemy.sql as ss
import royalpack.bolts as rb
import royalpack.bolts as rb
import royalpack.database as db
expected = [ expected = [
"mrdima", "mrdima",
@ -78,7 +78,6 @@ async def loginprogress(*, _msg: engi.Message, _session: so.Session, **__):
discord = list(map(_has_discord_account, expected)) discord = list(map(_has_discord_account, expected))
def _render_line(index: int) -> str: def _render_line(index: int) -> str:
def _telegram_emoji() -> str: def _telegram_emoji() -> str:
return telegram_emoji(telegram[index]) return telegram_emoji(telegram[index])

View file

@ -1,4 +1,5 @@
import royalnet.engineer as engi import royalnet.engineer as engi
import royalpack.bolts as rb import royalpack.bolts as rb

View file

@ -1,4 +1,5 @@
import royalnet.engineer as engi import royalnet.engineer as engi
import royalpack.bolts as rb import royalpack.bolts as rb

View file

@ -1,4 +1,5 @@
import royalnet.engineer as engi import royalnet.engineer as engi
import royalpack.bolts as rb import royalpack.bolts as rb

View file

@ -1,4 +1,5 @@
import random import random
import royalnet.engineer as engi import royalnet.engineer as engi

View file

@ -1,9 +1,10 @@
import logging import logging
import re import re
import royalpack.bolts as rb
import royalnet.engineer as engi import royalnet.engineer as engi
import royalpack.bolts as rb
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View file

@ -1,7 +1,8 @@
import royalnet.engineer as engi
import random import random
import royalpack.bolts as rb
import royalnet.engineer as engi
import royalpack.bolts as rb
_ds_list = ["della secca", "del seccatore", "del secchiello", "del secchio", "del secchione", "del secondino", _ds_list = ["della secca", "del seccatore", "del secchiello", "del secchio", "del secchione", "del secondino",
"del sedano", "del sedativo", "della sedia", "del sedicente", "del sedile", "della sega", "del segale", "del sedano", "del sedativo", "della sedia", "del sedicente", "del sedile", "della sega", "del segale",

View file

@ -1,5 +1,6 @@
import royalnet.engineer as engi import royalnet.engineer as engi
import royalspells import royalspells
import royalpack.bolts as rb import royalpack.bolts as rb

View file

@ -1,7 +1,8 @@
import royalnet.engineer as engi
import royalnet_telethon as rt
import royalnet_discordpy as rd
import pkg_resources import pkg_resources
import royalnet.engineer as engi
import royalnet_discordpy as rd
import royalnet_telethon as rt
import royalpack.bolts as rb import royalpack.bolts as rb
@ -21,9 +22,11 @@ async def version(*, _imp: engi.PDAImplementation, _msg: engi.Message, **__):
msg.append(f"- \uE01Croyalnet\uE00C \uE01B{pkg_resources.get_distribution('royalnet').version}\uE00B") msg.append(f"- \uE01Croyalnet\uE00C \uE01B{pkg_resources.get_distribution('royalnet').version}\uE00B")
if isinstance(_imp, rt.TelethonPDAImplementation): if isinstance(_imp, rt.TelethonPDAImplementation):
msg.append(f"- \uE01Croyalnet_telethon\uE00C \uE01B{pkg_resources.get_distribution('royalnet_telethon').version}\uE00B") msg.append(
f"- \uE01Croyalnet_telethon\uE00C \uE01B{pkg_resources.get_distribution('royalnet_telethon').version}\uE00B")
elif isinstance(_imp, rd.DiscordpyPDAImplementation): elif isinstance(_imp, rd.DiscordpyPDAImplementation):
msg.append(f"- \uE01Croyalnet_discordpy\uE00C \uE01B{pkg_resources.get_distribution('royalnet_discordpy').version}\uE00B") msg.append(
f"- \uE01Croyalnet_discordpy\uE00C \uE01B{pkg_resources.get_distribution('royalnet_discordpy').version}\uE00B")
msg.append(f"- \uE01Croyalpack\uE00C \uE01B{pkg_resources.get_distribution('royalpack').version}\uE00B") msg.append(f"- \uE01Croyalpack\uE00C \uE01B{pkg_resources.get_distribution('royalpack').version}\uE00B")

View file

@ -1,6 +1,7 @@
import royalnet.engineer as engi import royalnet.engineer as engi
import royalpack.database as db
import royalpack.bolts as rb import royalpack.bolts as rb
import royalpack.database as db
@rb.capture_errors @rb.capture_errors

View file

@ -1,11 +1,10 @@
import pathlib import pathlib
import royalnet.scrolls as s
import royalnet.lazy as l
import royalnet.lazy as l
import royalnet.scrolls as s
lazy_config = l.Lazy(lambda: s.Scroll.from_file("ROYALPACK", pathlib.Path("royalpack.cfg.toml"))) lazy_config = l.Lazy(lambda: s.Scroll.from_file("ROYALPACK", pathlib.Path("royalpack.cfg.toml")))
__all__ = ( __all__ = (
"lazy_config", "lazy_config",
) )

View file

@ -1,17 +1,14 @@
import logging.config import logging.config
import sqlalchemy
import sqlalchemy.pool
import alembic import alembic
from royalpack.config import lazy_config
from royalpack.database.base import Base from royalpack.database.base import Base
from royalpack.database.engine import lazy_engine from royalpack.database.engine import lazy_engine
from royalpack.config import lazy_config
# Set up logging # Set up logging
logging.config.fileConfig(alembic.context.config.config_file_name) logging.config.fileConfig(alembic.context.config.config_file_name)
# Get the metadata # Get the metadata
target_metadata = Base.metadata target_metadata = Base.metadata

View file

@ -6,7 +6,6 @@ Create Date: 2021-04-25 23:17:50.846179
""" """
from alembic import op from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
@ -19,14 +18,14 @@ depends_on = None
def upgrade(): def upgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### commands auto generated by Alembic - please adjust! ###
op.alter_column('fiorygi_treasures', 'find_time', op.alter_column('fiorygi_treasures', 'find_time',
existing_type=postgresql.TIMESTAMP(), existing_type=postgresql.TIMESTAMP(),
nullable=True) nullable=True)
# ### end Alembic commands ### # ### end Alembic commands ###
def downgrade(): def downgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### commands auto generated by Alembic - please adjust! ###
op.alter_column('fiorygi_treasures', 'find_time', op.alter_column('fiorygi_treasures', 'find_time',
existing_type=postgresql.TIMESTAMP(), existing_type=postgresql.TIMESTAMP(),
nullable=False) nullable=False)
# ### end Alembic commands ### # ### end Alembic commands ###

View file

@ -5,10 +5,9 @@ Revises:
Create Date: 2021-04-25 01:00:49.131019 Create Date: 2021-04-25 01:00:49.131019
""" """
from alembic import op
import sqlalchemy as sa import sqlalchemy as sa
import sqlalchemy_utils import sqlalchemy_utils
from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = 'c6aacbd5d796' revision = 'c6aacbd5d796'
@ -20,123 +19,123 @@ depends_on = None
def upgrade(): def upgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### commands auto generated by Alembic - please adjust! ###
op.create_table('titles', op.create_table('titles',
sa.Column('uuid', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False), sa.Column('uuid', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
sa.Column('name', sa.String(), nullable=False), sa.Column('name', sa.String(), nullable=False),
sa.Column('visible', sa.Boolean(), nullable=False), sa.Column('visible', sa.Boolean(), nullable=False),
sa.Column('locked_description', sa.Text(), nullable=False), sa.Column('locked_description', sa.Text(), nullable=False),
sa.Column('unlocked_description', sa.Text(), nullable=False), sa.Column('unlocked_description', sa.Text(), nullable=False),
sa.PrimaryKeyConstraint('uuid') sa.PrimaryKeyConstraint('uuid')
) )
op.create_table('users', op.create_table('users',
sa.Column('sub', sa.String(), nullable=False), sa.Column('sub', sa.String(), nullable=False),
sa.Column('last_update', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False), sa.Column('last_update', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('name', sa.String(), nullable=False), sa.Column('name', sa.String(), nullable=False),
sa.Column('nickname', sa.String(), nullable=False), sa.Column('nickname', sa.String(), nullable=False),
sa.Column('avatar', sa.String(), nullable=False), sa.Column('avatar', sa.String(), nullable=False),
sa.Column('email', sa.String(), nullable=False), sa.Column('email', sa.String(), nullable=False),
sa.Column('bio', sa.Text(), nullable=False), sa.Column('bio', sa.Text(), nullable=False),
sa.Column('color', sqlalchemy_utils.types.color.ColorType(length=20), nullable=False), sa.Column('color', sqlalchemy_utils.types.color.ColorType(length=20), nullable=False),
sa.Column('title_fk', sqlalchemy_utils.types.uuid.UUIDType(), nullable=True), sa.Column('title_fk', sqlalchemy_utils.types.uuid.UUIDType(), nullable=True),
sa.Column('fiorygi', sa.Integer(), nullable=False), sa.Column('fiorygi', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['title_fk'], ['titles.uuid'], ), sa.ForeignKeyConstraint(['title_fk'], ['titles.uuid'], ),
sa.PrimaryKeyConstraint('sub') sa.PrimaryKeyConstraint('sub')
) )
op.create_table('accounts_discord', op.create_table('accounts_discord',
sa.Column('user_fk', sa.String(), nullable=False), sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('username', sa.String(), nullable=False), sa.Column('username', sa.String(), nullable=False),
sa.Column('discriminator', sa.SmallInteger(), nullable=False), sa.Column('discriminator', sa.SmallInteger(), nullable=False),
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True), sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id') sa.PrimaryKeyConstraint('id')
) )
op.create_table('accounts_league', op.create_table('accounts_league',
sa.Column('user_fk', sa.String(), nullable=False), sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('region', sa.String(), nullable=False), sa.Column('region', sa.String(), nullable=False),
sa.Column('puuid', sa.String(), nullable=False), sa.Column('puuid', sa.String(), nullable=False),
sa.Column('summoner_name', sa.String(), nullable=False), sa.Column('summoner_name', sa.String(), nullable=False),
sa.Column('avatar_id', sa.Integer(), nullable=False), sa.Column('avatar_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('puuid') sa.PrimaryKeyConstraint('puuid')
) )
op.create_table('accounts_osu', op.create_table('accounts_osu',
sa.Column('user_fk', sa.String(), nullable=False), sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('username', sa.String(), nullable=True), sa.Column('username', sa.String(), nullable=True),
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True), sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id') sa.PrimaryKeyConstraint('id')
) )
op.create_table('accounts_steam', op.create_table('accounts_steam',
sa.Column('user_fk', sa.String(), nullable=False), sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('steamid', sa.BigInteger(), nullable=False), sa.Column('steamid', sa.BigInteger(), nullable=False),
sa.Column('persona_name', sa.String(), nullable=False), sa.Column('persona_name', sa.String(), nullable=False),
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True), sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('steamid') sa.PrimaryKeyConstraint('steamid')
) )
op.create_table('accounts_telegram', op.create_table('accounts_telegram',
sa.Column('user_fk', sa.String(), nullable=False), sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('first_name', sa.String(), nullable=False), sa.Column('first_name', sa.String(), nullable=False),
sa.Column('last_name', sa.String(), nullable=True), sa.Column('last_name', sa.String(), nullable=True),
sa.Column('username', sa.String(), nullable=True), sa.Column('username', sa.String(), nullable=True),
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True), sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id') sa.PrimaryKeyConstraint('id')
) )
op.create_table('diario_groups', op.create_table('diario_groups',
sa.Column('id', sa.Integer(), nullable=False), sa.Column('id', sa.Integer(), nullable=False),
sa.Column('saved_by_fk', sa.String(), nullable=False), sa.Column('saved_by_fk', sa.String(), nullable=False),
sa.Column('context', sa.Text(), nullable=True), sa.Column('context', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['saved_by_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['saved_by_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id') sa.PrimaryKeyConstraint('id')
) )
op.create_table('fiorygi_transactions', op.create_table('fiorygi_transactions',
sa.Column('id', sa.Integer(), nullable=False), sa.Column('id', sa.Integer(), nullable=False),
sa.Column('minus_fk', sa.String(), nullable=True), sa.Column('minus_fk', sa.String(), nullable=True),
sa.Column('plus_fk', sa.String(), nullable=True), sa.Column('plus_fk', sa.String(), nullable=True),
sa.Column('amount', sa.Integer(), nullable=False), sa.Column('amount', sa.Integer(), nullable=False),
sa.Column('reason', sa.Text(), nullable=True), sa.Column('reason', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['minus_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['minus_fk'], ['users.sub'], ),
sa.ForeignKeyConstraint(['plus_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['plus_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id') sa.PrimaryKeyConstraint('id')
) )
op.create_table('fiorygi_treasures', op.create_table('fiorygi_treasures',
sa.Column('slug', sa.String(), nullable=False), sa.Column('slug', sa.String(), nullable=False),
sa.Column('creator_fk', sa.String(), nullable=True), sa.Column('creator_fk', sa.String(), nullable=True),
sa.Column('finder_fk', sa.String(), nullable=True), sa.Column('finder_fk', sa.String(), nullable=True),
sa.Column('value', sa.Integer(), nullable=False), sa.Column('value', sa.Integer(), nullable=False),
sa.Column('message', sa.Text(), nullable=True), sa.Column('message', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['creator_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['creator_fk'], ['users.sub'], ),
sa.ForeignKeyConstraint(['finder_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['finder_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('slug') sa.PrimaryKeyConstraint('slug')
) )
op.create_table('user_aliases', op.create_table('user_aliases',
sa.Column('user_fk', sa.String(), nullable=False), sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('name', sa.String(), nullable=False), sa.Column('name', sa.String(), nullable=False),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('user_fk', 'name') sa.PrimaryKeyConstraint('user_fk', 'name')
) )
op.create_table('user_title_association', op.create_table('user_title_association',
sa.Column('user_fk', sa.String(), nullable=True), sa.Column('user_fk', sa.String(), nullable=True),
sa.Column('title_fk', sqlalchemy_utils.types.uuid.UUIDType(), nullable=True), sa.Column('title_fk', sqlalchemy_utils.types.uuid.UUIDType(), nullable=True),
sa.ForeignKeyConstraint(['title_fk'], ['titles.uuid'], ), sa.ForeignKeyConstraint(['title_fk'], ['titles.uuid'], ),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ) sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], )
) )
op.create_table('diario_lines', op.create_table('diario_lines',
sa.Column('id', sa.Integer(), nullable=False), sa.Column('id', sa.Integer(), nullable=False),
sa.Column('diario_group_fk', sa.Integer(), nullable=False), sa.Column('diario_group_fk', sa.Integer(), nullable=False),
sa.Column('text', sa.Text(), nullable=True), sa.Column('text', sa.Text(), nullable=True),
sa.Column('media_url', sqlalchemy_utils.types.url.URLType(), nullable=True), sa.Column('media_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
sa.Column('timestamp', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True), sa.Column('timestamp', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
sa.Column('spoiler', sa.String(), nullable=True), sa.Column('spoiler', sa.String(), nullable=True),
sa.Column('quoted_str', sa.String(), nullable=True), sa.Column('quoted_str', sa.String(), nullable=True),
sa.Column('quoted_user_fk', sa.String(), nullable=True), sa.Column('quoted_user_fk', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['diario_group_fk'], ['diario_groups.id'], ), sa.ForeignKeyConstraint(['diario_group_fk'], ['diario_groups.id'], ),
sa.ForeignKeyConstraint(['quoted_user_fk'], ['users.sub'], ), sa.ForeignKeyConstraint(['quoted_user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id') sa.PrimaryKeyConstraint('id')
) )
# ### end Alembic commands ### # ### end Alembic commands ###

View file

@ -5,10 +5,9 @@ Revises: c6aacbd5d796
Create Date: 2021-04-25 02:18:44.248837 Create Date: 2021-04-25 02:18:44.248837
""" """
from alembic import op
import sqlalchemy as sa import sqlalchemy as sa
import sqlalchemy_utils import sqlalchemy_utils
from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = 'e6b0d97063a1' revision = 'e6b0d97063a1'
@ -19,8 +18,10 @@ depends_on = None
def upgrade(): def upgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### commands auto generated by Alembic - please adjust! ###
op.add_column('fiorygi_transactions', sa.Column('timestamp', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True)) op.add_column('fiorygi_transactions',
op.add_column('fiorygi_treasures', sa.Column('creation_time', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False)) sa.Column('timestamp', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True))
op.add_column('fiorygi_treasures',
sa.Column('creation_time', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False))
op.add_column('fiorygi_treasures', sa.Column('find_time', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False)) op.add_column('fiorygi_treasures', sa.Column('find_time', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False))
# ### end Alembic commands ### # ### end Alembic commands ###

View file

@ -1,17 +1,17 @@
from __future__ import annotations from __future__ import annotations
import typing as t
import sqlalchemy as s
import sqlalchemy.sql as ss
import sqlalchemy.orm as so
import sqlalchemy.ext.declarative as sed
import sqlalchemy_utils as su
import royalnet.alchemist as ra
import colour
import typing as t
import colour
import royalnet.alchemist as ra
import sqlalchemy as s
import sqlalchemy.ext.declarative as sed
import sqlalchemy.orm as so
import sqlalchemy.sql as ss
import sqlalchemy_utils as su
Base: sed.declarative_base = sed.declarative_base() Base: sed.declarative_base = sed.declarative_base()
user_title_association = s.Table( user_title_association = s.Table(
"user_title_association", "user_title_association",
Base.metadata, Base.metadata,

View file

@ -1,9 +1,8 @@
import sqlalchemy.orm
import royalnet.lazy import royalnet.lazy
import sqlalchemy.orm
from ..config import * from ..config import *
lazy_engine = royalnet.lazy.Lazy(lambda c: sqlalchemy.create_engine(c["database.uri"]), c=lazy_config) lazy_engine = royalnet.lazy.Lazy(lambda c: sqlalchemy.create_engine(c["database.uri"]), c=lazy_config)
""" """
The uninitialized sqlalchemy engine. The uninitialized sqlalchemy engine.

View file

@ -7,11 +7,12 @@ Data is fetched from the `Toofz API`_, which in turn fetches it from the Steam l
.. _SteamKit: https://github.com/SteamRE/SteamKit .. _SteamKit: https://github.com/SteamRE/SteamKit
""" """
import royalnet.royaltyping as t
import aiohttp
import asyncio import asyncio
import datetime import datetime
import aiohttp
import royalnet.royaltyping as t
async def get_leaderboards_info() -> list[t.JSON]: async def get_leaderboards_info() -> list[t.JSON]:
""" """
@ -50,7 +51,8 @@ async def get_all_leaderboard_entries(lbid):
while total is None or offset < total: while total is None or offset < total:
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get(f"https://api.toofz.com/leaderboards/dailies/{lbid}/entries?offset={offset}&limit=100") as request: async with session.get(
f"https://api.toofz.com/leaderboards/dailies/{lbid}/entries?offset={offset}&limit=100") as request:
print(f"{total=} {offset=} {result=}") print(f"{total=} {offset=} {result=}")
data = await request.json() data = await request.json()
assert data["leaderboard"]["id"] == lbid assert data["leaderboard"]["id"] == lbid