Archived
1
0
Fork 0
This commit is contained in:
yzhh 2020-08-08 14:30:04 +08:00
parent 404ba6d87b
commit c12ff0523d
13 changed files with 82 additions and 428 deletions

106
UTC8.py
View file

@ -1,58 +1,68 @@
import re import re
def UTC8(str1): def UTC8(str1,outtype):
q = re.match(r'(.*)-(.*)-(.*)T(.*):(.*):(.*)Z', str1) if str1 == 'infinity':
y = int(q.group(1)) return ('无限期')
m = int(q.group(2))
d = int(q.group(3))
h = int(q.group(4))
mi = int(q.group(5))
s = int(q.group(6))
h = h + 8
if h > 24 :
d = d + 1
h = h - 24
else: else:
pass q = re.match(r'(.*)-(.*)-(.*)T(.*):(.*):(.*)Z', str1)
if m == 2: y = int(q.group(1))
if y % 100 == 0: m = int(q.group(2))
if y % 400 == 0: d = int(q.group(3))
pass h = int(q.group(4))
else: mi = int(q.group(5))
if d == 29: s = int(q.group(6))
h = h + 8
if h > 24 :
d = d + 1
h = h - 24
else:
pass
if m == 2:
if y % 100 == 0:
if y % 400 == 0:
pass
else:
if d == 29:
m = m + 1
d = d - 28
else:
pass
if d == 29:
if y % 4 == 0:
pass
else:
m = m + 1 m = m + 1
d = d - 28 d = d - 28
else: if d == 30:
pass
if d == 29:
if y % 4 == 0:
pass
else:
m = m + 1 m = m + 1
d = d - 28 d = d - 29
if d == 30: else:
m = m + 1 pass
d = d - 29
else: else:
pass pass
else: if d == 31:
pass if m == 4 or m == 6 or m == 9 or m == 11:
if d == 31: m = m + 1
if m == 4 or m == 6 or m == 9 or m == 11: d = d - 30
m = m + 1 else:
d = d - 30 pass
else: else:
pass pass
else: if d == 32:
pass m = m + 1
if d == 32: d = d - 31
m = m + 1 if m == 13:
d = d - 31 m = m - 12
if m == 13: y = y + 1
m = m - 12 if h == 24:
y = y + 1 if mi != 0:
if h == 24: h = h - 24
if mi != 0: if outtype == 'onlytimenoutc':
h = h - 24 return(str(h)+''+str(mi)+'')
return (str(h)+''+str(mi)+''+'UTC+8') elif outtype == 'onlytime':
return(str(h)+''+str(mi)+''+'UTC+8')
elif outtype == 'full':
return(str(y)+''+str(m)+''+str(d)+''+str(h)+''+str(mi)+''+'UTC+8')
elif outtype == 'notimezone':
return (str(y)+''+str(m)+''+str(d)+''+str(h)+''+str(mi)+'')

View file

@ -3,8 +3,9 @@ import json
import aiohttp import aiohttp
from pbc import main2 from pbc import main2
import re import re
from UTC8 import UTC8
async def ab(): async def ab():
url = 'https://minecraft-zh.gamepedia.com/api.php?action=query&list=abuselog&aflprop=user|title|action|result|filter&format=json' url = 'https://minecraft-zh.gamepedia.com/api.php?action=query&list=abuselog&aflprop=user|title|action|result|filter|timestamp&format=json'
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get(url) as req: async with session.get(url) as req:
if req.status != 200: if req.status != 200:
@ -14,10 +15,10 @@ async def ab():
file = json.loads(text1) file = json.loads(text1)
d = [] d = []
for x in file['query']['abuselog']: for x in file['query']['abuselog']:
d.append(x['title']+' - '+x['user']+'\n处理结果:'+x['result']) d.append(''+x['title']+' - '+x['user']+''+UTC8(x['timestamp'],'onlytimenoutc')+'\n过滤器名:'+x['filter']+'\n处理结果:'+x['result'])
y = await main2(d) y = await main2(d)
space = '\n' space = '\n'
f = re.findall(r'.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*',space.join(y)) f = re.findall(r'.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*',space.join(y))
if f[0].find('<吃掉了>')!=-1 or f[0].find('<全部吃掉了>')!=-1: if f[0].find('<吃掉了>')!=-1 or f[0].find('<全部吃掉了>')!=-1:
return(f[0]+'\n...仅显示前5条内容\n检测到外来信息介入请前往滥用日志查看所有消息。Special:滥用日志') return(f[0]+'\n...仅显示前5条内容\n检测到外来信息介入请前往滥用日志查看所有消息。Special:滥用日志')
else: else:

