P
P
piki_adm2020-05-31 17:48:23
Python
piki_adm, 2020-05-31 17:48:23

How to properly set up a brunch?

Code snippet:

import random
import sqlite3
import vk_api
import vkcoin
from vk_api.longpoll import VkLongPoll
from vkbottle import Bot, Message
from vkcoinapi import *
from vkbottle.keyboard import Keyboard, Text
from vkbottle import Bot, Message, keyboard_gen
from vkbottle.branch import Branch, ExitBranch 
import os
@bot.on.message(text="хочу в бранч", lower=True)
async def wrapper(ans: Message):
  await ans("Теперь ты в бранче!")
  await bot.branch.add(ans.peer_id, "my_branch")


@bot.branch.simple_branch("my_branch")
async def branch(ans: Message):
  if ans.text.lower() == "выйти":
    await ans("Окей, вывожу!")
    await bot.branch.exit(ans.peer_id)

  await ans("Ты в бранче. Пиши «выйти», чтобы выйти отсюда.")


mistake:
Traceback (most recent call last):
  File "C:\Users\Papa\AppData\Local\Programs\Python\Python38\lib\site-packages\vkbottle\framework\framework\swear_handler.py", line 26, in wrapper
    return await func(*args, **kwargs)
  File "C:\Users\Papa\AppData\Local\Programs\Python\Python38\lib\site-packages\vkbottle\framework\bot\processor.py", line 35, in parent_processor
    return await self.message_processor(obj, client_info)
  File "C:\Users\Papa\AppData\Local\Programs\Python\Python38\lib\site-packages\vkbottle\framework\bot\processor.py", line 58, in message_processor
    await self.branch_processor(obj, client_info, middleware_args)
  File "C:\Users\Papa\AppData\Local\Programs\Python\Python38\lib\site-packages\vkbottle\framework\bot\processor.py", line 144, in branch_processor
    disposal, branch = await self.branch.load(branch_checkup_key)
  File "C:\Users\Papa\AppData\Local\Programs\Python\Python38\lib\site-packages\vkbottle\framework\framework\branch\database_branch.py", line 105, in load
    branch = self.get_branch(branch_name, context)
  File "C:\Users\Papa\AppData\Local\Programs\Python\Python38\lib\site-packages\vkbottle\framework\framework\branch\database_branch.py", line 36, in get_branch
    branch = bare()


What exactly needs to be fixed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
piki_adm, 2020-05-31
@piki_adm

Write this in cmd and it will work:
pip install https://github.com/timoniq/vkbottle/archive/master.zip -U

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question