vkbottle BaseStateGroup asks for another class

Question:

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
Asked By: Kirill Shishkov

||

Answers:

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

Answered By: NiiRexo
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.