forked from Teahouse-Studios/akari-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandGen.py
More file actions
121 lines (115 loc) · 4.16 KB
/
CommandGen.py
File metadata and controls
121 lines (115 loc) · 4.16 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import re
from modules.ab import ab
from modules.bug import bugtracker
from modules.checkuser import checkuser
from modules.help import help,credits
from modules.mcv import mcv, mcbv, mcdv
from modules.newbie import new
from modules.ping import ping
from modules.rc import rc
from modules.server import ser
from modules.user import Username
from modules.userp import Userp
from modules.wiki import wiki
def findcommand(str1, group=0):
print(group)
str1 = re.sub(r'^~', '~', str1)
try:
q = re.match(r'^.*(: ~)(.*)', str1)
return q.group(2)
except Exception:
try:
q = re.match(r'^~(.*)', str1)
return q.group(1)
except Exception:
try:
q = re.match(r'^!(.*\-.*)', str1)
q = str.upper(q.group(1))
return 'bug ' + q
except Exception:
pass
async def command(text, group=0):
try:
result = findcommand(text, group)
c = result
try:
d = result.split(' ')
d = d[0]
except:
d = c
if d == 'echo':
echo = re.sub(r'^echo ', '', c)
return echo
if c == 'help':
return help()
elif d == 'paa':
return '爬'
elif d == 'mcv':
return await mcv()
elif d == 'mcbv':
return await mcbv()
elif d == 'mcdv':
return await mcdv()
elif d.find('新人') != -1 or d.find('new') != -1:
return await new()
elif d.find("wiki") != -1 or d.find("Wiki") != -1:
return await(wiki(c, group))
elif c.find("bug") != -1 or c.find("MC-") != -1 or c.find("BDS-") != -1 or c.find("MCPE-") != -1 or c.find(
"MCAPI-") != -1 or c.find("MCCE-") != -1 or c.find("MCD-") != -1 or c.find("MCL-") != -1 or c.find(
"REALMS-") != -1 or c.find("MCE-") != -1 or c.find("WEB-") != -1:
return await bugtracker(c)
elif d == 'server' or d == 'Server':
return await ser(c)
elif d.find("user") != -1 or d.find("User") != -1:
if c.find("-p") != -1:
f = re.sub(' -p', '', c)
print(f)
try:
z = re.sub(r'^User', 'user', f)
try:
g = re.match(r'^user ~(.*) (.*)', z)
h = g.group(1)
h2 = g.group(2)
h2 = re.sub('_', ' ', h2)
except Exception:
try:
g = re.match(r'^user-(.*?) (.*)', z)
h = 'minecraft-' + g.group(1)
h2 = g.group(2)
h2 = re.sub('_', ' ', h2)
except Exception:
try:
g = re.match(r'^user (.*?):(.*)', z)
h = 'minecraft-' + g.group(1)
h2 = g.group(2)
h2 = re.sub('_', ' ', h2)
except Exception:
try:
g = re.match(r'user (.*)', z)
h = 'minecraft'
h2 = g.group(1)
h2 = re.sub('_', ' ', h2)
except Exception as e:
print(str(e))
if checkuser(h, h2):
h2 = re.sub('User:','',h2)
print(h2)
return await Userp(h, h2) + "[[usn:" + h2 + "]]"
else:
return '没有找到此用户。'
except Exception as e:
print(str(e))
else:
return await Username(c)
elif d == 'rc':
return await rc()
elif d == 'ab':
return await ab()
elif d == 'ping':
return await ping()
elif d == 'credits':
return credits()
else:
pass
except:
pass