Exemplo n.º 1
0
    def on_invite(self, connection: ServerConnection, event: Event):
        if not isinstance(event.source, irc.client.NickMask):
            return

        nick = event.source.nick
        channel = self._lowercase(event.arguments[0])

        _logger.info('Received invite from %s to %s', nick, channel)

        whitelisted_channels = split_list_option(
            self._config['pleaseopme']['whitelist'])
        whitelisted_channels = tuple(map(self._lowercase,
                                         whitelisted_channels))
        max_channels = self._config['pleaseopme'].getint('max_channels', None)

        if not whitelisted_channels or channel in whitelisted_channels:
            current_num_channels = self._channel_tracker.count()
            if max_channels and current_num_channels >= max_channels:
                connection.privmsg(nick, 'Too many channels.')
            else:
                _logger.info('Join channel %s by %s', channel, nick)
                connection.privmsg(nick, 'Joining channel {0}'.format(channel))
                connection.join(channel)
                connection.who(channel)
                self._channel_tracker.add(channel)
        else:
            connection.privmsg(nick, 'Channel is not whitelisted.')
Exemplo n.º 2
0
 def on_welcome(self, connection, event):
     """Authenticate using NickServ"""
     if self.__config.NICKPASS:
         self.connection.privmsg("NickServ", "IDENTIFY {}".format(self.__config.NICKPASS))
     """Join the correct channel upon connecting"""
     if irc.client.is_channel(self.__config.CHANNEL):
         connection.join(self.__config.CHANNEL)
Exemplo n.º 3
0
	def on_connect(self, connection, event):
		if IRC_NICK_PASSWORD != 'False':
			self.sendToIrc("IDENTIFY %s" % IRC_NICK_PASSWORD, "NickServ")
		if irc.client.is_channel(IRC_CHANNEL):
			connection.join(IRC_CHANNEL)
			self.sendToIrc("Hello!")
			logger.info("[IRC] joined %s" % IRC_CHANNEL)
		else:
			logger.warning("[IRC] channelname invalid: %s" % IRC_CHANNEL)
			return
Exemplo n.º 4
0
 def on_kick(self, connection, event):
     """Join the correct channel again"""
     banned_nick = event.arguments[0].lower().strip()
     botnick = self.connection.get_nickname().lower()
     if irc.client.is_channel(
             self.__config.CHANNEL) and banned_nick == botnick:
         time.sleep(31)
         print(datetime.datetime.now(), "Joining to channel again.")
         sys.stdout.flush()
         connection.join(self.__config.CHANNEL)
Exemplo n.º 5
0
    def on_welcome(self, connection, event):
        _logger.info('Logged in to server %s.', self.connection.server_address)
        self.connection.cap('REQ', 'twitch.tv/membership')
        self.connection.cap('REQ', 'twitch.tv/commands')
        self.connection.cap('REQ', 'twitch.tv/tags')

        self._reconnect_interval = RECONNECT_MIN_INTERVAL

        connection.join('#twitchplayspokemon')

        self._badge_bot.populate_account_details()
Exemplo n.º 6
0
    def on_welcome(self, connection, event):
        _logger.info('Logged in to server %s.', self.connection.server_address)
        self.connection.cap('REQ', 'twitch.tv/membership')
        self.connection.cap('REQ', 'twitch.tv/commands')
        self.connection.cap('REQ', 'twitch.tv/tags')

        self._reconnect_interval = RECONNECT_MIN_INTERVAL

        connection.join('#twitchplayspokemon')
        connection.join('#tpp')

        self._tpp_bot_facade.get_balance()
Exemplo n.º 7
0
    def on_welcome(self, connection, _event):
        """Join channels upon successful connection."""
        if self.identify_password:
            self.privmsg("NickServ", "IDENTIFY %s" % self.identify_password)

        for channel in self.channels:
            channel = channel.split(" ", 1)
            if irclib.is_channel(channel[0]):
                if len(channel) > 1:
                    connection.join(channel[0], channel[1])
                else:
                    connection.join(channel[0])
Exemplo n.º 8
0
 def on_welcome(self, connection, event):
     """Login"""
     if self.__config.NICKPASS:
         print(datetime.datetime.now(), "Starting authentication.")
         sys.stdout.flush()
         self.send_msg("NickServ",
                       "IDENTIFY {}".format(self.__config.NICKPASS))
     """Join the correct channel upon connecting"""
     if irc.client.is_channel(self.__config.CHANNEL):
         print(datetime.datetime.now(), "Joining to channel.")
         sys.stdout.flush()
         connection.join(self.__config.CHANNEL)
Exemplo n.º 9
0
    def on_welcome(self, connection, event):
        _logger.info('Logged in to server %s.', self.connection.server_address)
        self.connection.cap('REQ', 'twitch.tv/membership')
        self.connection.cap('REQ', 'twitch.tv/commands')
        self.connection.cap('REQ', 'twitch.tv/tags')

        self._reconnect_interval = RECONNECT_MIN_INTERVAL

        connection.join('#twitchplayspokemon')
        connection.join('#tpp')

        self._tpp_bot_facade.get_balance()
