|
4 | 4 | from aiogram import Bot, Dispatcher, F |
5 | 5 | from aiogram.client.default import DefaultBotProperties |
6 | 6 | from aiogram.enums import ParseMode |
7 | | -from aiogram.filters import Command |
| 7 | +from aiogram.filters import Command, StateFilter |
8 | 8 | from aiogram.fsm.storage.memory import MemoryStorage |
9 | 9 | from loguru import logger |
10 | 10 |
|
|
22 | 22 | wallet, |
23 | 23 | ) |
24 | 24 | from tg_bot.conversations.router import router |
| 25 | +from tg_bot.conversations.states import CopyTradeStates, MonitorStates, WalletStates |
25 | 26 | from tg_bot.middlewares import AuthorizationMiddleware, DebugMiddleware |
26 | 27 | from tg_bot.notify.notify import Notify |
27 | 28 |
|
@@ -52,7 +53,17 @@ async def start_bot(): |
52 | 53 | dp.message.register(setting.setting_command, Command("set")) |
53 | 54 | dp.message.register(wallet.wallet_command, Command("wallet")) |
54 | 55 | dp.message.register(asset.asset_command, Command("asset")) |
55 | | - dp.message.register(swap.info_command, F.text.regexp(r"^[a-zA-Z0-9]{44}$")) |
| 56 | + excluded_states = [ |
| 57 | + CopyTradeStates.CREATE_WAITING_FOR_ADDRESS, |
| 58 | + CopyTradeStates.EDIT_WAITING_FOR_ADDRESS, |
| 59 | + MonitorStates.CREATE_WAITING_FOR_ADDRESS, |
| 60 | + WalletStates.WAITING_FOR_NEW_PRIVATE_KEY, |
| 61 | + ] |
| 62 | + dp.message.register( |
| 63 | + swap.info_command, |
| 64 | + F.text.regexp(r"^[a-zA-Z0-9]{44}$"), |
| 65 | + ~StateFilter(*excluded_states), |
| 66 | + ) |
56 | 67 | dp.message.register( |
57 | 68 | swap.swap_command, Command(re.compile(r"^buy.*"), re.compile(r"^sell.*")) |
58 | 69 | ) |
|
0 commit comments