-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontentTypes.py
More file actions
109 lines (86 loc) · 2.48 KB
/
Copy pathcontentTypes.py
File metadata and controls
109 lines (86 loc) · 2.48 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
from sendMessage import Send
class Message:
def __init__(self,
author,
message,
timestamp,
recipient):
"""
Process the message and split it into arguments and attributes.
Example:
message = 'google something please'
com = 'google'
args = ['something', 'please']
"""
self.author = author
try:
self.quick_replies = message['quick_reply']
except KeyError:
pass
self.content = message['text']
self.time = timestamp
self.recipient = recipient
self.command = self.get_command()
self.arguments = self.get_args()
def get_command(self):
"""Get the command used"""
com = self.content.lower().split(" ")[0]
return com
def get_args(self):
"""Get arguments parsed"""
msg_list = self.content.lower().split(" ")
if len(msg_list) > 1:
args = msg_list[1:]
else:
args = None
return args
class Context:
"""The context class"""
def __init__(self,
message):
self.message = message
self.send = Send(message.author).send
self.say = self.send
class Command:
"""The command class"""
def __init__(self,
func,
module,
name):
self.run = func
self.name = name
self.module = type(module).__name__
class Colours:
def __init__(self):
self._header = '\033[95m'
self._blue = '\033[94m'
self._green = '\033[92m'
self._warning = '\033[93m'
self._fail = '\033[91m'
self._bold = '\033[1m'
self._underline = '\033[4m'
self._end = '\033[0m'
def end(self, text):
return text + self._end
def orange(self, text):
return self.end(self._header + text)
def blue(self, text):
return self.end(self._blue + text)
def green(self, text):
return self.end(self._green + text)
def yellow(self, text):
return self.end(self._warning + text)
def red(self, text):
return self.end(self._fail + text)
def bold(self, text):
return self.end(self._bold + text)
def underline(self, text):
return self.end(self._underline + text)
"""
class User:
def __init__(self,
name=None,
id):
#self.name =
pass
"""