Files
croccybot/bot/core/module.py
Conatum 0183b63c55 Data system refactor and core redesign for public.
Redesigned data and core systems to be public-capable.
2021-09-12 11:04:49 +03:00

37 lines
687 B
Python

import logging
import asyncio
from meta import client, conf
from LionModule import LionModule
from .lion import Lion
module = LionModule("Core")
async def _lion_sync_loop():
while True:
while not client.is_ready():
await asyncio.sleep(1)
client.log(
"Running lion data sync.",
context="CORE",
level=logging.DEBUG,
post=False
)
Lion.sync()
await asyncio.sleep(conf.bot.getint("lion_sync_period"))
@module.launch_task
async def launch_lion_sync_loop(client):
asyncio.create_task(_lion_sync_loop())
@module.unload_task
async def final_lion_sync(client):
Lion.sync()