2020-06-13 12:43:43 +00:00
|
|
|
import re
|
2020-08-12 16:01:34 +00:00
|
|
|
|
2020-09-19 10:35:13 +00:00
|
|
|
from modules.checkuser import checkuser
|
2020-08-18 13:12:38 +00:00
|
|
|
from modules.help import userhelp
|
|
|
|
from modules.interwikilist import iwlink, iwlist
|
2020-08-12 16:01:34 +00:00
|
|
|
from .ruserlib import rUser1
|
|
|
|
from .userlib import User1
|
2020-09-19 10:35:13 +00:00
|
|
|
|
2020-08-12 16:01:34 +00:00
|
|
|
|
2020-09-19 06:21:06 +00:00
|
|
|
async def main(name):
|
2020-06-13 12:43:43 +00:00
|
|
|
name = re.sub(r'^User', 'user', name)
|
2020-08-12 16:01:34 +00:00
|
|
|
if name.find(" -h") != -1:
|
2020-08-20 10:30:08 +00:00
|
|
|
return userhelp()
|
2020-09-19 06:21:06 +00:00
|
|
|
elif name.find(' -p') != -1:
|
|
|
|
c = name
|
|
|
|
f = re.sub(' -p', '', c)
|
|
|
|
print(f)
|
|
|
|
z = re.sub(r'^User', 'user', f)
|
|
|
|
g = re.match(r'^user ~(.*) (.*)', z)
|
|
|
|
if g:
|
|
|
|
h = g.group(1)
|
|
|
|
h2 = g.group(2)
|
|
|
|
h2 = re.sub('_', ' ', h2)
|
|
|
|
g = re.match(r'^user-(.*?) (.*)', z)
|
|
|
|
if g:
|
|
|
|
h = 'minecraft-' + g.group(1)
|
|
|
|
h2 = g.group(2)
|
|
|
|
h2 = re.sub('_', ' ', h2)
|
|
|
|
g = re.match(r'^user (.*?):(.*)', z)
|
|
|
|
if g:
|
|
|
|
h = 'minecraft-' + g.group(1)
|
|
|
|
h2 = g.group(2)
|
|
|
|
h2 = re.sub('_', ' ', h2)
|
|
|
|
else:
|
|
|
|
g = re.match(r'user (.*)', z)
|
|
|
|
if g:
|
|
|
|
h = 'minecraft'
|
|
|
|
h2 = g.group(1)
|
|
|
|
h2 = re.sub('_', ' ', h2)
|
|
|
|
if checkuser(h, h2):
|
|
|
|
h2 = re.sub('User:', '', h2)
|
|
|
|
print(h2)
|
|
|
|
from .userp import Userp
|
|
|
|
return await Userp(h, h2) + "[[usn:" + h2 + "]]"
|
|
|
|
else:
|
|
|
|
return '没有找到此用户。'
|
2020-06-13 12:43:43 +00:00
|
|
|
else:
|
|
|
|
try:
|
2020-08-07 13:32:19 +00:00
|
|
|
q = re.match(r'^user-(.*?) (.*)', name)
|
2020-06-13 12:43:43 +00:00
|
|
|
w = q.group(1)
|
2020-08-07 13:42:25 +00:00
|
|
|
if w in iwlist():
|
|
|
|
url = iwlink(w)
|
2020-08-14 07:43:26 +00:00
|
|
|
if name.find(" -r") != -1:
|
|
|
|
x = re.sub(' -r', '', q.group(2))
|
|
|
|
return await rUser1(url, x)
|
|
|
|
else:
|
|
|
|
return await User1(url, q.group(2))
|
2020-06-13 12:43:43 +00:00
|
|
|
else:
|
2020-08-14 07:43:26 +00:00
|
|
|
return '未知语言,请使用~user -h查看帮助。'
|
2020-08-21 12:40:05 +00:00
|
|
|
except Exception:
|
2020-06-13 12:43:43 +00:00
|
|
|
q = re.match(r'^user (.*)', name)
|
|
|
|
try:
|
2020-08-07 13:32:19 +00:00
|
|
|
s = re.match(r'~(.*?) (.*)', q.group(1))
|
2020-08-07 13:42:25 +00:00
|
|
|
metaurl = 'https://' + s.group(1) + '.gamepedia.com/'
|
2020-08-14 07:43:26 +00:00
|
|
|
if name.find(' -r') != -1:
|
|
|
|
x = re.sub(' -r', '', s.group(2))
|
|
|
|
return await rUser1(metaurl, x)
|
|
|
|
else:
|
|
|
|
return await User1(metaurl, q.group(2))
|
2020-08-21 12:40:05 +00:00
|
|
|
except Exception:
|
2020-06-13 12:43:43 +00:00
|
|
|
try:
|
2020-08-12 16:01:34 +00:00
|
|
|
i = re.match(r'(.*?):(.*)', q.group(1))
|
2020-08-07 13:35:18 +00:00
|
|
|
w = i.group(1)
|
|
|
|
x = i.group(2)
|
|
|
|
if w in iwlist():
|
2020-06-13 12:43:43 +00:00
|
|
|
try:
|
2020-08-07 13:35:18 +00:00
|
|
|
metaurl = iwlink(w)
|
2020-08-14 07:43:26 +00:00
|
|
|
if name.find(' -r') != -1:
|
|
|
|
x = re.sub(' -r', '', x)
|
|
|
|
return (await rUser1(metaurl, x))
|
|
|
|
else:
|
|
|
|
return (await User1(metaurl, x))
|
2020-06-13 12:43:43 +00:00
|
|
|
except Exception as e:
|
|
|
|
return ('发生错误:' + str(e))
|
|
|
|
else:
|
|
|
|
try:
|
2020-08-07 13:42:25 +00:00
|
|
|
metaurl = 'https://minecraft.gamepedia.com/'
|
2020-08-14 07:43:26 +00:00
|
|
|
if name.find(' -r') != -1:
|
|
|
|
x = re.sub(' -r', '', x)
|
|
|
|
return (rUser1(metaurl, x))
|
|
|
|
else:
|
|
|
|
return User1(metaurl, x)
|
2020-06-13 12:43:43 +00:00
|
|
|
except Exception as e:
|
|
|
|
return ('发生错误:' + str(e))
|
|
|
|
except Exception:
|
2020-08-07 13:42:25 +00:00
|
|
|
metaurl = 'https://minecraft.gamepedia.com/'
|
2020-08-14 07:43:26 +00:00
|
|
|
if name.find(" -r") != -1:
|
|
|
|
x = re.sub(' -r', '', q.group(1))
|
|
|
|
return (await rUser1(metaurl, x))
|
|
|
|
else:
|
|
|
|
return await User1(metaurl, q.group(1))
|
2020-09-19 06:21:06 +00:00
|
|
|
|
2020-09-19 10:35:13 +00:00
|
|
|
|
|
|
|
command = {'user': 'user'}
|