Fixed keyboard and added man page
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -1,43 +1,21 @@
|
||||
import json
|
||||
import logging
|
||||
import random
|
||||
|
||||
from vkwave.bots import DefaultRouter, SimpleBotEvent, simple_bot_message_handler, PayloadFilter, PayloadContainsFilter, \
|
||||
PhotoUploader, Storage
|
||||
from vkwave.bots import Keyboard, ButtonColor
|
||||
from vkwave.bots import DefaultRouter, SimpleBotEvent, PayloadContainsFilter
|
||||
from vkwave.bots import Keyboard
|
||||
from vkwave.bots import EventTypeFilter, BotEvent
|
||||
from vkwave.types.bot_events import BotEventType
|
||||
from vkwave.bots.fsm import FiniteStateMachine, StateFilter, ForWhat, State, ANY_STATE
|
||||
|
||||
import locales
|
||||
import util
|
||||
from config import Config
|
||||
from db import DB
|
||||
from db.db import TestResult
|
||||
from locales import INPUT_NAME_TEXT
|
||||
|
||||
|
||||
# MENU_KB.add_row()
|
||||
# MENU_KB.add_text_button(text="Профиль", payload={"command": "profile"}, color=ButtonColor.SECONDARY)
|
||||
# MENU_KB.add_row()
|
||||
# MENU_KB.add_text_button(text="Бонус", payload={"command": "bonus"}, color=ButtonColor.POSITIVE)
|
||||
# from nft_things.NftSender import NFTSender
|
||||
from util.redis_db import RedisDB
|
||||
from util.nft_util import get_image
|
||||
|
||||
test_router = DefaultRouter()
|
||||
|
||||
EMPTY_KB = '{"buttons": [], "inline": false, "one_time": false}'
|
||||
|
||||
# # exiting from poll (works on any state)
|
||||
# @test_router.registrar.with_decorator(
|
||||
# lambda event: event.object.object.message.text == "exit",
|
||||
# StateFilter(fsm=fsm, state=ANY_STATE, for_what=ForWhat.FOR_USER)
|
||||
# )
|
||||
# async def simple_handler(event: BotEvent):
|
||||
# # Check if we have the user in database
|
||||
# if await fsm.get_data(event, for_what=ForWhat.FOR_USER) is not None:
|
||||
# await fsm.finish(event=event, for_what=ForWhat.FOR_USER)
|
||||
# return "You are quited!"
|
||||
|
||||
@test_router.registrar.with_decorator(
|
||||
EventTypeFilter(BotEventType.MESSAGE_NEW.value),
|
||||
@ -51,7 +29,6 @@ async def main_part_handle(event: BotEvent):
|
||||
state_idx = int(payload["test"])
|
||||
logging.debug(f"State index: {state_idx}")
|
||||
|
||||
|
||||
q_res = payload['q'] if 'q' in payload else event.object.object.message.text
|
||||
logging.debug(f"Qres: {q_res}")
|
||||
|
||||
@ -73,7 +50,7 @@ async def main_part_handle(event: BotEvent):
|
||||
return await botevent.answer(
|
||||
message=locales.questions[state_idx + 1][0],
|
||||
payload=json.dumps({"test": state_idx + 1}),
|
||||
|
||||
keyboard=EMPTY_KB, # try to remove keyboard
|
||||
)
|
||||
else:
|
||||
# todo add task to send user an image here
|
||||
@ -92,21 +69,3 @@ async def main_part_handle(event: BotEvent):
|
||||
message=locales.LAST_MESSAGE,
|
||||
keyboard=locales.LAST_MESSAGE_KB.get_keyboard(),
|
||||
)
|
||||
|
||||
# @test_router.registrar.with_decorator(
|
||||
# StateFilter(fsm=fsm, state=MyState.age, for_what=ForWhat.FOR_USER),
|
||||
# )
|
||||
# async def simple_handler(event: BotEvent):
|
||||
# if not event.object.object.message.text.isdigit():
|
||||
# return f"Please, send only positive numbers!"
|
||||
# await fsm.add_data(
|
||||
# event=event,
|
||||
# for_what=ForWhat.FOR_USER,
|
||||
# state_data={"age": event.object.object.message.text},
|
||||
# )
|
||||
# user_data = await fsm.get_data(event=event, for_what=ForWhat.FOR_USER)
|
||||
#
|
||||
# # finish poll and delete the user
|
||||
# # `fsm.finish` will do it
|
||||
# await fsm.finish(event=event, for_what=ForWhat.FOR_USER)
|
||||
# return f"Your data - {user_data}"
|
||||
|
Reference in New Issue
Block a user