W
W
Wearant2022-01-27 00:09:21
Python
Wearant, 2022-01-27 00:09:21

How to make LoopWrapper + VKBOTTLE blueprints work?

I can't figure out how to make it work.
Since each of these modules is run by run_forever

from vkbottle import Bot, load_blueprints_from_package
from config import token
import logging

bot = Bot(token)
logging.basicConfig(level=logging.DEBUG)

for bp in load_blueprints_from_package("blueprints"):
    bp.load(bot)
    
bot.run_forever()


Since we use prints, that is, the prints folder, where I tried to upload the file with loop
from vkbottle import LoopWrapper

lw = LoopWrapper()

@lw.interval(seconds=5)
async def work_check():
    print("Work")

Accordingly, it doesn’t work until I add
lw.run_forever() to the bottom of the code,
but then the rest stops working, the main
bot.run_forever()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
daniil_cara, 2022-02-27
@daniil_cara

First, import the lw variable from the file and write bot.loop_wrapper = lw before bot.run_forever()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question