View file

@ -33,7 +33,7 @@ async def newbie(app: Mirai):
if xz['title'] in qq: if xz['title'] in qq:
pass pass
else: else:
s = await main(UTC8(xz['timestamp']) + '新增新人:' + xz['title']) s = await main(UTC8(xz['timestamp'],'onlytime') + '新增新人:' + xz['title'])
print(s) print(s)
if s[0].find("<吃掉了>")!=-1 or s[0].find("<全部吃掉了>")!=-1: if s[0].find("<吃掉了>")!=-1 or s[0].find("<全部吃掉了>")!=-1:
await app.sendGroupMessage(731397727,message=s[0]+'\n检测到外来信息介入请前往日志查看所有消息。Special:日志?type=newusers') await app.sendGroupMessage(731397727,message=s[0]+'\n检测到外来信息介入请前往日志查看所有消息。Special:日志?type=newusers')

View file

@ -1,58 +0,0 @@
import re
def UTC8(str1):
q = re.match(r'(.*)-(.*)-(.*)T(.*):(.*):(.*)Z', str1)
y = int(q.group(1))
m = int(q.group(2))
d = int(q.group(3))
h = int(q.group(4))
mi = int(q.group(5))
s = int(q.group(6))
h = h + 8
if h > 24 :
d = d + 1
h = h - 24
else:
pass
if m == 2:
if y % 100 == 0:
if y % 400 == 0:
pass
else:
if d == 29:
m = m + 1
d = d - 28
else:
pass
if d == 29:
if y % 4 == 0:
pass
else:
m = m + 1
d = d - 28
if d == 30:
m = m + 1
d = d - 29
else:
pass
else:
pass
if d == 31:
if m == 4 or m == 6 or m == 9 or m == 11:
m = m + 1
d = d - 30
else:
pass
else:
pass
if d == 32:
m = m + 1
d = d - 31
if m == 13:
m = m - 12
y = y + 1
if h == 24:
if mi != 0:
h = h - 24
return (str(y)+''+str(m)+''+str(d)+''+str(h)+''+str(mi)+''+'UTC+8')

View file

@ -3,6 +3,7 @@ import json
import aiohttp import aiohttp
from pbc import main2 from pbc import main2
import re import re
from UTC8 import UTC8
async def rc(): async def rc():
url = 'https://minecraft-zh.gamepedia.com/api.php?action=query&list=recentchanges&rcprop=title|user|timestamp&rctype=edit|new&format=json' url = 'https://minecraft-zh.gamepedia.com/api.php?action=query&list=recentchanges&rcprop=title|user|timestamp&rctype=edit|new&format=json'
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
@ -14,7 +15,7 @@ async def rc():
file = json.loads(text1) file = json.loads(text1)
d = [] d = []
for x in file['query']['recentchanges']: for x in file['query']['recentchanges']:
d.append(x['title']+' - '+x['user']+' '+x['timestamp']) d.append(x['title']+' - '+x['user']+' '+UTC8(x['timestamp'],'onlytime'))
y = await main2(d) y = await main2(d)
print(y) print(y)
space = '\n' space = '\n'

View file

@ -1,58 +0,0 @@
import re
def UTC8(str1):
q = re.match(r'(.*)-(.*)-(.*)T(.*):(.*):(.*)Z', str1)
y = int(q.group(1))
m = int(q.group(2))
d = int(q.group(3))
h = int(q.group(4))
mi = int(q.group(5))
s = int(q.group(6))
h = h + 8
if h > 24 :
d = d + 1
h = h - 24
else:
pass
if m == 2:
if y % 100 == 0:
if y % 400 == 0:
pass
else:
if d == 29:
m = m + 1
d = d - 28
else:
pass
if d == 29:
if y % 4 == 0:
pass
else:
m = m + 1
d = d - 28
if d == 30:
m = m + 1
d = d - 29
else:
pass
else:
pass
if d == 31:
if m == 4 or m == 6 or m == 9 or m == 11:
m = m + 1
d = d - 30
else:
pass
else:
pass
if d == 32:
m = m + 1
d = d - 31
if m == 13:
m = m - 12
y = y + 1
if h == 24:
if mi != 0:
h = h - 24
return (str(y)+''+str(m)+''+str(d)+''+str(h)+''+str(mi)+''+'UTC+8')

View file

