-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSummoner.py
More file actions
40 lines (30 loc) · 1.21 KB
/
Summoner.py
File metadata and controls
40 lines (30 loc) · 1.21 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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
class Summoner:
def __init__(self, id, name, noticeable):
# Estos se graban en base de datos
self.id = id
self.name = name
self.noticeable = noticeable
# Estos no
self.gamestatus = None
self.gamequeuetype = None
self.timestamp = None
self.champion = None
def get_status(self):
status = ''
if self.gamestatus:
status = '{} {}'.format('🔔' if self.noticeable else '🔕', self.name)
if self.gamestatus == 'inGame' and self.gamequeuetype and self.timestamp:
t = time.time() - int(self.timestamp) / 1000
m, s = divmod(t, 60)
status += ": {} {} ({:.0f}m {:.0f}s)\n".format(self.champion, self.gamequeuetype, m, s)
else:
status += ": {}\n".format(self.gamestatus)
return status
def slug(self):
return self.name.replace(' ', '').lower()
def __str__(self):
# return '{} {} ({})'.format('🔔' if self.noticeable else '🔕', self.name, self.id)
return '{} {}'.format('🔔' if self.noticeable else '🔕', self.name)