easterobot 1.5.1__py3-none-any.whl → 1.5.2__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/commands/game.py +10 -6
- easterobot/games/game.py +1 -1
- easterobot/games/skyjo.py +2 -2
- easterobot/info.py +17 -7
- {easterobot-1.5.1.dist-info → easterobot-1.5.2.dist-info}/METADATA +23 -19
- {easterobot-1.5.1.dist-info → easterobot-1.5.2.dist-info}/RECORD +9 -9
- {easterobot-1.5.1.dist-info → easterobot-1.5.2.dist-info}/WHEEL +0 -0
- {easterobot-1.5.1.dist-info → easterobot-1.5.2.dist-info}/entry_points.txt +0 -0
- {easterobot-1.5.1.dist-info → easterobot-1.5.2.dist-info}/licenses/LICENSE +0 -0
easterobot/commands/game.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"""Module for disable hunt."""
|
2
2
|
|
3
3
|
import asyncio
|
4
|
+
from contextlib import suppress
|
4
5
|
from typing import Optional
|
5
6
|
|
6
7
|
import discord
|
@@ -54,15 +55,18 @@ async def game_dual( # noqa: D103
|
|
54
55
|
cls: type[Game],
|
55
56
|
*members: discord.Member,
|
56
57
|
) -> None:
|
58
|
+
set_members = set(members)
|
59
|
+
with suppress(KeyError):
|
60
|
+
set_members.remove(ctx.user)
|
57
61
|
min_player = cls.minimum_player()
|
58
62
|
max_player = cls.maximum_player()
|
59
|
-
if min_player > len(
|
63
|
+
if min_player > len(set_members) + 1:
|
60
64
|
await ctx.response.send_message(
|
61
65
|
f"Vous devez être au minimum {min_player} joueurs",
|
62
66
|
ephemeral=True,
|
63
67
|
)
|
64
68
|
return
|
65
|
-
if max_player < len(
|
69
|
+
if max_player < len(set_members) + 1:
|
66
70
|
await ctx.response.send_message(
|
67
71
|
f"Vous devez être au maximum {min_player} joueurs",
|
68
72
|
ephemeral=True,
|
@@ -77,13 +81,13 @@ async def game_dual( # noqa: D103
|
|
77
81
|
locker = EggLocker(session, ctx.guild.id)
|
78
82
|
try:
|
79
83
|
await locker.pre_check(
|
80
|
-
{ctx.user: bet, **{m: bet for m in
|
84
|
+
{ctx.user: bet, **{m: bet for m in set_members}}
|
81
85
|
)
|
82
86
|
except EggLockerError as err:
|
83
87
|
await ctx.response.send_message(str(err), ephemeral=True)
|
84
88
|
return
|
85
89
|
|
86
|
-
msg = await ctx.client.game.ask_dual(ctx,
|
90
|
+
msg = await ctx.client.game.ask_dual(ctx, set_members, bet=bet)
|
87
91
|
if msg:
|
88
92
|
# Unlock all egg at end
|
89
93
|
async with locker:
|
@@ -92,13 +96,13 @@ async def game_dual( # noqa: D103
|
|
92
96
|
async with locker.transaction():
|
93
97
|
all_eggs = await asyncio.gather(
|
94
98
|
locker.get(ctx.user, bet),
|
95
|
-
*[locker.get(m, bet) for m in
|
99
|
+
*[locker.get(m, bet) for m in set_members],
|
96
100
|
)
|
97
101
|
except EggLockerError as err:
|
98
102
|
await msg.reply(str(err), delete_after=30)
|
99
103
|
return
|
100
104
|
|
101
|
-
players = [ctx.user, *
|
105
|
+
players = [ctx.user, *set_members]
|
102
106
|
RAND.shuffle(players)
|
103
107
|
game = cls(ctx.client, msg, *players)
|
104
108
|
await ctx.client.game.run(game)
|
easterobot/games/game.py
CHANGED
@@ -247,8 +247,8 @@ class GameCog(commands.Cog):
|
|
247
247
|
bet: int,
|
248
248
|
) -> Optional[discord.Message]:
|
249
249
|
"""Send basic message for initialization."""
|
250
|
-
event = asyncio.Event()
|
251
250
|
pending_members = list(members)
|
251
|
+
event = asyncio.Event()
|
252
252
|
accepted_members: list[discord.Member] = [ctx.user]
|
253
253
|
cancel_by: Optional[discord.Member] = None
|
254
254
|
|
easterobot/games/skyjo.py
CHANGED
@@ -785,13 +785,13 @@ class Skyjo(Game):
|
|
785
785
|
"""Get all score."""
|
786
786
|
scores = {}
|
787
787
|
for p, grid in self.grids.items():
|
788
|
-
scores[p] = grid.value
|
789
788
|
grid.return_all_card()
|
789
|
+
scores[p] = grid.value
|
790
790
|
finish_player = self.finish_player
|
791
791
|
if finish_player:
|
792
792
|
finish_score = scores[finish_player]
|
793
793
|
for p, value in scores.items():
|
794
|
-
if p != finish_player and value
|
794
|
+
if p != finish_player and value < finish_score:
|
795
795
|
scores[finish_player] *= 2
|
796
796
|
break
|
797
797
|
return scores
|
easterobot/info.py
CHANGED
@@ -1,18 +1,28 @@
|
|
1
1
|
"""Module holding metadata."""
|
2
2
|
|
3
|
+
import logging
|
3
4
|
from importlib.metadata import Distribution
|
4
5
|
|
6
|
+
logger = logging.getLogger(__name__)
|
5
7
|
_DISTRIBUTION = Distribution.from_name(
|
6
8
|
"easterobot",
|
7
9
|
)
|
8
10
|
_METADATA = _DISTRIBUTION.metadata
|
9
|
-
|
10
|
-
if "Author" in _METADATA:
|
11
|
-
|
12
|
-
|
11
|
+
if len(_METADATA) != 0:
|
12
|
+
if "Author" in _METADATA:
|
13
|
+
__author__ = str(_METADATA["Author"])
|
14
|
+
__email__ = str(_METADATA["Author-email"])
|
15
|
+
else:
|
16
|
+
__author__, __email__ = _METADATA["Author-email"][:-1].split(" <", 1)
|
17
|
+
__version__ = _METADATA["Version"]
|
18
|
+
__summary__ = _METADATA["Summary"]
|
13
19
|
else:
|
14
|
-
|
15
|
-
|
16
|
-
|
20
|
+
logger.warning("Cannot load package metadata, please reinstall !")
|
21
|
+
|
22
|
+
__author__ = "Unknown"
|
23
|
+
__email__ = "Unknown"
|
24
|
+
__version__ = "Unknown"
|
25
|
+
__summary__ = "Unknown"
|
26
|
+
|
17
27
|
__copyright__ = f"{__author__} <{__email__}>"
|
18
28
|
__issues__ = "https://github.com/Dashstrom/easterobot/issues"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: easterobot
|
3
|
-
Version: 1.5.
|
3
|
+
Version: 1.5.2
|
4
4
|
Summary: Discord bot for Easter.
|
5
5
|
Project-URL: Homepage, https://github.com/Dashstrom/easterobot
|
6
6
|
Project-URL: Repository, https://github.com/Dashstrom/easterobot
|
@@ -144,24 +144,28 @@ Configuration directory
|
|
144
144
|
|
145
145
|
.. code-block:: text
|
146
146
|
|
147
|
-
data
|
148
|
-
├── .gitignore
|
149
|
-
├── config.yml
|
150
|
-
├── easterobot.db
|
151
|
-
├── logs
|
152
|
-
│ ├── easterobot.log
|
153
|
-
│ └── easterobot.log.1
|
154
|
-
└── resources
|
155
|
-
├── config.example.yml
|
156
|
-
├── credits.txt
|
157
|
-
├── emotes
|
158
|
-
│ ├── eggs
|
159
|
-
│ | └── egg_01.png
|
160
|
-
│
|
161
|
-
│
|
162
|
-
├──
|
163
|
-
|
164
|
-
└──
|
147
|
+
data Root directory
|
148
|
+
├── .gitignore Avoid pushing sensitive data
|
149
|
+
├── config.yml Configuration file
|
150
|
+
├── easterobot.db Database
|
151
|
+
├── logs Logging directory
|
152
|
+
│ ├── easterobot.log Latest log file
|
153
|
+
│ └── easterobot.log.1 Rotating log file
|
154
|
+
└── resources Resource directory
|
155
|
+
├── config.example.yml An example of config
|
156
|
+
├── credits.txt Credits of emotes
|
157
|
+
├── emotes Directory loaded as application emotes
|
158
|
+
│ ├── eggs Directory for eggs
|
159
|
+
│ | └── egg_01.png Emoji to use for egg
|
160
|
+
│ ├── icons Misc emotes to load
|
161
|
+
│ │ └── arrow.png Emoji used in messages
|
162
|
+
│ ├── placements Directory for emoji used in grid
|
163
|
+
│ │ └── s1.png Single blue emoji with one on it
|
164
|
+
│ └── skyjo Skyjo cards
|
165
|
+
│ └── skyjo_m1.png Card with minus -1 with deep blue
|
166
|
+
├── logging.conf Logging configuration
|
167
|
+
├── alembic.ini Configure for alembic
|
168
|
+
└── logo.png Logo used by the bot
|
165
169
|
|
166
170
|
Development
|
167
171
|
###########
|
@@ -3,7 +3,7 @@ easterobot/__main__.py,sha256=ix1OVjR-jxJIHzQiKyIswvn0oNphNNL9p7FtbZj9Stw,140
|
|
3
3
|
easterobot/bot.py,sha256=SQjTfMntWDIB8_qxbAksGEFbTdraaWxsSPRzOOUZy3Q,7373
|
4
4
|
easterobot/cli.py,sha256=G746r3abX-Vtcq9Ju-51FcZRj9y9PmGlIp9ADecajM4,5296
|
5
5
|
easterobot/config.py,sha256=TcGaTZi70mGRy4iiHiQ5kNyPBdFEV2uf-2wTYXKGwhU,15719
|
6
|
-
easterobot/info.py,sha256=
|
6
|
+
easterobot/info.py,sha256=9Uabt6ci1mQUoBcO1W0gB0HjDBnTEC1sO1227xyCBtQ,837
|
7
7
|
easterobot/locker.py,sha256=LU5pj7lvYzkFfvl00T-lq9DQwKKZu4ETxv00TNHlgCM,5322
|
8
8
|
easterobot/logger.py,sha256=eUUdMB0ebvb5h98WWZka2ntivBOmfHqhlvyr-82NKn4,482
|
9
9
|
easterobot/models.py,sha256=HgSqDiPqJ3PsrHR4o9LQxBuvaSKvauf2dVXO-gjyDWs,2029
|
@@ -22,7 +22,7 @@ easterobot/commands/basket.py,sha256=sV6JfPxg4U98dTTA5tr1wnMVM5DI9UXGL6FWL9OphTw
|
|
22
22
|
easterobot/commands/disable.py,sha256=AMSUBIdS6H8PMv2iYJIOMPuciEUtrTVUWe9bAJ6m1yA,975
|
23
23
|
easterobot/commands/edit.py,sha256=jppdU6A62zhWaO_LFukbp2eTSyiL9NKyK7fBI9n1Ph8,2139
|
24
24
|
easterobot/commands/enable.py,sha256=MtvNFzQWjxB9QoHq2YF4j_KTLPnAVDayflUPemQGNuQ,1099
|
25
|
-
easterobot/commands/game.py,sha256=
|
25
|
+
easterobot/commands/game.py,sha256=UTovNVs6pmq8on4VR8V3cYIqM5uwsNDuqetd05egnw4,6428
|
26
26
|
easterobot/commands/help.py,sha256=FWYSkmYvFzrGKBV7I-qu6J4EYXjRjFCJvDa5F48OaEU,1133
|
27
27
|
easterobot/commands/info.py,sha256=mh2vStpkRbuwwvV7PxPv0nhSMI-AP58c_cMvDa8ohW8,1812
|
28
28
|
easterobot/commands/reset.py,sha256=ArWCJvRHOOH7KNQymcfkeFuRxzVz-YMn0-c29ycGaMQ,3651
|
@@ -31,9 +31,9 @@ easterobot/commands/search.py,sha256=rgpqkcYutp0UgW_BN77YxdUg5zqWrQ4RRbBt4V49wo4
|
|
31
31
|
easterobot/commands/top.py,sha256=-wlshgpPBtxBOJe1Ltmds_siQ0EhJCl3C2QMldpfs0o,3040
|
32
32
|
easterobot/games/__init__.py,sha256=WHqTEE4OW1kwOZlzQslkXYMf38nDX5gT01zsgDAr80g,259
|
33
33
|
easterobot/games/connect4.py,sha256=uF1Q1RLf18Ml0yeXjtX4WeepQJOVtMiuUgkDF5xB3XY,6315
|
34
|
-
easterobot/games/game.py,sha256=
|
34
|
+
easterobot/games/game.py,sha256=1nFTFV5U9BXEUw7MwhgoXVGYLyiN7uAyEL1RLm2aN30,14160
|
35
35
|
easterobot/games/rock_paper_scissor.py,sha256=QZOgXrjs0Di2cqSRZxgbFFGmxHTTMFb3Fi59kJikA7c,7832
|
36
|
-
easterobot/games/skyjo.py,sha256=
|
36
|
+
easterobot/games/skyjo.py,sha256=g1123i-KQ3XeAvSX0eeEF-ydq5YpFDSNJpKOUgZ597I,27321
|
37
37
|
easterobot/games/tic_tac_toe.py,sha256=okfxhZeUEUyXCG60jo-Qfd7a4nWRLbZ0p7OoJBTzxvw,5165
|
38
38
|
easterobot/hunts/__init__.py,sha256=R0fO04m1F9kEmBy_5EzlYvWVjmY74q5adINEZGGnwCQ,258
|
39
39
|
easterobot/hunts/hunt.py,sha256=_X55JCWAQi76nvxZ-Wv-i7SBsDrj7mIZX2c-ijilhOc,18915
|
@@ -123,8 +123,8 @@ easterobot/resources/emotes/skyjo/skyjo_p6.png,sha256=gSQug3mYmCiH49LYIBwucrBP_S
|
|
123
123
|
easterobot/resources/emotes/skyjo/skyjo_p7.png,sha256=HZCc1mWxGS-BNTqSPkFQlNVX5AzH5P9HNX55Wzq1sm0,489
|
124
124
|
easterobot/resources/emotes/skyjo/skyjo_p8.png,sha256=7tbzRNmbsSEc0CkmwxdXxASPCydao1ThKTU-FWB2HE8,708
|
125
125
|
easterobot/resources/emotes/skyjo/skyjo_p9.png,sha256=a7x8fL60meKbAIad8YCiuxduum6OwiXceoC3Tq9wLWo,522
|
126
|
-
easterobot-1.5.
|
127
|
-
easterobot-1.5.
|
128
|
-
easterobot-1.5.
|
129
|
-
easterobot-1.5.
|
130
|
-
easterobot-1.5.
|
126
|
+
easterobot-1.5.2.dist-info/METADATA,sha256=UxC5WvfKWICMlDDLyN0ClNV6uyPsmt1Bb774kEmYr_w,8099
|
127
|
+
easterobot-1.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
128
|
+
easterobot-1.5.2.dist-info/entry_points.txt,sha256=KaH17cNnu7qbWxFcMaj1wZ9GPTjWJ1OTqkBMhoLOmCQ,57
|
129
|
+
easterobot-1.5.2.dist-info/licenses/LICENSE,sha256=kYRz570GVPktzhJxWtaencsrsjdKSetpe5WISlDrvnY,1093
|
130
|
+
easterobot-1.5.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|