-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand.py
61 lines (53 loc) · 1.41 KB
/
command.py
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
"""help.py is the module which respond to the hello command.
This modulo was not made to run at its own
list(message) : it return the list of commands
"""
import basic
import user
commands = basic.loadJson('./Messages/commands.json')
posts = basic.loadJson('./Messages/help.json')
def list(message):
data = 'list \t'
dat,msg = basic.choose(posts['list']['common'])
data += '{0}\t'.format(dat)
msg += "```\n"
for line in commands["common"]:
msg += '\t{0}\n'.format(line)
msg += "```\n"
if user.exist(message.author):
data += "user \t"
if message.server:
data += 'server\t'
dat,aux = basic.choose(posts['list']['server'])
msg += aux
data += '{0}\t'.format(dat)
else :
data += 'private\t'
dat,aux = basic.choose(posts['list']['private'])
msg += aux
data += '{0}\t'.format(dat)
msg += " ```\n"
for line in commands["private"]:
msg += '\t{0}\n'.format(line)
msg += " ```\n"
if user.gm(message.author):
data += 'GM\t'
dat,aux = basic.choose(posts['list']['GM'])
msg += aux
data += '{0}\t'.format(dat)
msg += " ```\n"
for line in commands["GM"]:
msg += '\t{0}\n'.format(line)
msg += " ```\n"
else :
data += 'Nuser\t'
chat = [[message.channel,msg]]
return data,chat
def exist(command):
if command in commands["command"]:
return True
return False
# if this is the main module
if __name__ == '__main__':
#print the documentation
print(__doc__)