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.
Files changed (59) hide show
  1. easterobot/alembic/env.py +91 -0
  2. easterobot/alembic/script.py.mako +28 -0
  3. easterobot/alembic/versions/2f0d4305e320_init_database.py +67 -0
  4. easterobot/alembic/versions/940c3b9c702d_add_lock_on_eggs.py +38 -0
  5. easterobot/bot.py +93 -462
  6. easterobot/cli.py +56 -17
  7. easterobot/commands/__init__.py +8 -0
  8. easterobot/commands/base.py +34 -13
  9. easterobot/commands/basket.py +10 -12
  10. easterobot/commands/edit.py +4 -4
  11. easterobot/commands/enable.py +5 -1
  12. easterobot/commands/game.py +187 -0
  13. easterobot/commands/help.py +1 -1
  14. easterobot/commands/reset.py +1 -1
  15. easterobot/commands/search.py +4 -4
  16. easterobot/commands/top.py +7 -18
  17. easterobot/config.py +67 -3
  18. easterobot/games/__init__.py +14 -0
  19. easterobot/games/connect.py +206 -0
  20. easterobot/games/game.py +262 -0
  21. easterobot/games/rock_paper_scissor.py +206 -0
  22. easterobot/games/tic_tac_toe.py +168 -0
  23. easterobot/hunts/__init__.py +14 -0
  24. easterobot/hunts/hunt.py +428 -0
  25. easterobot/hunts/rank.py +82 -0
  26. easterobot/models.py +2 -1
  27. easterobot/resources/alembic.ini +87 -0
  28. easterobot/resources/config.example.yml +10 -2
  29. easterobot/resources/credits.txt +5 -1
  30. easterobot/resources/emotes/icons/arrow.png +0 -0
  31. easterobot/resources/emotes/icons/end.png +0 -0
  32. easterobot/resources/emotes/icons/versus.png +0 -0
  33. easterobot/resources/emotes/icons/wait.png +0 -0
  34. {easterobot-1.0.0.dist-info → easterobot-1.1.1.dist-info}/METADATA +11 -5
  35. easterobot-1.1.1.dist-info/RECORD +66 -0
  36. easterobot-1.0.0.dist-info/RECORD +0 -48
  37. /easterobot/resources/{eggs → emotes/eggs}/egg_01.png +0 -0
  38. /easterobot/resources/{eggs → emotes/eggs}/egg_02.png +0 -0
  39. /easterobot/resources/{eggs → emotes/eggs}/egg_03.png +0 -0
  40. /easterobot/resources/{eggs → emotes/eggs}/egg_04.png +0 -0
  41. /easterobot/resources/{eggs → emotes/eggs}/egg_05.png +0 -0
  42. /easterobot/resources/{eggs → emotes/eggs}/egg_06.png +0 -0
  43. /easterobot/resources/{eggs → emotes/eggs}/egg_07.png +0 -0
  44. /easterobot/resources/{eggs → emotes/eggs}/egg_08.png +0 -0
  45. /easterobot/resources/{eggs → emotes/eggs}/egg_09.png +0 -0
  46. /easterobot/resources/{eggs → emotes/eggs}/egg_10.png +0 -0
  47. /easterobot/resources/{eggs → emotes/eggs}/egg_11.png +0 -0
  48. /easterobot/resources/{eggs → emotes/eggs}/egg_12.png +0 -0
  49. /easterobot/resources/{eggs → emotes/eggs}/egg_13.png +0 -0
  50. /easterobot/resources/{eggs → emotes/eggs}/egg_14.png +0 -0
  51. /easterobot/resources/{eggs → emotes/eggs}/egg_15.png +0 -0
  52. /easterobot/resources/{eggs → emotes/eggs}/egg_16.png +0 -0
  53. /easterobot/resources/{eggs → emotes/eggs}/egg_17.png +0 -0
  54. /easterobot/resources/{eggs → emotes/eggs}/egg_18.png +0 -0
  55. /easterobot/resources/{eggs → emotes/eggs}/egg_19.png +0 -0
  56. /easterobot/resources/{eggs → emotes/eggs}/egg_20.png +0 -0
  57. {easterobot-1.0.0.dist-info → easterobot-1.1.1.dist-info}/WHEEL +0 -0
  58. {easterobot-1.0.0.dist-info → easterobot-1.1.1.dist-info}/entry_points.txt +0 -0
  59. {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 ###