@ -1,61 +0,0 @@
import re
def UTC8V(str1):
if str1 == 'infinity':
return ('无限期')
else:
q = re.match(r'(....)(..)(..)(..)(..)(..)', str1)
y = int(q.group(1))
m = int(q.group(2))
d = int(q.group(3))
h = int(q.group(4))
mi = int(q.group(5))
s = int(q.group(6))
h = h + 8
if h > 24 :
d = d + 1
h = h - 24
else:
pass
if m == 2:
if y % 100 == 0:
if y % 400 == 0:
pass
else:
if d == 29:
m = m + 1
d = d - 28
else:
pass
if d == 29:
if y % 4 == 0:
pass
else:
m = m + 1
d = d - 28
if d == 30:
m = m + 1
d = d - 29
else:
pass
else:
pass
if d == 31:
if m == 4 or m == 6 or m == 9 or m == 11:
m = m + 1
d = d - 30
else:
pass
else:
pass
if d == 32:
m = m + 1
d = d - 31
if m == 13:
m = m - 12
y = y + 1
if h == 24:
if mi != 0:
h = h - 24
return (str(y)+''+str(m)+''+str(d)+''+str(h)+''+str(mi)+''+'UTC+8')

View file

@ -1,10 +1,9 @@
import json import json
import re import re
import requests import requests
from .UTC8 import UTC8 from UTC8 import UTC8
from .yhz import yhz from .yhz import yhz
from .gender import gender from .gender import gender
from .UTC8V import UTC8V
import re import re
import urllib import urllib
from bs4 import BeautifulSoup as bs from bs4 import BeautifulSoup as bs
@ -26,10 +25,10 @@ def rUser1(url, str3):
User = '用户:' + file['query']['users'][0]['name'] User = '用户:' + file['query']['users'][0]['name']
Group = '用户组:' + yhz(str(file['query']['users'][0]['groups'])) Group = '用户组:' + yhz(str(file['query']['users'][0]['groups']))
Gender = '性别:' + gender(file['query']['users'][0]['gender']) Gender = '性别:' + gender(file['query']['users'][0]['gender'])
Registration = '注册时间:' + UTC8(file['query']['users'][0]['registration']) Registration = '注册时间:' + UTC8(file['query']['users'][0]['registration'],'full')
Blockedby = str(file['query']['users'][0]['blockedby']) Blockedby = str(file['query']['users'][0]['blockedby'])
Blockedtimestamp = UTC8(file['query']['users'][0]['blockedtimestamp']) Blockedtimestamp = UTC8(file['query']['users'][0]['blockedtimestamp'],'full')
Blockexpiry = UTC8V(str(file['query']['users'][0]['blockexpiry'])) Blockexpiry = UTC8(str(file['query']['users'][0]['blockexpiry']),'full')
Blockreason = str(file['query']['users'][0]['blockreason']) Blockreason = str(file['query']['users'][0]['blockreason'])
soup = bs(res.text, 'html.parser') soup = bs(res.text, 'html.parser')
stats = soup.find('div', class_='section stats') stats = soup.find('div', class_='section stats')
@ -48,7 +47,7 @@ def rUser1(url, str3):
User = '用户:' + file['query']['users'][0]['name'] User = '用户:' + file['query']['users'][0]['name']
Group = '用户组:' + yhz(str(file['query']['users'][0]['groups'])) Group = '用户组:' + yhz(str(file['query']['users'][0]['groups']))
Gender = '性别:' + gender(file['query']['users'][0]['gender']) Gender = '性别:' + gender(file['query']['users'][0]['gender'])
Registration = '注册时间:' + UTC8(file['query']['users'][0]['registration']) Registration = '注册时间:' + UTC8(file['query']['users'][0]['registration'],'full')
soup = bs(res.text, 'html.parser') soup = bs(res.text, 'html.parser')
stats = soup.find('div', class_='section stats') stats = soup.find('div', class_='section stats')
point = soup.find('div', class_='score').text point = soup.find('div', class_='score').text

View file

