[英]vkbottle BaseStateGroup asks for another class
我有這樣的代碼,我正在嘗試制作一個 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"
這是錯誤,我不知道是什么原因造成的。
raise DeprecationWarning(
DeprecationWarning: BaseStateGroup from vkbottle_types is deprecated and will be removed in future releases, use vkbottle.BaseStateGroup instead
第一:你在那里有一個警告,而不是一個錯誤。
觸發警告是因為您的代碼將無法在未來版本的 vkbottle 中運行。
要解決此問題,請按照警告建議執行操作:
采用...
from vkbottle import BaseStateGroup
而不是使用...
from vkbottle_types import BaseStateGroup
存在棄用警告,表明在未來的版本中,一項或多項功能將被刪除或移至其他類別
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.