2023-01-31 16:24:56 +00:00
|
|
|
from pagermaid import read_context
|
|
|
|
from pagermaid.common.reload import reload_all
|
2023-01-14 05:49:08 +00:00
|
|
|
from pagermaid.enums import Message
|
2022-06-20 13:55:14 +00:00
|
|
|
from pagermaid.listener import listener
|
2023-01-31 16:24:56 +00:00
|
|
|
from pagermaid.services import scheduler
|
2023-01-14 05:49:08 +00:00
|
|
|
from pagermaid.utils import lang
|
2022-06-20 13:55:14 +00:00
|
|
|
|
|
|
|
|
2023-03-12 03:56:01 +00:00
|
|
|
@listener(
|
|
|
|
is_plugin=False, command="reload", need_admin=True, description=lang("reload_des")
|
|
|
|
)
|
2022-06-20 13:55:14 +00:00
|
|
|
async def reload_plugins(message: Message):
|
2023-03-12 03:56:01 +00:00
|
|
|
"""To reload plugins."""
|
2022-11-14 14:11:27 +00:00
|
|
|
await reload_all()
|
2022-06-20 13:55:14 +00:00
|
|
|
await message.edit(lang("reload_ok"))
|
2023-01-14 05:49:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
@scheduler.scheduled_job("cron", hour="4", id="reload.clear_read_context")
|
|
|
|
async def clear_read_context_cron():
|
|
|
|
read_context.clear()
|