Work directly from users in modules/coins.py.interest(), so as to not give
double-interest to two "users" online at the same time sharing the same identity
This commit is contained in:
parent
a43d1cbb91
commit
0ed0b235e9
2 changed files with 9 additions and 2 deletions
|
@ -459,8 +459,7 @@ class Module(ModuleManager.BaseModule):
|
|||
interest = round(coins*interest_rate, 2)
|
||||
coins += interest
|
||||
self._take_from_pool(server, interest)
|
||||
server.get_user(nickname).set_setting("coins",
|
||||
str(coins))
|
||||
server.set_user_setting(nickname, "coins", str(coins))
|
||||
event["timer"].redo()
|
||||
|
||||
@utils.hook("received.command.lotterybuy", authenticated=True)
|
||||
|
|
|
@ -135,6 +135,14 @@ class Server(IRCObject.Object):
|
|||
self.id, prefix, default)
|
||||
def del_setting(self, setting):
|
||||
self.bot.database.server_settings.delete(self.id, setting)
|
||||
|
||||
def get_user_setting(self, nickname, setting, defau;t=None):
|
||||
user_id = self.get_user_id(nickname)
|
||||
self.bot.database.user_settings.get(user_id, setting, default)
|
||||
def set_user_setting(self, nickname, setting, value):
|
||||
user_id = self.get_user_id(nickname)
|
||||
self.bot.database.user_settings.set(user_id, setting, value)
|
||||
|
||||
def get_all_user_settings(self, setting, default=[]):
|
||||
return self.bot.database.user_settings.find_all_by_setting(
|
||||
self.id, setting, default)
|
||||
|
|
Loading…
Reference in a new issue