@ -1,10 +1,9 @@
import json import json
import re import re
import requests import requests
from .UTC8 import UTC8 from UTC8 import UTC8
from .yhz import yhz from .yhz import yhz
from .gender import gender from .gender import gender
from .UTC8V import UTC8V
import re import re
import urllib import urllib
def User1(url, str3): def User1(url, str3):
@ -24,10 +23,10 @@ def User1(url, str3):
Editcount = ' | 编辑数:' + str(file['query']['users'][0]['editcount']) Editcount = ' | 编辑数:' + str(file['query']['users'][0]['editcount'])
Group = '用户组:' + yhz(str(file['query']['users'][0]['groups'])) Group = '用户组:' + yhz(str(file['query']['users'][0]['groups']))
Gender = '性别:' + gender(file['query']['users'][0]['gender']) Gender = '性别:' + gender(file['query']['users'][0]['gender'])
Registration = '注册时间:' + UTC8(file['query']['users'][0]['registration']) Registration = '注册时间:' + UTC8(file['query']['users'][0]['registration'],'full')
Blockedby = str(file['query']['users'][0]['blockedby']) Blockedby = str(file['query']['users'][0]['blockedby'])
Blockedtimestamp = UTC8(file['query']['users'][0]['blockedtimestamp']) Blockedtimestamp = UTC8(file['query']['users'][0]['blockedtimestamp'],'full')
Blockexpiry = UTC8V(str(file['query']['users'][0]['blockexpiry'])) Blockexpiry = UTC8(str(file['query']['users'][0]['blockexpiry']),'full')
Blockreason = str(file['query']['users'][0]['blockreason']) Blockreason = str(file['query']['users'][0]['blockreason'])
try: try:
g = re.sub('User:', '', str3) g = re.sub('User:', '', str3)
@ -47,7 +46,7 @@ def User1(url, str3):
Editcount = ' | 编辑数:' + str(file['query']['users'][0]['editcount']) Editcount = ' | 编辑数:' + str(file['query']['users'][0]['editcount'])
Group = '用户组:' + yhz(str(file['query']['users'][0]['groups'])) Group = '用户组:' + yhz(str(file['query']['users'][0]['groups']))
Gender = '性别:' + gender(file['query']['users'][0]['gender']) Gender = '性别:' + gender(file['query']['users'][0]['gender'])
Registration = '注册时间:' + UTC8(file['query']['users'][0]['registration']) Registration = '注册时间:' + UTC8(file['query']['users'][0]['registration'],'full')
g = re.sub('User:', '', str3) g = re.sub('User:', '', str3)
return(url+'UserProfile:' + urllib.parse.quote(g.encode('UTF-8')) + '\n'+Wikiname+'\n' + User + Editcount + '\n' + Group + '\n' + Gender + '\n' + Registration) return(url+'UserProfile:' + urllib.parse.quote(g.encode('UTF-8')) + '\n'+Wikiname+'\n' + User + Editcount + '\n' + Group + '\n' + Gender + '\n' + Registration)
except Exception: except Exception:

View file

@ -1,58 +0,0 @@
import re
def UTC8(str1):
q = re.match(r'(.*)-(.*)-(.*)T(.*):(.*):(.*)Z', str1)
y = int(q.group(1))
m = int(q.group(2))
d = int(q.group(3))
h = int(q.group(4))
mi = int(q.group(5))
s = int(q.group(6))
h = h + 8
if h > 24 :
d = d + 1
h = h - 24
else:
pass
if m == 2:
if y % 100 == 0:
if y % 400 == 0:
pass
else:
if d == 29:
m = m + 1
d = d - 28
else:
pass
if d == 29:
if y % 4 == 0:
pass
else:
m = m + 1
d = d - 28
if d == 30:
m = m + 1
d = d - 29
else:
pass
else:
pass
if d == 31:
if m == 4 or m == 6 or m == 9 or m == 11:
m = m + 1
d = d - 30
else:
pass
else:
pass
if d == 32:
m = m + 1
d = d - 31
if m == 13:
m = m - 12
y = y + 1
if h == 24:
if mi != 0:
h = h - 24
return (str(y)+''+str(m)+''+str(d)+''+str(h)+''+str(mi)+''+'UTC+8')

View file

@ -1,59 +0,0 @@
import re
def UTC8U(str1):
q = re.match(r'(.*)-(.*)-(.*)T(.*):(.*):(.*)Z', str1)
y = int(q.group(1))
m = int(q.group(2))
d = int(q.group(3))
h = int(q.group(4))
mi = int(q.group(5))
s = int(q.group(6))
h = h + 8
if h > 24 :
d = d + 1
h = h - 24
else:
pass
if m == 2:
if y % 100 == 0:
if y % 400 == 0:
pass
else:
if d == 29:
m = m + 1
d = d - 28
else:
pass
if d == 29:
if y % 4 == 0:
pass
else:
m = m + 1
d = d - 28
if d == 30:
m = m + 1
d = d - 29
else:
pass
else:
pass
if d == 31:
if m == 4 or m == 6 or m == 9 or m == 11:
m = m + 1
d = d - 30
else:
pass
else:
pass
if d == 32:
m = m + 1
d = d - 31
if m == 13:
m = m - 12
y = y + 1
if h == 24:
if mi != 0:
h = h - 24
return (str(y)+''+str(m)+''+str(d)+''+str(h)+''+str(mi)+'')

