From bb531a61047057e8c8d9cb28e78a8e8677281912 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 13 Oct 2018 01:14:07 +0100 Subject: [PATCH] 'redude' -> 'reduce' (my redudes), `import random` because i forgot to, don't try to do lottery for networks that have no lottery tickets purchased --- modules/coins.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/coins.py b/modules/coins.py index 80dfeb5c..ccbc193a 100644 --- a/modules/coins.py +++ b/modules/coins.py @@ -1,4 +1,4 @@ -import datetime, decimal, functools, math, re, secrets, time +import datetime, decimal, functools, math, random, re, secrets, time from src import ModuleManager, utils SIDES = {"heads": 0, "tails": 1} @@ -503,9 +503,11 @@ class Module(ModuleManager.BaseModule): lottery = server.get_setting("lottery", {}) if lottery: server.del_setting("lottery") + else: + continue users = [(nickname,)*value for nickname, value in lottery.items()] - users = functools.redude(lambda x, y: x+y, users) + users = functools.reduce(lambda x, y: x+y, users) winner = random.choice(users) user = server.get_user(winner)