-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.py
65 lines (50 loc) · 961 Bytes
/
util.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
# -*- coding: utf-8 -*-
from datetime import date, datetime
class Msg:
def __init__(self, chatId, text, tokens, sender):
self.chatId = chatId
self.text = text
self.tokens = tokens
self.sender = sender
self.nick = ""
# Wrap time for test hacks etc
class T:
@staticmethod
def dayOfWeek():
dow = date.today().weekday()
return dow
@staticmethod
def weekend():
return T.dayOfWeek() > 4
@staticmethod
def weekday():
wd = T.dayOfWeek()
return {
0: "Monday",
1: "Tuesday",
2: "Wednesday",
3: "Thursday, and cocktails tonite",
4: "Friday at last!",
5: "Saturday",
6: "Sunday"
}[wd]
@staticmethod
def year():
h = datetime.now().year
return h
@staticmethod
def month():
h = datetime.now().month
return h
@staticmethod
def day():
d = datetime.now().day
return d
@staticmethod
def hour():
h = datetime.now().hour
return h
@staticmethod
def minute():
h = datetime.now().minute
return h