forked from premnathdey/bunk_bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessage.py
More file actions
32 lines (25 loc) · 751 Bytes
/
Message.py
File metadata and controls
32 lines (25 loc) · 751 Bytes
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
import re
def getnametime(x):
matchobj = re.search("(.+)(\d?\d:\d{2}\s*[AP]M)", x)
return(matchobj.group(1), matchobj.group(2))
class Message:
def __init__(self, strings):
self.strings = []
self.strings.extend(strings)
self.name, self.time = getnametime(strings[0])
self.strings.pop(0)
self.strings = tuple(self.strings)
def show(self):
print("Name: " + self.name)
print("Time: " + self.time)
print("Messages: ")
for i in self.strings:
print(i)
print('')
.join(self.string)
def getname(self):
return(self.name)
def gettime(self):
return(self.time)
def getmessages(self):
return(self.strings)