def foo(bot, update):
    cmd = update.message.text.strip('/')
    update.message.reply_text('command filter\ncmd: "%s"' % cmd)
   

def main():

	# some code here...
	
	# Фильтр должен идти после всех комманд-хэндлеров, как я понимаю
	dp.add_handler(MessageHandler(Filters.command, test))
	