mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 01:15:31 +00:00
Create regexp_commands_filter_example.py
This commit is contained in:
parent
d1234880fa
commit
08b7021ca0
1 changed files with 16 additions and 0 deletions
16
examples/regexp_commands_filter_example.py
Normal file
16
examples/regexp_commands_filter_example.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from aiogram import Bot, types
|
||||
from aiogram.dispatcher import Dispatcher, filters
|
||||
from aiogram.utils import executor
|
||||
|
||||
bot = Bot(token='TOKEN')
|
||||
dp = Dispatcher(bot)
|
||||
|
||||
|
||||
@dp.message_handler(filters.RegexpCommandsFilter(regexp_commands=['item_([0-9]*)']))
|
||||
async def send_welcome(message: types.Message):
|
||||
regexp_command = message.conf['regexp_command']
|
||||
await message.reply("You have requested an item with number: {}".format(regexp_command.group(1)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
executor.start_polling(dp)
|
||||
Loading…
Add table
Add a link
Reference in a new issue