-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmds.py
28 lines (23 loc) · 1.07 KB
/
cmds.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
"""Provide command dictionary and decorator to register commands."""
import time # Used for stime
cmd = {}
def command(name, module='', minRank=0, maxRank=None, private=True,
privateOnly=False, channelBlackList=None, channelWhiteList=None,
help='', usage='', botsAllowed=True, reversible=False,
hidden=False):
"""Register commands."""
def _(f):
if name not in cmd.keys():
cmd[name] = []
c = {0: f, 'minRank': minRank, 'maxRank': maxRank, 'private': private,
'privateOnly': privateOnly, 'channelBlackList': channelBlackList,
'channelWhiteList': channelWhiteList, 'botsAllowed': botsAllowed,
'help': help, 'usage': usage, 'reversible': reversible,
'hidden': hidden, 1: module}
if c not in cmd[name]:
cmd[name].append(c)
return _
# I had to put that somewhere
def stime():
"""Return current time formatted like 2016-12-31T23:59:59."""
return time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime())