Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

vkbottle BaseStateGroup asks for another class

I have code like this and I am trying to make a State.

from vkbottle.bot import Bot, Message
from vkbottle import Keyboard, KeyboardButtonColor, Text
from vkbottle_types import BaseStateGroup
class SuperStates(BaseStateGroup):
  NAME = 0


@bot.on.message(state=SuperStates.NAME)  # StateRule(SuperStates.AWKWARD_STATE)
async def awkward_handler(message: Message):
   await message.answer("oi awkward")

@bot.on.message(lev="/die")
async def die_handler(message: Message):
   await bot.state_dispenser.set(message.peer_id, SuperStates.NAME)
   return "ok"

Here is the error and I can’t figure out what is causing it.

 raise DeprecationWarning(
DeprecationWarning: BaseStateGroup from vkbottle_types is deprecated and will be removed in future releases, use vkbottle.BaseStateGroup instead

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

First: you have a warning there, not an error.

The warning is triggered because your code will not work in future versions of vkbottle.

To fix this, just do what the warning suggests:

use…

from vkbottle import BaseStateGroup

instead of using…

from vkbottle_types import BaseStateGroup

A deprecation warning exists to indicate that in future versions one or more functionalities will be removed or moved to other categories

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading