-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
55 lines (43 loc) · 1.47 KB
/
utils.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
import datetime
import os
from functools import cached_property
import pytz
def get_msk_time():
dt_utcnow = datetime.datetime.now(tz=pytz.UTC)
msk_time = dt_utcnow.astimezone(pytz.timezone('Europe/Moscow'))
return msk_time
def get_final_string(duration):
td = datetime.timedelta(seconds=duration)
time_obj = {
'days': td.days,
'hours': td.seconds//3600,
'minute(s)': (td.seconds//60)%60
}
final_str = ''
for time_prop in time_obj:
value = time_obj[time_prop]
if value != 0:
final_str += f' {value} {time_prop}'
final_str = final_str.strip()
return final_str
class ChannelsMixin:
@cached_property
def focus_channel(self):
'''Getting focus channel'''
return self.elon.get_channel(int(os.environ.get('FOCUS_CHANNEL_ID')))
@cached_property
def hall_channel(self):
'''Getting hall of fame channel'''
return self.elon.get_channel(int(os.environ.get('HALL_CHANNEL_ID')))
@cached_property
def briefing_channel(self):
'''Getting briefing channel'''
return self.elon.get_channel(int(os.environ.get('BRIEFING_CHANNEL_ID')))
@cached_property
def hello_channel(self):
'''Getting hello channel'''
return self.elon.get_channel(int(os.environ.get('HELLO_CHANNEL_ID')))
@cached_property
def main_guild(self):
'''Getting the server(guild)'''
return self.elon.get_guild(int(os.environ.get('GUILD_ID')))