Exposing number of nicks in channel to listeners

pull/11/head
Sina Mashek 2017-11-28 12:55:16 +02:00
parent f043ca28e0
commit 9b61cb2aef
1 changed files with 3 additions and 1 deletions

View File

@ -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