import time from vk.bot_framework.dispatcher import Blueprint from db.models.user import User bp = Blueprint() @bp.message_handler(in_chat=True) async def message(_, data: dict): user: User = data["current_user"] user.update({"last_message_time": time.time()}) await User.add_carma(user, 1)
from vk import types from vk import VK from vk.bot_framework import Dispatcher, get_group_id from vk.bot_framework.dispatcher import Blueprint from vk.types import BotEvent from vk.utils import TaskManager logging.basicConfig(level="DEBUG") bot_token = "token" vk = VK(bot_token) task_manager = TaskManager(vk.loop) dp = Dispatcher(vk) bp = Blueprint() other_bp = Blueprint(commands=["tested"]) @bp.message_handler(text="hello") async def handler(message: types.Message, data: dict): await message.answer("hello my friend!") @other_bp.message_handler() async def handler_yes(message: types.Message, data: dict): await message.answer("Yes.") @bp.event_handler(BotEvent.WALL_POST_NEW)