View file

@ -1,61 +0,0 @@
import re
def UTC8V(str1):
if str1 == 'infinity':
return ('无限期')
else:
q = re.match(r'(....)(..)(..)(..)(..)(..)', str1)
y = int(q.group(1))
m = int(q.group(2))
d = int(q.group(3))
h = int(q.group(4))
mi = int(q.group(5))
s = int(q.group(6))
h = h + 8
if h > 24 :
d = d + 1
h = h - 24
else:
pass
if m == 2:
if y % 100 == 0:
if y % 400 == 0:
pass
else:
if d == 29:
m = m + 1
d = d - 28
else:
pass
if d == 29:
if y % 4 == 0:
pass
else:
m = m + 1
d = d - 28
if d == 30:
m = m + 1
d = d - 29
else:
pass
else:
pass
if d == 31:
if m == 4 or m == 6 or m == 9 or m == 11:
m = m + 1
d = d - 30
else:
pass
else:
pass
if d == 32:
m = m + 1
d = d - 31
if m == 13:
m = m - 12
y = y + 1
if h == 24:
if mi != 0:
h = h - 24
return (str(y)+''+str(m)+''+str(d)+''+str(h)+''+str(mi)+''+'UTC+8')

View file

@ -3,9 +3,8 @@ from .puserlib import PUser1, PUser1ban, PUser1bann
import requests import requests
import json import json
import re import re
from .UTC8U import UTC8U
from .gender import gender from .gender import gender
from .UTC8V import UTC8V from UTC8 import UTC8
import urllib import urllib
import traceback import traceback
async def Userp(path,Username): async def Userp(path,Username):
@ -19,23 +18,23 @@ async def Userp(path,Username):
try: try:
User = file['query']['users'][0]['name'] User = file['query']['users'][0]['name']
Gender = gender(file['query']['users'][0]['gender']) Gender = gender(file['query']['users'][0]['gender'])
Registration = UTC8U(file['query']['users'][0]['registration']) Registration = UTC8(file['query']['users'][0]['registration'],'notimezone')
Blockedby = str(file['query']['users'][0]['blockedby']) Blockedby = str(file['query']['users'][0]['blockedby'])
Blockedtimestamp = UTC8U(file['query']['users'][0]['blockedtimestamp']) Blockedtimestamp = UTC8(file['query']['users'][0]['blockedtimestamp'],'notimezone')
Blockexpiry = UTC8V(str(file['query']['users'][0]['blockexpiry'])) Blockexpiry = UTC8(str(file['query']['users'][0]['blockexpiry']),'full')
Blockreason = str(file['query']['users'][0]['blockreason']) Blockreason = str(file['query']['users'][0]['blockreason'])
if not Blockreason: if not Blockreason:
PUser1bann(metaurl, q, path, User, Gender, Registration, Blockedby, Blockedtimestamp, Blockexpiry) PUser1bann(metaurl, q, path, User, Gender, Registration, Blockedby, Blockedtimestamp, Blockexpiry)
else: else:
PUser1ban(metaurl, q, path, User, Gender, Registration, Blockedby, Blockedtimestamp, Blockexpiry, PUser1ban(metaurl, q, path, User, Gender, Registration, Blockedby, Blockedtimestamp, Blockexpiry,\
Blockreason) Blockreason)
h = '/Userprofile:' +User h = '/Userprofile:' +User
return(metaurl+urllib.parse.quote(h.encode('UTF-8'))) return(metaurl+urllib.parse.quote(h.encode('UTF-8')))
except Exception: except Exception:
try: try:
User = file['query']['users'][0]['name'] User = file['query']['users'][0]['name']
Gender = gender(file['query']['users'][0]['gender']) Gender = gender(file['query']['users'][0]['gender'])
Registration = UTC8U(file['query']['users'][0]['registration']) Registration = UTC8(file['query']['users'][0]['registration'],'notimezone')
PUser1(metaurl, q, path, User, Gender, Registration) PUser1(metaurl, q, path, User, Gender, Registration)
h = '/Userprofile:' +User h = '/Userprofile:' +User
return(metaurl+urllib.parse.quote(h.encode('UTF-8'))) return(metaurl+urllib.parse.quote(h.encode('UTF-8')))