'redude' -> 'reduce' (my redudes), import random
because i forgot to, don't
try to do lottery for networks that have no lottery tickets purchased
This commit is contained in:
parent
561d686643
commit
bb531a6104
1 changed files with 4 additions and 2 deletions
|
@ -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
|
from src import ModuleManager, utils
|
||||||
|
|
||||||
SIDES = {"heads": 0, "tails": 1}
|
SIDES = {"heads": 0, "tails": 1}
|
||||||
|
@ -503,9 +503,11 @@ class Module(ModuleManager.BaseModule):
|
||||||
lottery = server.get_setting("lottery", {})
|
lottery = server.get_setting("lottery", {})
|
||||||
if lottery:
|
if lottery:
|
||||||
server.del_setting("lottery")
|
server.del_setting("lottery")
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
users = [(nickname,)*value for nickname, value in lottery.items()]
|
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)
|
winner = random.choice(users)
|
||||||
|
|
||||||
user = server.get_user(winner)
|
user = server.get_user(winner)
|
||||||
|
|
Loading…
Reference in a new issue