def numeric(self, source, numeric, *args): if numeric == RPL_WELCOME: for channel in self.ircchannel: self.fire(JOIN(channel)) elif numeric == ERR_USERONCHANNEL: self.nick = newnick = "%s_" % self.nick self.fire(NICK(newnick))
def numeric(self, source, numeric, *args): """Numeric Event This event is triggered by the ``IRC`` Protocol Component when we have received an IRC Numberic Event from server we are connected to. """ if numeric == ERR_NICKNAMEINUSE: self.fire(NICK("{0:s}_".format(args[0]))) elif numeric in (RPL_ENDOFMOTD, ERR_NOMOTD): self.fire(JOIN("#artbuddy_test"))
def numeric(self, source, numeric, target, *args): """Numeric Event This event is triggered by the ``IRC`` Protocol Component when we have received an IRC Numeric Event from server we are connected to. """ if numeric == ERR_NICKNAMEINUSE: self.fire(NICK("{0:s}_{1:d}".format(args[0], randint(0, 32768)))) elif numeric in (RPL_ENDOFMOTD, ERR_NOMOTD): for irc_channel in self.irc_channels: self.fire(JOIN(irc_channel['name'], keys=irc_channel.get('key', None)))
def numeric(self, source, numeric, *args): """numeric Event This event is triggered by the ``IRC`` Protocol Component when we have received an IRC Numberic Event from server we are connected to. """ if numeric == 1: self.fire(JOIN(self.ircchannel)) elif numeric == 433: self.nick = newnick = "%s_" % self.nick self.fire(NICK(newnick))
def numeric(self, source, numeric, target, *args): """Numeric Event This event is triggered by the ``IRC`` Protocol Component when we have received an IRC Numberic Event from server we are connected to. """ if numeric == ERR_NICKNAMEINUSE: self.fire(NICK("{0:s}_".format(args[0]))) elif numeric in (RPL_ENDOFMOTD, ERR_NOMOTD): for ircchannels in self.ircchannels: for ircchannel in ircchannels.split(","): self.fire(JOIN(ircchannel))
nick, ident, host = parseprefix(s) assert nick == "test" assert ident is None assert host is None @pytest.mark.parametrize("event,data", [ (PASS("secret"), b"PASS secret\r\n"), (USER("foo", "localhost", "localhost", "Test Client"), b"USER foo localhost localhost :Test Client\r\n"), (NICK("test"), b"NICK test\r\n"), (PONG("localhost"), b"PONG :localhost\r\n"), (QUIT(), b"QUIT Leaving\r\n"), (QUIT("Test"), b"QUIT Test\r\n"), (QUIT("Test Message"), b"QUIT :Test Message\r\n"), (JOIN("#test"), b"JOIN #test\r\n"), (JOIN("#test", "secret"), b"JOIN #test secret\r\n"), (PART("#test"), b"PART #test\r\n"), (PRIVMSG("test", "Hello"), b"PRIVMSG test Hello\r\n"), (PRIVMSG("test", "Hello World"), b"PRIVMSG test :Hello World\r\n"), (NOTICE("test", "Hello"), b"NOTICE test Hello\r\n"), (NOTICE("test", "Hello World"), b"NOTICE test :Hello World\r\n"), (KICK("#test", "test"), b"KICK #test test :\r\n"), (KICK("#test", "test", "Bye"), b"KICK #test test Bye\r\n"), (KICK("#test", "test", "Good Bye!"), b"KICK #test test :Good Bye!\r\n"), (TOPIC("#test", "Hello World!"), b"TOPIC #test :Hello World!\r\n"), (MODE("+i"), b"MODE +i\r\n"), (MODE("#test", "+o", "test"), b"MODE #test +o test\r\n"), (INVITE("test", "#test"), b"INVITE test #test\r\n"), (NAMES(), b"NAMES\r\n"), (NAMES("#test"), b"NAMES #test\r\n"),
def __call__(self, args): self._commander.fire(JOIN(args.channel), args.ircserver.channel)
def cmdJOIN(self, channel): if self.ircchannel is not None: self.cmdPART(self.ircchannel, "Joining %s" % channel) self.fire(JOIN(channel)) self.ircchannel = channel
def numeric(self, source, numeric, *args): if numeric == ERR_NICKNAMEINUSE: self.fire(NICK("{0:s}_".format(self.nick))) elif numeric in (RPL_ENDOFMOTD, ERR_NOMOTD): self.fire(JOIN(self.channel))
def execute(self, keywords, target, source, ircbot): # Check a channel name was given and it starts with a # if len(keywords) != 2 or keywords[1][:1] != "#": return -1 ircbot.fire(JOIN(keywords[1]))