From 9b61cb2aefc4254fb6133dda464441b93f50cd7a Mon Sep 17 00:00:00 2001 From: Sina Mashek Date: Tue, 28 Nov 2017 12:55:16 +0200 Subject: [PATCH] Exposing number of nicks in channel to listeners --- pinhook/bot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pinhook/bot.py b/pinhook/bot.py index 932e5a4..bc4d762 100644 --- a/pinhook/bot.py +++ b/pinhook/bot.py @@ -10,9 +10,10 @@ irc.client.ServerConnection.buffer_class.errors = 'replace' class Message: - def __init__(self, channel, nick, botnick, ops, cmd=None, arg=None, text=None): + def __init__(self, channel, nick, botnick, ops, cmd=None, arg=None, text=None, num_nicks=None): self.channel = channel self.nick = nick + self.num_nicks = num_nicks self.botnick = botnick self.ops = ops if cmd: @@ -103,6 +104,7 @@ class Bot(irc.bot.SingleServerIRCBot): output = self.lstnrs[lstnr](Message( channel=chan, text=e.arguments[0], + num_nicks=len(self.channels[chan].users()), nick=nick, botnick=self.bot_nick, ops=self.ops