Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/github/utils.py

65 lines
1.4 KiB
Python
Raw Normal View History

2021-07-30 08:06:10 +00:00
import datetime
from core import dirty_check as dirty
2021-08-07 07:56:48 +00:00
2021-07-30 08:06:10 +00:00
def darkCheck(msg: str):
blacklist = [
'china-dictatorship'
'cirosantilli',
'gfwlist',
'v2ray',
'shadowsocks',
'xi-yu-yan-kai-fa',
'xi-winnie-rainbow-fart',
'xi-speech-synthesizer',
'dnmkrgi',
'xi-speech-demo',
'zhao',
'programthink'
]
for i in blacklist:
if msg.find(i) > -1:
return True
return False
2021-08-07 07:56:48 +00:00
2021-07-30 08:06:10 +00:00
def time_diff(time: str):
datetimed = datetime.datetime.strptime(time, '%Y-%m-%dT%H:%M:%SZ').timestamp()
now = datetime.datetime.now().timestamp()
diff = now - datetimed
diff = diff
t = diff / 60 / 60 / 24
dw = ' day(s)'
if t < 1:
t = diff / 60 / 60
dw = ' hour(s)'
if t < 1:
t = diff / 60
dw = ' minute(s)'
if t < 1:
t = diff
dw = ' second(s)'
diff = str(int(t)) + dw
return diff
async def dirty_check(text, *allowlist_check):
allowlist = [
2021-07-30 08:06:10 +00:00
'Teahouse-Studios',
'Dianliang233',
'OasisAkari',
'Lakejason0',
'wyapx',
'XxLittleCxX',
'lakejason0'
]
if allowlist_check in allowlist:
2021-07-30 08:06:10 +00:00
return False
check = await dirty.check(text)
2021-11-12 14:25:53 +00:00
for x in check:
if not x['status']:
return True
2021-07-30 08:06:10 +00:00
return False