easterobot 1.0.0__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- easterobot/alembic/env.py +91 -0
- easterobot/alembic/script.py.mako +28 -0
- easterobot/alembic/versions/2f0d4305e320_init_database.py +67 -0
- easterobot/alembic/versions/940c3b9c702d_add_lock_on_eggs.py +38 -0
- easterobot/bot.py +93 -462
- easterobot/cli.py +56 -17
- easterobot/commands/__init__.py +8 -0
- easterobot/commands/base.py +34 -13
- easterobot/commands/basket.py +10 -12
- easterobot/commands/edit.py +4 -4
- easterobot/commands/enable.py +5 -1
- easterobot/commands/game.py +187 -0
- easterobot/commands/help.py +1 -1
- easterobot/commands/reset.py +1 -1
- easterobot/commands/search.py +4 -4
- easterobot/commands/top.py +7 -18
- easterobot/config.py +67 -3
- easterobot/games/__init__.py +14 -0
- easterobot/games/connect.py +206 -0
- easterobot/games/game.py +262 -0
- easterobot/games/rock_paper_scissor.py +206 -0
- easterobot/games/tic_tac_toe.py +168 -0
- easterobot/hunts/__init__.py +14 -0
- easterobot/hunts/hunt.py +428 -0
- easterobot/hunts/rank.py +82 -0
- easterobot/models.py +2 -1
- easterobot/resources/alembic.ini +87 -0
- easterobot/resources/config.example.yml +10 -2
- easterobot/resources/credits.txt +5 -1
- easterobot/resources/emotes/icons/arrow.png +0 -0
- easterobot/resources/emotes/icons/end.png +0 -0
- easterobot/resources/emotes/icons/versus.png +0 -0
- easterobot/resources/emotes/icons/wait.png +0 -0
- {easterobot-1.0.0.dist-info → easterobot-1.1.1.dist-info}/METADATA +11 -5
- easterobot-1.1.1.dist-info/RECORD +66 -0
- easterobot-1.0.0.dist-info/RECORD +0 -48
- /easterobot/resources/{eggs → emotes/eggs}/egg_01.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_02.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_03.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_04.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_05.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_06.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_07.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_08.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_09.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_10.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_11.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_12.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_13.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_14.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_15.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_16.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_17.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_18.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_19.png +0 -0
- /easterobot/resources/{eggs → emotes/eggs}/egg_20.png +0 -0
- {easterobot-1.0.0.dist-info → easterobot-1.1.1.dist-info}/WHEEL +0 -0
- {easterobot-1.0.0.dist-info → easterobot-1.1.1.dist-info}/entry_points.txt +0 -0
- {easterobot-1.0.0.dist-info → easterobot-1.1.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
"""Environnement."""
|
2
|
+
|
3
|
+
import asyncio
|
4
|
+
|
5
|
+
from alembic import context
|
6
|
+
from sqlalchemy import pool
|
7
|
+
from sqlalchemy.engine import Connection
|
8
|
+
from sqlalchemy.ext.asyncio import async_engine_from_config
|
9
|
+
|
10
|
+
from easterobot.config import (
|
11
|
+
EXAMPLE_CONFIG_PATH,
|
12
|
+
MConfig,
|
13
|
+
load_config_from_path,
|
14
|
+
)
|
15
|
+
from easterobot.models import Base
|
16
|
+
|
17
|
+
# this is the Alembic Config object, which provides
|
18
|
+
# access to the values within the .ini file in use.
|
19
|
+
config = context.config
|
20
|
+
|
21
|
+
# Interpret the config file for Python logging.
|
22
|
+
# This line sets up loggers basically.
|
23
|
+
if config.config_file_name is not None:
|
24
|
+
if "easterobot_config" in config.attributes:
|
25
|
+
easterobot_config: MConfig = config.attributes["easterobot_config"]
|
26
|
+
else:
|
27
|
+
easterobot_config = load_config_from_path(EXAMPLE_CONFIG_PATH)
|
28
|
+
easterobot_config.configure_logging()
|
29
|
+
# add your model's MetaData object here
|
30
|
+
# for 'autogenerate' support
|
31
|
+
target_metadata = [Base.metadata]
|
32
|
+
|
33
|
+
|
34
|
+
def run_migrations_offline() -> None:
|
35
|
+
"""Run migrations in 'offline' mode.
|
36
|
+
|
37
|
+
This configures the context with just a URL
|
38
|
+
and not an Engine, though an Engine is acceptable
|
39
|
+
here as well. By skipping the Engine creation
|
40
|
+
we don't even need a DBAPI to be available.
|
41
|
+
|
42
|
+
Calls to context.execute() here emit the given string to the
|
43
|
+
script output.
|
44
|
+
|
45
|
+
"""
|
46
|
+
url = config.get_main_option("sqlalchemy.url")
|
47
|
+
context.configure(
|
48
|
+
url=url,
|
49
|
+
target_metadata=target_metadata,
|
50
|
+
literal_binds=True,
|
51
|
+
dialect_opts={"paramstyle": "named"},
|
52
|
+
)
|
53
|
+
|
54
|
+
with context.begin_transaction():
|
55
|
+
context.run_migrations()
|
56
|
+
|
57
|
+
|
58
|
+
def do_run_migrations(connection: Connection) -> None:
|
59
|
+
"""Run all migrations."""
|
60
|
+
context.configure(connection=connection, target_metadata=target_metadata)
|
61
|
+
|
62
|
+
with context.begin_transaction():
|
63
|
+
context.run_migrations()
|
64
|
+
|
65
|
+
|
66
|
+
async def run_async_migrations() -> None:
|
67
|
+
"""In this scenario we need to create an Engine.
|
68
|
+
|
69
|
+
Then we associate a connection with the context.
|
70
|
+
"""
|
71
|
+
connectable = async_engine_from_config(
|
72
|
+
config.get_section(config.config_ini_section, {}),
|
73
|
+
prefix="sqlalchemy.",
|
74
|
+
poolclass=pool.NullPool,
|
75
|
+
)
|
76
|
+
|
77
|
+
async with connectable.connect() as connection:
|
78
|
+
await connection.run_sync(do_run_migrations)
|
79
|
+
|
80
|
+
await connectable.dispose()
|
81
|
+
|
82
|
+
|
83
|
+
def run_migrations_online() -> None:
|
84
|
+
"""Run migrations in 'online' mode."""
|
85
|
+
asyncio.run(run_async_migrations())
|
86
|
+
|
87
|
+
|
88
|
+
if context.is_offline_mode():
|
89
|
+
run_migrations_offline()
|
90
|
+
else:
|
91
|
+
run_migrations_online()
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"""${message}
|
2
|
+
|
3
|
+
Revision ID: ${up_revision}
|
4
|
+
Revises: ${down_revision | comma,n}
|
5
|
+
Create Date: ${create_date}
|
6
|
+
|
7
|
+
"""
|
8
|
+
from typing import Sequence, Union
|
9
|
+
|
10
|
+
from alembic import op
|
11
|
+
import sqlalchemy as sa
|
12
|
+
${imports if imports else ""}
|
13
|
+
|
14
|
+
# revision identifiers, used by Alembic.
|
15
|
+
revision: str = ${repr(up_revision)}
|
16
|
+
down_revision: Union[str, None] = ${repr(down_revision)}
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
|
18
|
+
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
|
19
|
+
|
20
|
+
|
21
|
+
def upgrade() -> None:
|
22
|
+
"""Upgrade schema."""
|
23
|
+
${upgrades if upgrades else "pass"}
|
24
|
+
|
25
|
+
|
26
|
+
def downgrade() -> None:
|
27
|
+
"""Downgrade schema."""
|
28
|
+
${downgrades if downgrades else "pass"}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
"""init database.
|
2
|
+
|
3
|
+
Revision ID: 2f0d4305e320
|
4
|
+
Revises:
|
5
|
+
Create Date: 2025-04-19 12:04:53.107440
|
6
|
+
|
7
|
+
"""
|
8
|
+
|
9
|
+
from collections.abc import Sequence
|
10
|
+
from typing import Union
|
11
|
+
|
12
|
+
import sqlalchemy as sa
|
13
|
+
from alembic import op
|
14
|
+
|
15
|
+
# revision identifiers, used by Alembic.
|
16
|
+
revision: str = "2f0d4305e320"
|
17
|
+
down_revision: Union[str, None] = None
|
18
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
19
|
+
depends_on: Union[str, Sequence[str], None] = None
|
20
|
+
|
21
|
+
|
22
|
+
def upgrade() -> None:
|
23
|
+
"""Upgrade schema."""
|
24
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
25
|
+
op.create_table(
|
26
|
+
"cooldown",
|
27
|
+
sa.Column("user_id", sa.BigInteger(), nullable=False),
|
28
|
+
sa.Column("guild_id", sa.BigInteger(), nullable=False),
|
29
|
+
sa.Column("command", sa.String(), nullable=False),
|
30
|
+
sa.Column("timestamp", sa.Float(), nullable=False),
|
31
|
+
sa.PrimaryKeyConstraint("user_id", "guild_id", "command"),
|
32
|
+
)
|
33
|
+
op.create_table(
|
34
|
+
"egg",
|
35
|
+
sa.Column(
|
36
|
+
"id",
|
37
|
+
sa.BigInteger().with_variant(sa.Integer(), "sqlite"),
|
38
|
+
autoincrement=True,
|
39
|
+
nullable=False,
|
40
|
+
),
|
41
|
+
sa.Column("guild_id", sa.BigInteger(), nullable=False),
|
42
|
+
sa.Column("channel_id", sa.BigInteger(), nullable=False),
|
43
|
+
sa.Column("user_id", sa.BigInteger(), nullable=False),
|
44
|
+
sa.Column("emoji_id", sa.BigInteger(), nullable=True),
|
45
|
+
sa.PrimaryKeyConstraint("id"),
|
46
|
+
)
|
47
|
+
op.create_index(op.f("ix_egg_guild_id"), "egg", ["guild_id"], unique=False)
|
48
|
+
op.create_index(op.f("ix_egg_user_id"), "egg", ["user_id"], unique=False)
|
49
|
+
op.create_table(
|
50
|
+
"hunt",
|
51
|
+
sa.Column("channel_id", sa.BigInteger(), nullable=False),
|
52
|
+
sa.Column("guild_id", sa.BigInteger(), nullable=False),
|
53
|
+
sa.Column("next_egg", sa.Float(), nullable=False),
|
54
|
+
sa.PrimaryKeyConstraint("channel_id"),
|
55
|
+
)
|
56
|
+
# ### end Alembic commands ###
|
57
|
+
|
58
|
+
|
59
|
+
def downgrade() -> None:
|
60
|
+
"""Downgrade schema."""
|
61
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
62
|
+
op.drop_table("hunt")
|
63
|
+
op.drop_index(op.f("ix_egg_user_id"), table_name="egg")
|
64
|
+
op.drop_index(op.f("ix_egg_guild_id"), table_name="egg")
|
65
|
+
op.drop_table("egg")
|
66
|
+
op.drop_table("cooldown")
|
67
|
+
# ### end Alembic commands ###
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"""add lock on eggs.
|
2
|
+
|
3
|
+
Revision ID: 940c3b9c702d
|
4
|
+
Revises: 2f0d4305e320
|
5
|
+
Create Date: 2025-04-19 12:52:02.245048
|
6
|
+
|
7
|
+
"""
|
8
|
+
|
9
|
+
from collections.abc import Sequence
|
10
|
+
from typing import Union
|
11
|
+
|
12
|
+
import sqlalchemy as sa
|
13
|
+
from alembic import op
|
14
|
+
|
15
|
+
# revision identifiers, used by Alembic.
|
16
|
+
revision: str = "940c3b9c702d"
|
17
|
+
down_revision: Union[str, None] = "2f0d4305e320"
|
18
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
19
|
+
depends_on: Union[str, Sequence[str], None] = None
|
20
|
+
|
21
|
+
|
22
|
+
def upgrade() -> None:
|
23
|
+
"""Upgrade schema."""
|
24
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
25
|
+
op.add_column(
|
26
|
+
"egg",
|
27
|
+
sa.Column(
|
28
|
+
"lock", sa.Boolean(), nullable=False, server_default=sa.text("0")
|
29
|
+
),
|
30
|
+
)
|
31
|
+
# ### end Alembic commands ###
|
32
|
+
|
33
|
+
|
34
|
+
def downgrade() -> None:
|
35
|
+
"""Downgrade schema."""
|
36
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
37
|
+
op.drop_column("egg", "lock")
|
38
|
+
# ### end Alembic commands ###
|