from vkwave.bots import DefaultRouter, SimpleBotEvent, simple_bot_message_handler, EventTypeFilter
from vkwave.types.bot_events import BotEventType

import locales

menu_router = DefaultRouter()


@menu_router.registrar.with_decorator(
    EventTypeFilter(BotEventType.MESSAGE_NEW.value),
)
async def menu(event: SimpleBotEvent):
    sevent = SimpleBotEvent(event)
    return await sevent.answer(
        message=locales.MENU,
        keyboard=locales.MENU_KB.get_keyboard(),
    )


@menu_router.registrar.with_decorator(
    EventTypeFilter(BotEventType.GROUP_JOIN.value),
)
async def menu(event: SimpleBotEvent):
    return await event.api_ctx.messages.send(
            keyboard=locales.MENU_KB.get_keyboard(),
            peer_id=event.object.object.user_id,
            message=locales.MENU,
            random_id=0
        )