Exemplo n.º 10
0
    def on_welcome(self, connection, _event):
        """Join channels upon successful connection."""
        if self.identify_password:
            self.privmsg("NickServ", "IDENTIFY %s" % self.identify_password)

        for channel in self.channels:
            channel = channel.split(" ", 1)
            if irclib.is_channel(channel[0]):
                if len(channel) > 1:
                    connection.join(channel[0], channel[1])
                else:
                    connection.join(channel[0])
Exemplo n.º 11
0
 def on_welcome(self, connection, event):
     """
     Join the correct channel upon connecting. This runs when we first join
     the IRC server.
     """
     if self.__config.NICKSERV_PASSWORD:
         print("Identifying for nick", self.__config.NICK)
         msg = "IDENTIFY {} {}".format(self.__config.NICK,
                                       self.__config.NICKSERV_PASSWORD)
         connection.privmsg("NICKSERV", msg)
     # make sure we join chans as the last thing
     if irc.client.is_channel(self.__config.CHANNEL):
         connection.join(self.__config.CHANNEL)
Exemplo n.º 12
0
    def on_kick(self, connection, event):
        """Automatically rejoin channel if kicked."""
        source = event.source.nick
        target = event.target
        nick, reason = event.arguments

        if nick == self.nick:
            self.log.info("-%s- kicked by %s: %s" % (target, source, reason))
            self.log.info("-%s- rejoining in %d seconds" % (target, self.rejoin_delay))
            time.sleep(self.rejoin_delay)
            connection.join(target)
        else:
            self.log.info("-%s- %s was kicked by %s: %s" % (target, nick, source, reason))
Exemplo n.º 13
0
    def on_welcome(self, connection: irc.connection, event: irc.client.Event):
        """Server welcome handling.

		Join the given channels and use IRC v3 capability registration as documented here:
		https://dev.twitch.tv/docs/irc/#twitch-specific-irc-capabilities.
		"""
        connection.cap('REQ', ':twitch.tv/membership')
        connection.cap('REQ', ':twitch.tv/tags')
        connection.cap('REQ', ':twitch.tv/commands')
        for channel in self.channels:
            channel = channel.lower()
            if not channel.startswith('#'):
                channel = '#' + channel
            connection.join(channel)
Exemplo n.º 14
0
    def on_kick(self, connection, event):
        """Automatically rejoin channel if kicked."""
        source = event.source.nick
        target = event.target
        nick, reason = event.arguments

        if nick == self.nick:
            self.log.info("-%s- kicked by %s: %s" % (target, source, reason))
            self.log.info("-%s- rejoining in %d seconds" %
                          (target, self.rejoin_delay))
            time.sleep(self.rejoin_delay)
            connection.join(target)
        else:
            self.log.info("-%s- %s was kicked by %s: %s" %
                          (target, nick, source, reason))
Exemplo n.º 15
0
    def on_welcome(self, connection, event):
        """Handle welcome message from server."""
        if self.nickserv_password:
            print('Identifying with NickServ...')
            # TODO(dolph): should wait for nickserv response before joining a
            # channel that might require it.
            connection.privmsg(
                'NickServ', 'IDENTIFY %s %s' % (
                    self.nickname, self.nickserv_password))

        print('Joining %s...' % self.channel)
        connection.join(self.channel)

        print('Requesting names on channel...')
        connection.names(self.channel)

        # Disconnect later, after the standup is over.
        print('Disconnecting after %d seconds.' % self.standup_duration)
        connection.execute_delayed(
            delay=self.standup_duration,
            function=self.end_standup)
Exemplo n.º 16
0
 def join_channel(self, connection):
     self.logger.info('joining %s...' % self.channel)
     connection.join(self.channel)
Exemplo n.º 17
0
 def on_welcome(self, connection, event):
     for chan in self.current_server['channels']:
         connection.join(chan)
     self.__module_handle('welcome', connection=connection, event=event)
Exemplo n.º 18
0
 def on_welcome(self, connection, event):
     """Join the correct channel upon connecting"""
     if irc.client.is_channel(self.__config.CHANNEL):
         connection.join(self.__config.CHANNEL)
Exemplo n.º 19
0
 def on_connect(connection, event):
     connection.join(self.channel)
Exemplo n.º 20
0
 def on_welcome(self, connection, event):
     for chan in self.current_server['channels']:
         connection.join( chan )
     self.__module_handle('welcome', connection=connection, event=event)
Exemplo n.º 21
0
 def on_kick(self, connection, event):
     """Join the correct channel again"""
     if irc.client.is_channel(self.__config.CHANNEL):
         time.sleep(31)
         connection.join(self.__config.CHANNEL)
Exemplo n.º 22
0
 def on_welcome(self, connection, event):
     if irc.client.is_channel(self.target):
         connection.join(self.target)
Exemplo n.º 23
0
 def on_connect(connection, event):
     connection.join(self.channel)