summaryrefslogtreecommitdiff
path: root/ATRI/plugins/status/__init__.py
blob: 06afa3be58f199393226aff1f31cc2ef9ea07dbb (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
30
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)
async def _status_checking():
    global info_msg
    msg, stat = IsSurvive().get_status()
    if not stat:
        await status.finish(msg)