easterobot 1.3.1__tar.gz → 1.3.2__tar.gz
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-1.3.1 → easterobot-1.3.2}/PKG-INFO +1 -1
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/game.py +4 -4
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/info.py +2 -2
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/hunts/luck.py +15 -10
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/config.example.yml +10 -10
- {easterobot-1.3.1 → easterobot-1.3.2}/pyproject.toml +2 -2
- {easterobot-1.3.1 → easterobot-1.3.2}/tests/test_search.py +10 -5
- {easterobot-1.3.1 → easterobot-1.3.2}/uv.lock +1 -1
- {easterobot-1.3.1 → easterobot-1.3.2}/.dockerignore +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.editorconfig +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.github/actions/setup-project/action.yml +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.github/workflows/docs.yml +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.github/workflows/lint.yml +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.github/workflows/publish.yml +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.github/workflows/tests.yml +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.gitignore +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.pre-commit-config.yaml +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.vscode/extensions.json +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.vscode/ltex.dictionary.en-US.txt +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.vscode/ltex.hiddenFalsePositives.en-US.txt +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/.vscode/settings.json +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/Dockerfile +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/LICENSE +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/README.rst +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/conftest.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/docker-compose.yml +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/docs/conf.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/docs/index.rst +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/docs/references.rst +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/docs/resources/favicon.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/__init__.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/__main__.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/alembic/env.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/alembic/script.py.mako +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/alembic/versions/2f0d4305e320_init_database.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/alembic/versions/940c3b9c702d_add_lock_on_eggs.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/bot.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/cli.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/__init__.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/base.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/basket.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/disable.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/edit.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/enable.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/help.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/reset.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/search.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/commands/top.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/config.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/games/__init__.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/games/connect.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/games/game.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/games/rock_paper_scissor.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/games/tic_tac_toe.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/hunts/__init__.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/hunts/hunt.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/hunts/rank.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/info.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/logger.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/models.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/py.typed +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/query.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/alembic.ini +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/credits.txt +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_01.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_02.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_03.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_04.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_05.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_06.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_07.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_08.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_09.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_10.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_11.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_12.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_13.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_14.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_15.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_16.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_17.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_18.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_19.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/eggs/egg_20.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/icons/arrow.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/icons/end.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/icons/versus.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/emotes/icons/wait.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/logging.conf +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/resources/logo.png +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/easterobot/utils.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/entrypoint.sh +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/tests/__init__.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/tests/constants.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/tests/test_cli.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/tests/test_config.py +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/tools/chatgpt.txt +0 -0
- {easterobot-1.3.1 → easterobot-1.3.2}/tools/cropping.py +0 -0
@@ -91,13 +91,13 @@ async def game_dual( # noqa: C901, D103, PLR0912
|
|
91
91
|
)
|
92
92
|
if len(e1) < bet:
|
93
93
|
await ctx.response.send_message(
|
94
|
-
"Vous n'avez pas assez d'
|
94
|
+
"Vous n'avez pas assez d'œufs",
|
95
95
|
ephemeral=True,
|
96
96
|
)
|
97
97
|
return
|
98
98
|
if len(e2) < bet:
|
99
99
|
await ctx.response.send_message(
|
100
|
-
f"{member.mention} n'a pas assez d'
|
100
|
+
f"{member.mention} n'a pas assez d'œufs",
|
101
101
|
ephemeral=True,
|
102
102
|
)
|
103
103
|
return
|
@@ -113,7 +113,7 @@ async def game_dual( # noqa: C901, D103, PLR0912
|
|
113
113
|
)
|
114
114
|
if len(e1) < bet:
|
115
115
|
await ctx.response.send_message(
|
116
|
-
"Vous n'avez plus assez d'
|
116
|
+
"Vous n'avez plus assez d'œufs",
|
117
117
|
ephemeral=True,
|
118
118
|
)
|
119
119
|
return
|
@@ -121,7 +121,7 @@ async def game_dual( # noqa: C901, D103, PLR0912
|
|
121
121
|
e.lock = True
|
122
122
|
if len(e2) < bet:
|
123
123
|
await ctx.response.send_message(
|
124
|
-
f"{member.mention} n'a plus assez d'
|
124
|
+
f"{member.mention} n'a plus assez d'œufs",
|
125
125
|
ephemeral=True,
|
126
126
|
)
|
127
127
|
return
|
@@ -51,9 +51,9 @@ async def info_command(
|
|
51
51
|
title=f"Informations sur {hunter.display_name}",
|
52
52
|
description=(
|
53
53
|
f"Classement : {hunter_rank.badge}\n"
|
54
|
-
f"Nombre d'
|
54
|
+
f"Nombre d'œufs : `{hunter_rank.eggs}`\n"
|
55
55
|
f"Chance brute : `{member_luck.luck:.0%}`\n"
|
56
|
-
f"Chance de trouver un
|
56
|
+
f"Chance de trouver un œuf : `{member_luck.discovered:.0%}`\n"
|
57
57
|
f"Chance de se faire voler : `{member_luck.spotted:.0%}`"
|
58
58
|
),
|
59
59
|
),
|
@@ -18,6 +18,8 @@ class HuntLuck:
|
|
18
18
|
@property
|
19
19
|
def discovered(self) -> float:
|
20
20
|
"""Discovered probability."""
|
21
|
+
if self.egg_count <= self.config.commands.search.discovered.shield:
|
22
|
+
return 1.0
|
21
23
|
prob = self.config.commands.search.discovered.probability(self.luck)
|
22
24
|
if self.sleep_hours:
|
23
25
|
prob /= self.config.sleep.divide_discovered
|
@@ -26,6 +28,8 @@ class HuntLuck:
|
|
26
28
|
@property
|
27
29
|
def spotted(self) -> float:
|
28
30
|
"""Spotted probability."""
|
31
|
+
if self.egg_count <= self.config.commands.search.spotted.shield:
|
32
|
+
return 0.0
|
29
33
|
prob = self.config.commands.search.spotted.probability(self.luck)
|
30
34
|
if self.sleep_hours:
|
31
35
|
prob /= self.config.sleep.divide_spotted
|
@@ -33,21 +37,22 @@ class HuntLuck:
|
|
33
37
|
|
34
38
|
def sample_discovered(self) -> bool:
|
35
39
|
"""Get if player get detected."""
|
36
|
-
if self.egg_count <= self.config.commands.search.discovered.shield:
|
37
|
-
logger.info("discovered: shield with %s eggs", self.egg_count)
|
38
|
-
return True
|
39
40
|
sample = RAND.random()
|
41
|
+
discovered = self.discovered
|
40
42
|
logger.info(
|
41
|
-
"discovered: expect over %.
|
42
|
-
|
43
|
+
"discovered: expect over %.4f got %.4f",
|
44
|
+
discovered,
|
43
45
|
sample,
|
44
46
|
)
|
45
|
-
return
|
47
|
+
return discovered > sample
|
46
48
|
|
47
49
|
def sample_spotted(self) -> bool:
|
48
50
|
"""Get if player get spotted."""
|
49
|
-
if self.egg_count <= self.config.commands.search.spotted.shield:
|
50
|
-
logger.info("spotted: shield with %s eggs", self.egg_count)
|
51
|
-
return True
|
52
51
|
sample = RAND.random()
|
53
|
-
|
52
|
+
spotted = self.spotted
|
53
|
+
logger.info(
|
54
|
+
"spotted: expect over %.4f got %.4f",
|
55
|
+
spotted,
|
56
|
+
sample,
|
57
|
+
)
|
58
|
+
return spotted > sample
|
@@ -321,35 +321,35 @@ action:
|
|
321
321
|
gif: https://media4.giphy.com/media/v1.Y2lkPTc5MGI3NjExMTh2ZjFrdDdpN2h3aXZtYWxtcmdmNGI2ZWoyczg5b3d4Y2c0N2pwbiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3otPoxbuCuvXTbICfm/giphy.gif
|
322
322
|
fail:
|
323
323
|
text: "On a connu des morts de hamster plus originales, la peur de perdre l'œuf l’a emporté."
|
324
|
-
gif: https://tenor.com/
|
324
|
+
gif: https://c.tenor.com/9t7q9vCcYmMAAAAd/tenor.gif
|
325
325
|
- text: "Pinguiner pour l'œuf"
|
326
326
|
success:
|
327
327
|
text: "I'm fast as fuck, boy. {Iel} court en s'enfuyant avec l'œuf."
|
328
328
|
gif: https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExYXBrcmQwemt3Y2x1NXdrcnV0aWZxcWZrMGtzYXV4NTBrZGFhYnFhOSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/y5xRFqfdkgEXS/giphy.gif
|
329
329
|
fail:
|
330
330
|
text: "Saboté par un autre pingouin. {Iel} prend une petite baignade."
|
331
|
-
gif: https://tenor.com/
|
331
|
+
gif: https://c.tenor.com/SQ1N_QKllQQAAAAd/tenor.gif
|
332
332
|
- text: "Invoquer un chat pour l'œuf"
|
333
333
|
success:
|
334
|
-
text:
|
335
|
-
gif: https://tenor.com/
|
334
|
+
text: Oh waw, quel maniement félin de l'œuf !
|
335
|
+
gif: https://c.tenor.com/vwfpPXNTDPEAAAAd/tenor.gif
|
336
336
|
fail:
|
337
337
|
text: "{Iel} n'est pas tombé{e} sur le chat le plus adroit du quartier, {iel} tombe fatalement."
|
338
|
-
gif: https://tenor.com/
|
339
|
-
- text:
|
338
|
+
gif: https://c.tenor.com/Hw4fVEKAqb8AAAAd/tenor.gif
|
339
|
+
- text: Boire l'œuf ?
|
340
340
|
success:
|
341
341
|
text: "Effectivement, quand ils sont solides, ça a plus de chances d'être des œufs. {Iel} récupère un œuf."
|
342
|
-
gif: https://tenor.com/
|
342
|
+
gif: https://c.tenor.com/cqBCSM5N55UAAAAd/tenor.gif
|
343
343
|
fail:
|
344
344
|
text: "Mmhh, effectivement, un œuf, ça ne se boit pas. Sa vision double l'empêche d'attraper l'œuf."
|
345
345
|
gif: https://gifdb.com/images/high/easter-bunny-bud-light-6y0qi1qackuq0ijb.webp
|
346
|
-
- text: "Poler pour l'
|
346
|
+
- text: "Poler pour l'œuf"
|
347
347
|
success:
|
348
348
|
text: "Quelle adresse, {iel} séduit le lapin de Pâques et obtient un œuf"
|
349
|
-
gif: https://tenor.com/
|
349
|
+
gif: https://c.tenor.com/aThWCOLIhvwAAAAd/tenor.gif
|
350
350
|
fail:
|
351
351
|
text: "Oulà, je n'aurais pas aimé être à sa place."
|
352
|
-
gif: https://tenor.com/
|
352
|
+
gif: https://c.tenor.com/WQV-9F8Wt7QAAAAd/tenor.gif
|
353
353
|
- text: "Ramasser calmement l'œuf"
|
354
354
|
success:
|
355
355
|
text: "Sa sagesse lui a permis d'arriver en vie jusqu'à l'œuf."
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "easterobot"
|
3
|
-
version = "1.3.
|
3
|
+
version = "1.3.2"
|
4
4
|
description = "Discord bot for Easter."
|
5
5
|
authors = [
|
6
6
|
{ name = "Dashstrom", email = "dashstrom.pro@gmail.com" }
|
@@ -231,7 +231,7 @@ imports = ["shutil", "sys", "pathlib"]
|
|
231
231
|
|
232
232
|
[tool.pytest.ini_options]
|
233
233
|
log_cli = true
|
234
|
-
log_cli_level = "
|
234
|
+
log_cli_level = "WARNING"
|
235
235
|
addopts = "-vvv --doctest-modules --ignore=easterobot/alembic"
|
236
236
|
doctest_optionflags = "DONT_ACCEPT_TRUE_FOR_1 NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS"
|
237
237
|
#asyncio_mode = "auto"
|
@@ -24,8 +24,8 @@ async def test_luck(session: AsyncSession, config: MConfig) -> None:
|
|
24
24
|
hunt = HuntQuery(config)
|
25
25
|
for user_id, egg_count in (
|
26
26
|
(USER_ID_1, 0),
|
27
|
-
(USER_ID_2,
|
28
|
-
(USER_ID_3,
|
27
|
+
(USER_ID_2, 15),
|
28
|
+
(USER_ID_3, 30),
|
29
29
|
):
|
30
30
|
for _ in range(egg_count):
|
31
31
|
session.add(
|
@@ -37,13 +37,18 @@ async def test_luck(session: AsyncSession, config: MConfig) -> None:
|
|
37
37
|
)
|
38
38
|
)
|
39
39
|
await session.commit()
|
40
|
+
N = 10_000 # noqa: N806
|
40
41
|
for user_id, egg_count, luck, discovered, spotted in (
|
41
|
-
(USER_ID_1, 0, 1.0, 0
|
42
|
-
(USER_ID_2,
|
43
|
-
(USER_ID_3,
|
42
|
+
(USER_ID_1, 0, 1.0, 1.0, 0.0),
|
43
|
+
(USER_ID_2, 15, 0.5, 0.75, 0.4995),
|
44
|
+
(USER_ID_3, 30, 0.0, 0.6, 0.666),
|
44
45
|
):
|
45
46
|
member_luck = await hunt.get_luck(session, GUILD_ID, user_id)
|
46
47
|
assert member_luck.egg_count == egg_count
|
47
48
|
assert isclose(member_luck.luck, luck)
|
48
49
|
assert isclose(member_luck.discovered, discovered)
|
49
50
|
assert isclose(member_luck.spotted, spotted)
|
51
|
+
prob_d = sum(member_luck.sample_discovered() for _ in range(N)) / N
|
52
|
+
prob_s = sum(member_luck.sample_spotted() for _ in range(N)) / N
|
53
|
+
assert isclose(prob_d, discovered, rel_tol=5e-2)
|
54
|
+
assert isclose(prob_s, spotted, rel_tol=5e-2)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{easterobot-1.3.1 → easterobot-1.3.2}/easterobot/alembic/versions/2f0d4305e320_init_database.py
RENAMED
File without changes
|
{easterobot-1.3.1 → easterobot-1.3.2}/easterobot/alembic/versions/940c3b9c702d_add_lock_on_eggs.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|