📊 增加用户数统计

This commit is contained in:
Xtao_dada 2020-08-05 00:55:37 +08:00 committed by GitHub
parent ecbcb9f6f4
commit 68ce61ca23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,29 @@
from time import time
from uuid import uuid1
from os.path import exists
from requests import get
from pagermaid import bot, working_dir
from pagermaid.listener import listener
@listener(incoming=True, ignore_edited=True)
async def status(context):
if exists(f"{working_dir}/data/time"):
with open(f"{working_dir}/data/time", "r") as f: # 打开文件
status_time = float(f.read().replace("\n", "")) # 读取文件
else:
status_time = 0
if status_time + 120 < time():
with open(f"{working_dir}/data/time", "w") as f:
f.write(str(time()))
if not exists(f"{working_dir}/data/uuid"):
with open(f"{working_dir}/data/uuid","w") as f:
f.write(str(uuid1()))
with open(f"{working_dir}/data/uuid", "r") as f: # 打开文件
uuid = f.read() # 读取文件
try:
get("https://xtaolink.cn/git/staton.php?id=" + uuid)
except:
pass
else:
pass