Skip to content

Commit

Permalink
few fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bomzheg committed Nov 3, 2022
1 parent bf02292 commit e770891
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tests/fixtures/resources/simple_scn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ levels:
- type: text
text: "загадка"
- type: text
text: "(сложная)"
text: "(ну не очень сложная)"
- time: 1
hint:
- type: text
text: "подсказка"
text: "подсказонька"
- time: 2
hint:
- type: text
Expand Down
11 changes: 6 additions & 5 deletions tgbot/handlers/game/play.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from aiogram import Bot, Router
from aiogram.dispatcher.event.bases import SkipHandler
from aiogram.types import Message

from db.dao.holder import HolderDao
Expand All @@ -7,7 +8,7 @@
from shvatka.services.game_play import check_key
from shvatka.utils.exceptions import InvalidKey
from shvatka.utils.key_checker_lock import KeyCheckerFactory
from tgbot.config.models.main import TgBotConfig
from tgbot.config.models.bot import BotConfig
from tgbot.filters.game_status import GameStatusFilter
from tgbot.views.game import GameBotLog, create_bot_game_view, BotOrgNotifier

Expand All @@ -21,7 +22,7 @@ async def check_key_handler(
scheduler: Scheduler,
locker: KeyCheckerFactory,
bot: Bot,
config: TgBotConfig,
config: BotConfig,
):
try:
await check_key(
Expand All @@ -31,16 +32,16 @@ async def check_key_handler(
game=await dao.game.get_full(game.id),
dao=dao.game_player,
view=create_bot_game_view(bot=bot, dao=dao),
game_log=GameBotLog(bot=bot, log_chat_id=config.bot.log_chat),
game_log=GameBotLog(bot=bot, log_chat_id=config.log_chat),
org_notifier=BotOrgNotifier(bot=bot),
locker=locker,
scheduler=scheduler,
)
except InvalidKey:
pass
raise SkipHandler


def setup() -> Router:
router = Router(name=__name__)
router.message.register(check_key, GameStatusFilter(running=True)) # is_team, is_played_player
router.message.register(check_key_handler, GameStatusFilter(running=True)) # is_team, is_played_player
return router

0 comments on commit e770891

Please sign in to comment.