Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudw233 committed Feb 7, 2025
1 parent 44be797 commit b3d7b11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions modules/tic_tac_toe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Awaitable, Callable, List, Tuple
from typing import Callable, List, Tuple, Coroutine, Any

from core.builtins import Bot
from core.component import module
Expand Down Expand Up @@ -33,7 +33,7 @@ def check_winner(board: List[List[int]]):


GameBoard = List[List[int]]
GameCallback = Callable[[List[List[int]]], Awaitable[Tuple[int]]]
GameCallback = Callable[[List[List[int]]], Coroutine[Any, Any, Tuple[int,int]]]


class TerminationError(Exception):
Expand Down Expand Up @@ -271,6 +271,8 @@ async def _(msg: Bot.MessageSession):
@tic_tac_toe.command("expert {{tic_tac_toe.help.expert}}")
@tic_tac_toe.command("master {{tic_tac_toe.help.master}}")
async def _(msg: Bot.MessageSession):
game_type = "random"
bot_callback = random_bot_callback
if msg.parsed_msg:
if "expert" in msg.parsed_msg:
game_type = "expert"
Expand All @@ -281,9 +283,6 @@ async def _(msg: Bot.MessageSession):
elif "noob" in msg.parsed_msg:
game_type = "noob"
bot_callback = noob_bot_callback
else:
game_type = "random"
bot_callback = random_bot_callback
play_state = PlayState("tic_tac_toe", msg)
if play_state.check():
await msg.finish(msg.locale.t("game.message.running"))
Expand Down
4 changes: 2 additions & 2 deletions modules/wordle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,12 @@ async def _(msg: Bot.MessageSession):
board.reset_board()
qc.reset()
send = msg.locale.t("wordle.message.stop", answer=play_state.get("answer"))
elif target_play_state.check():
if target_play_state.check():
target_play_state.disable()
board.reset_board()
t_qc.reset()
send = msg.locale.t("wordle.message.stop", answer=target_play_state.get("answer"))
else:
if not play_state.check() and not target_play_state.check():
await msg.finish(msg.locale.t("game.message.stop.none"))
await msg.finish(send)

Expand Down

0 comments on commit b3d7b11

Please sign in to comment.