Fixed group add event
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Andrey Gumirov
2022-05-01 02:36:51 +07:00
parent 65ed6f9fa6
commit 08e7f4ee93
7 changed files with 61 additions and 19 deletions

View File

@ -1,12 +1,29 @@
from vkwave.bots import DefaultRouter, SimpleBotEvent, simple_bot_message_handler
from vkwave.bots import DefaultRouter, SimpleBotEvent, simple_bot_message_handler, EventTypeFilter
from vkwave.types.bot_events import BotEventType
import locales
menu_router = DefaultRouter()
@simple_bot_message_handler(menu_router,)
@menu_router.registrar.with_decorator(
EventTypeFilter(BotEventType.MESSAGE_NEW.value),
)
async def menu(event: SimpleBotEvent):
return await event.answer(
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
)