mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-26 13:04:20 +00:00
🧹 Run reformat code on the whole repository
This commit is contained in:
parent
b20f20f387
commit
94d0ae7d05
36 changed files with 736 additions and 712 deletions
1002
poetry.lock
generated
1002
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,18 +1,18 @@
|
|||
import logging
|
||||
import pathlib
|
||||
import re
|
||||
|
||||
import coloredlogs
|
||||
import discord
|
||||
import pkg_resources
|
||||
import royalnet.engineer as engi
|
||||
import royalnet.scrolls as sc
|
||||
import royalnet_telethon as rt
|
||||
import royalnet_discordpy as rd
|
||||
import pathlib
|
||||
import re
|
||||
import coloredlogs
|
||||
import sentry_sdk
|
||||
import royalnet_telethon as rt
|
||||
import sentry_sdk.integrations.atexit
|
||||
import sentry_sdk.integrations.dedupe
|
||||
import sentry_sdk.integrations.modules
|
||||
import sentry_sdk.integrations.threading
|
||||
import logging
|
||||
|
||||
from . import commands
|
||||
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_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_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_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_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.cv, ["cv", "civù"])
|
||||
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_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_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_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_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.rocoinflip, ["rocoinflip"], r'"(?P<teama>[^"]+)"\s+"(?P<teamb>[^"]+)"')
|
||||
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["discordpy.2"].register_conversation(ds_router)
|
||||
|
||||
|
||||
pda.run()
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
from .login import *
|
||||
from .target import *
|
||||
from .sentry import *
|
||||
from .target import *
|
||||
|
|
|
@ -6,6 +6,7 @@ from __future__ import annotations
|
|||
|
||||
import functools
|
||||
import logging
|
||||
|
||||
import sentry_sdk
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -3,21 +3,21 @@ from .answer import *
|
|||
from .cat import *
|
||||
from .ciaoruozi import *
|
||||
from .color import *
|
||||
from .ping import *
|
||||
from .ship import *
|
||||
from .emojify import *
|
||||
from .cv import *
|
||||
from .diobot import *
|
||||
from .dog import *
|
||||
from .emojify import *
|
||||
from .fiorygi import *
|
||||
from .fortune import *
|
||||
from .pmots import *
|
||||
from .spell import *
|
||||
from .smecds import *
|
||||
from .man import *
|
||||
from .hack import *
|
||||
from .login import *
|
||||
from .loginprogress import *
|
||||
from .whoami import *
|
||||
from .fiorygi import *
|
||||
from .version import *
|
||||
from .cv import *
|
||||
from .man import *
|
||||
from .ping import *
|
||||
from .pmots import *
|
||||
from .rocoinflip import *
|
||||
from .hack import *
|
||||
from .diobot import *
|
||||
from .ship import *
|
||||
from .smecds import *
|
||||
from .spell import *
|
||||
from .version import *
|
||||
from .whoami import *
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalpack.bolts as rb
|
||||
import datetime
|
||||
import random
|
||||
|
||||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
ANSWERS = [
|
||||
# Cerchiamo di tenere bilanciate le tre colonne, o almeno le prime due.
|
||||
|
|
|
@ -3,6 +3,7 @@ import logging
|
|||
|
||||
import aiohttp
|
||||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalnet_telethon
|
||||
import royalnet_telethon.bullet.contents
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import royalnet.royaltyping as t
|
||||
import royalnet.engineer as engi
|
||||
import royalnet_discordpy as rd
|
||||
import royalpack.bolts as rb
|
||||
import itertools
|
||||
|
||||
import discord
|
||||
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
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalpack.bolts as rb
|
||||
import datetime
|
||||
import random
|
||||
|
||||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
WHO = [
|
||||
# A chi sarà diretto l'insulto
|
||||
["Dio", "o"],
|
||||
|
|
|
@ -2,6 +2,7 @@ import io
|
|||
|
||||
import aiohttp
|
||||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalpack.bolts as rb
|
||||
import random
|
||||
|
||||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
_emojis = {
|
||||
"abcd": ["🔡", "🔠"],
|
||||
|
|
|
@ -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 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
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import royalnet.engineer as engi
|
||||
import random
|
||||
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 :)
|
||||
# O almeno neutrali...
|
||||
|
|
|
@ -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.http
|
||||
|
||||
import royalnet.engineer as engi
|
||||
import royalnet.royaltyping as t
|
||||
import royalnet_discordpy
|
||||
import royalnet_discordpy.bullet.contents
|
||||
|
||||
activities = {
|
||||
"yt": 755600276941176913,
|
||||
|
|
|
@ -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 logging
|
||||
|
||||
import aiohttp
|
||||
import arrow
|
||||
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__)
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalpack.database as db
|
||||
import sqlalchemy.orm as so
|
||||
import sqlalchemy.sql as ss
|
||||
import royalpack.bolts as rb
|
||||
|
||||
import royalpack.bolts as rb
|
||||
import royalpack.database as db
|
||||
|
||||
expected = [
|
||||
"mrdima",
|
||||
|
@ -78,7 +78,6 @@ async def loginprogress(*, _msg: engi.Message, _session: so.Session, **__):
|
|||
discord = list(map(_has_discord_account, expected))
|
||||
|
||||
def _render_line(index: int) -> str:
|
||||
|
||||
def _telegram_emoji() -> str:
|
||||
return telegram_emoji(telegram[index])
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import random
|
||||
|
||||
import royalnet.engineer as engi
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import logging
|
||||
import re
|
||||
import royalpack.bolts as rb
|
||||
|
||||
import royalnet.engineer as engi
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import royalnet.engineer as engi
|
||||
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",
|
||||
"del sedano", "del sedativo", "della sedia", "del sedicente", "del sedile", "della sega", "del segale",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalspells
|
||||
|
||||
import royalpack.bolts as rb
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalnet_telethon as rt
|
||||
import royalnet_discordpy as rd
|
||||
import pkg_resources
|
||||
import royalnet.engineer as engi
|
||||
import royalnet_discordpy as rd
|
||||
import royalnet_telethon as rt
|
||||
|
||||
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")
|
||||
|
||||
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):
|
||||
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")
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalpack.database as db
|
||||
|
||||
import royalpack.bolts as rb
|
||||
import royalpack.database as db
|
||||
|
||||
|
||||
@rb.capture_errors
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
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")))
|
||||
|
||||
|
||||
__all__ = (
|
||||
"lazy_config",
|
||||
)
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
import logging.config
|
||||
import sqlalchemy
|
||||
import sqlalchemy.pool
|
||||
|
||||
import alembic
|
||||
|
||||
from royalpack.config import lazy_config
|
||||
from royalpack.database.base import Base
|
||||
from royalpack.database.engine import lazy_engine
|
||||
from royalpack.config import lazy_config
|
||||
|
||||
|
||||
# Set up logging
|
||||
logging.config.fileConfig(alembic.context.config.config_file_name)
|
||||
|
||||
|
||||
# Get the metadata
|
||||
target_metadata = Base.metadata
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ Create Date: 2021-04-25 23:17:50.846179
|
|||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
|
|
|
@ -5,10 +5,9 @@ Revises:
|
|||
Create Date: 2021-04-25 01:00:49.131019
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlalchemy_utils
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c6aacbd5d796'
|
||||
|
|
|
@ -5,10 +5,9 @@ Revises: c6aacbd5d796
|
|||
Create Date: 2021-04-25 02:18:44.248837
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlalchemy_utils
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e6b0d97063a1'
|
||||
|
@ -19,8 +18,10 @@ depends_on = None
|
|||
|
||||
def upgrade():
|
||||
# ### 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_treasures', sa.Column('creation_time', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False))
|
||||
op.add_column('fiorygi_transactions',
|
||||
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))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
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()
|
||||
|
||||
|
||||
user_title_association = s.Table(
|
||||
"user_title_association",
|
||||
Base.metadata,
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import sqlalchemy.orm
|
||||
import royalnet.lazy
|
||||
import sqlalchemy.orm
|
||||
|
||||
from ..config import *
|
||||
|
||||
|
||||
lazy_engine = royalnet.lazy.Lazy(lambda c: sqlalchemy.create_engine(c["database.uri"]), c=lazy_config)
|
||||
"""
|
||||
The uninitialized sqlalchemy engine.
|
||||
|
|
|
@ -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
|
||||
"""
|
||||
|
||||
import royalnet.royaltyping as t
|
||||
import aiohttp
|
||||
import asyncio
|
||||
import datetime
|
||||
|
||||
import aiohttp
|
||||
import royalnet.royaltyping as t
|
||||
|
||||
|
||||
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:
|
||||
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=}")
|
||||
data = await request.json()
|
||||
assert data["leaderboard"]["id"] == lbid
|
||||
|
|
Loading…
Reference in a new issue