blob: 55b1b60db9c16cb1973e9331ebffa41b4346d4de (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
import json
import datetime
from pathlib import Path
from random import randint
from nonebot import on_command, CommandSession
from ATRI.modules.time import sleepTime
from ATRI.modules.funcControl import checkNoob
# =========[好感度阶级说明]=========
# - 0-100 陌生人
# - 100-250 朋友
# - 250-350 亲密的朋友
# - 350-400 ???
# - 400-* 开冲
# =================================
@on_command('SingIN', aliases = ['签到'])
async def _(session: CommandSession):
group = session.event.group_id
user = session.event.user_id
if sleepTime():
await session.send(sleepTime())
else:
if checkNoob(user, group):
try:
with open(Path('.') / 'ATRI' / 'modules' / 'favoIMP' / 'user.json', 'r') as f:
data = json.load(f)
except:
data = {}
try:
if data[f"{user}"][1] == datetime.date.today().strftime('%y%m%d'):
await session.send('咱今天签到过啦~明天再来吧!')
return
except:
pass
favoIMP = randint(1,5)
try:
with open(Path('.') / 'ATRI' / 'modules' / 'favoIMP' / 'user.json', 'r') as f:
data = json.load(f)
data[f"{user}"] = [f"{int(data[f'{user}'][0]) + favoIMP}", f"{datetime.date.today().strftime('%y%m%d')}"]
with open(Path('.') / 'ATRI' / 'modules' / 'favoIMP' / 'user.json', 'w') as f:
f.write(json.dumps(data))
f.close()
except:
data = {}
data[f"{user}"] = [f"{favoIMP}", f"{datetime.date.today().strftime('%y%m%d')}"]
with open(Path('.') / 'ATRI' / 'modules' / 'favoIMP' / 'user.json', 'w') as f:
f.write(json.dumps(data))
f.close()
IMP = int(data[f"{user}"][0])
msg0 = f'[CQ:at,qq={user}]\n'
msg0 += '签到成功ヾ(≧∇≦*)ゝ\n'
msg0 += f'+ 好感度 {favoIMP}|{IMP}\n'
if 0 <= IMP < 100:
msg0 += '今日もいい日ですよ!~頑張ってください!'
elif 100 <= IMP < 250:
msg0 += 'アトリが心から応援します!'
elif 250 <= IMP < 350:
msg0 += 'アトリはあなたを待ちます'
elif 350 <= IMP < 400:
msg0 += 'わ...わたし...えと...す...'
elif 400 <= IMP:
msg0 += '好きだあなた好きだ!永遠!'
await session.send(msg0)
|