summaryrefslogtreecommitdiff
path: root/ATRI/plugins/status/__init__.py
blob: 05ece793ae1fafb23c4287b34c7c5acc120cdca9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from ATRI.utils.apscheduler import scheduler
from .data_source import IsSurvive


ping = IsSurvive().on_command("/ping", "检测bot简单信息处理速度")


@ping.handle()
async def _ping():
    await ping.finish(IsSurvive.ping())


status = IsSurvive().on_command("/status", "查看运行资源占用")


@status.handle()
async def _status():
    msg, _ = IsSurvive.get_status()
    await status.finish(msg)


info_msg = "アトリは高性能ですから!"


@scheduler.scheduled_job("interval", name="状态检查", minutes=10, misfire_grace_time=15)  # type: ignore
async def _check_runtime():
    msg, stat = IsSurvive().get_status()
    if not stat:
        await status.finish(msg)