Completed #21:2
This commit is contained in:
parent
9f45f07336
commit
82ed71f23c
|
@ -3,7 +3,7 @@ from src.config import config
|
|||
|
||||
class ChanceManager:
|
||||
key = "chance:{}"
|
||||
default_chance = config['bot']['default_chance']
|
||||
default_chance = config.getint('bot', 'default_chance')
|
||||
|
||||
def __init__(self, redis):
|
||||
self.redis = redis
|
||||
|
@ -11,7 +11,7 @@ class ChanceManager:
|
|||
def get_chance(self, chat_id):
|
||||
result = self.redis.instance().get(self.key.format(chat_id))
|
||||
|
||||
return result if result is not None else self.default_chance
|
||||
return int(result.decode("utf-8")) if result is not None else self.default_chance
|
||||
|
||||
def set_chance(self, chat_id, chance):
|
||||
self.redis.instance.set(self.key.format(chat_id), chance)
|
||||
self.redis.instance().set(self.key.format(chat_id), chance)
|
||||
|
|
Loading…
Reference in New Issue