🐛 fuckadmin 修复逻辑错误

This commit is contained in:
xtaodada 2021-07-11 23:43:30 +08:00
parent a315456881
commit bd8c1680b9
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 11 additions and 11 deletions

View File

@ -6,21 +6,21 @@ from telethon.tl.types import ChannelParticipantsAdmins
def eval_time(context, msg, day): def eval_time(context, msg, day):
now = context.date now = context.date
old = msg.date old = msg.date
between = (now - old).seconds sec = (now - old).seconds
require_sec = day * 86400 days = (now - old).days
if between < require_sec: if days < day:
return None return None
minute, sec = divmod(between, 60) minute, sec = divmod(sec, 60)
hour, minute = divmod(minute, 60) hour, minute = divmod(minute, 60)
day, hour = divmod(hour, 24)
month, day = divmod(day, 30) month, days = divmod(days, 30)
year, month = divmod(month, 12) year, month = divmod(month, 12)
if year > 0: if year > 0:
time = "%02d%02d%02d%02d%02d%02d" % (year, month, day, hour, minute, sec) time = "%02d%02d%02d%02d%02d%02d" % (year, month, days, hour, minute, sec)
elif month > 0: elif month > 0:
time = "%02d%02d%02d%02d%02d" % (month, day, hour, minute, sec) time = "%02d%02d%02d%02d%02d" % (month, days, hour, minute, sec)
elif day > 0: elif day > 0:
time = "%02d%02d%02d%02d" % (day, hour, minute, sec) time = "%02d%02d%02d%02d" % (days, hour, minute, sec)
elif hour > 0: elif hour > 0:
time = "%02d%02d%02d" % (hour, minute, sec) time = "%02d%02d%02d" % (hour, minute, sec)
elif minute > 0: elif minute > 0:

View File

@ -572,10 +572,10 @@
}, },
{ {
"name": "fuckadmin", "name": "fuckadmin",
"version": "1.01", "version": "1.1",
"section": "daily", "section": "daily",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "2.7 kb", "size": "2.9 kb",
"supported": true, "supported": true,
"des-short": "列出群组中所有潜水超过 n 天的管理员。", "des-short": "列出群组中所有潜水超过 n 天的管理员。",
"des": "列出群组中所有潜水超过 n 天的管理员。n>=7。命令fuckadmin 。" "des": "列出群组中所有潜水超过 n 天的管理员。n>=7。命令fuckadmin 。"