Re-toast ducks.py!
This commit is contained in:
parent
93a818ed97
commit
9eaa1cc6fc
1 changed files with 39 additions and 0 deletions
|
@ -219,3 +219,42 @@ class Module(object):
|
|||
next_decoy_time = self.get_random_duck_time()
|
||||
self.bot.add_timer("duck-decoy", next_decoy_time, persist=False,
|
||||
server=event["server"], channel=event["target"])
|
||||
|
||||
def duck_stats(self, event):
|
||||
user = event["user"]
|
||||
channel = event["target"].name
|
||||
nick = user.nickname
|
||||
id = user.id
|
||||
|
||||
poached = user.get_channel_settings_per_setting("ducks-shot", 0
|
||||
)
|
||||
friends = user.get_channel_settings_per_setting(
|
||||
"ducks-befriended", 0
|
||||
)
|
||||
|
||||
channel_friends = 0
|
||||
channel_poached = 0
|
||||
|
||||
total_friends = 0
|
||||
total_poached = 0
|
||||
|
||||
for room, number in friends:
|
||||
if room == channel:
|
||||
channel_friends = number
|
||||
total_friends += number
|
||||
else:
|
||||
total_friends += number
|
||||
|
||||
for room, number in poached:
|
||||
if room == channel:
|
||||
channel_poached = number
|
||||
total_poached += number
|
||||
else:
|
||||
total_poached += number
|
||||
|
||||
event["stdout"].write(
|
||||
nick + ": " + str(total_poached) + " ducks killed (" + str(
|
||||
channel_poached) + " in " + channel + "), and " + str(
|
||||
total_friends) + " ducks befriended (" + str(channel_friends)
|
||||
+ " in " + channel + ")")
|
||||
|
||||
|
|
Loading…
Reference in a new issue