当前位置: 首页>>代码示例>>Python>>正文


Python irclib.SimpleIRCClient类代码示例

本文整理汇总了Python中irclib.SimpleIRCClient的典型用法代码示例。如果您正苦于以下问题:Python SimpleIRCClient类的具体用法?Python SimpleIRCClient怎么用?Python SimpleIRCClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SimpleIRCClient类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self):
        SimpleIRCClient.__init__(self)

        self.channel = "#pfclol"

        self.nick_re = re.compile("^([^!]+)!")
        self.message_queue = []
        self.event_queue = []

        # We might be connected, but we're not ready yet.
        self.online = False
        self.hasMotd = False

        # But when we see some magic words, we will be.
        self.connection.add_global_handler("motdstart", self.connect_parse, -10)
        self.connection.add_global_handler("endofmotd", self.connect_parse, -10)
        self.connection.add_global_handler("luserconns", self.connect_parse, -10)
        
        # Unless we're not, anymore.
        self.connection.add_global_handler("disconnect", self.connect_parse, -10)

        # And once we're online, we want to pay attention.
        self.connection.add_global_handler("privmsg", self.parse_msg, -5)
        self.connection.add_global_handler("pubmsg", self.parse_msg, -5)
        self.connection.add_global_handler("join", self.parse_msg, -5)
        self.connection.add_global_handler("part", self.parse_msg, -5)  
        self.connection.add_global_handler("kick", self.parse_msg, -5)  
        self.connection.add_global_handler("quit", self.parse_msg, -5)  
开发者ID:pavellishin,项目名称:pfcirc,代码行数:28,代码来源:pavelirc.py

示例2: __init__

    def __init__(self, server_list, nickname, realname, reconnection_interval=60):
        """Constructor for SingleServerIRCBot objects.

        Arguments:

            server_list -- A list of tuples (server, port) that
                           defines which servers the bot should try to
                           connect to.

            nickname -- The bot's nickname.

            realname -- The bot's realname.

            reconnection_interval -- How long the bot should wait
                                     before trying to reconnect.

            dcc_connections -- A list of initiated/accepted DCC
            connections.
        """

        SimpleIRCClient.__init__(self)
        self.channels = IRCDict()
        self.server_list = server_list
        if not reconnection_interval or reconnection_interval < 0:
            reconnection_interval = 2**31
        self.reconnection_interval = reconnection_interval

        self._nickname = nickname
        self._realname = realname
        for i in ["disconnect", "join", "kick", "mode",
                  "namreply", "nick", "part", "quit"]:
            self.connection.add_global_handler(i,
                                               getattr(self, "_on_" + i),
                                               -10)
开发者ID:mhielscher,项目名称:simplebot,代码行数:34,代码来源:ircbot.py

示例3: __init__

 def __init__(self, config, listner):
     SimpleIRCClient.__init__(self)
     self.server = config['irc']['server']
     self.port = 6667
     self.nickname = self._generate_nick()
     self.channel = config['irc']['channel']
     self.listner = listner
开发者ID:somat,项目名称:pyews-desktop,代码行数:7,代码来源:ircclient.py

示例4: __init__

 def __init__(self, channel, input, output):
     SimpleIRCClient.__init__(self)
     self.channel=channel
     self.channels = {}
     self.joined_channels = {}
     self.lol = False
     self.pubblicata = False
开发者ID:LightStyle,项目名称:FFPyBots,代码行数:7,代码来源:trivia.py

示例5: __init__

 def __init__(self, verbose=False, channels=[channel]):
     SimpleIRCClient.__init__(self)
     self.count = count()
     self.verbose = verbose
     self.logged = False
     self._irc_log = []
     host, port = self.redis_server.split(':')
     self.redis = redis.Redis(host, int(port))
     self.channels = channels
     self.channel = channels[0]
开发者ID:SMFOSS,项目名称:DoulaBot,代码行数:10,代码来源:bot.py

示例6: __init__

 def __init__(self, bitHopper):
     SimpleIRCClient.__init__(self)
     self.bitHopper = bitHopper
     self.nick = 'lp' + str(random.randint(1,9999999999))
     self.chan_list=[]
     self.newblock_re = re.compile('\*\*\* New Block \{(?P<server>.+)\} - (?P<hash>.*)')
     self.hashes = ['']
     self.hashinfo = {'':''}
     self.server=''
     self.current_block=''
     # TODO: Use twisted
     thread.start_new_thread(self.run, ())
     thread.start_new_thread(self.ircobj.process_forever,())
开发者ID:Gnaget,项目名称:bitHopper,代码行数:13,代码来源:lpbot.py

示例7: __init__

	def __init__(self):
		SimpleIRCClient.__init__(self)
		self.nick = 'lp' + str(random.randint(1,9999999999))
		self.connection.add_global_handler('disconnect', self._on_disconnect, -10)
		self.chan_list=[]
		self.newblock_re = re.compile('\*\*\* New Block \{(?P<server>.+)\} - (?P<hash>.*)')
		self.hashes = ['']
		self.hashinfo = {}
		self.server=''
		self.current_block=''
		# TODO: Use twisted
		thread.start_new_thread(self.run,())
		thread.start_new_thread(self.ircobj.process_forever,())
开发者ID:bb-btc,项目名称:bitHopper,代码行数:13,代码来源:lpbot.py

示例8: __init__

    def __init__(self, config):
        '''Sets up two things from the configuration file: the
        connection information that is used by the SimpleIRCClient
        parent class and the information needed by the core class that
        adds interactive functionality to the bot.
        '''
        bot = config['Connection']

        SimpleIRCClient.__init__(self)
        self.connect(bot['server'], bot['port'], bot['nick'],
                     bot['pw'], bot['name'])

        self.ops   = bot['ops']
        self.chans = bot['chans']
        self.about = bot['about']

        self.core   = core.BotCore(self, self.ops, self.chans, self.about)
开发者ID:Aethaeryn,项目名称:AethBot,代码行数:17,代码来源:__init__.py

示例9: __init__

 def __init__(self, channel, input, output):
     SimpleIRCClient.__init__(self)
     self.channel = channel
     self.channels = {}
开发者ID:LightStyle,项目名称:FFPyBots,代码行数:4,代码来源:rss.py

示例10: start

 def start(self):
     """Start the bot."""
     self._connect()
     SimpleIRCClient.start(self)
开发者ID:mhielscher,项目名称:simplebot,代码行数:4,代码来源:ircbot.py

示例11: start

 def start(self):
     """Start the bot."""
     success = self._connect()
     if success:
         SimpleIRCClient.start(self)
开发者ID:simulationcraft,项目名称:logbot,代码行数:5,代码来源:ircbot.py

示例12: __init__

    def __init__(self, server_list, connection_kwargs, reconnection_interval=60):
        """Constructor for SingleServerIRCBot objects.

        Arguments:

            server_list -- A list of dicts containing connection arguments.

            connection_kwargs -- Dict of connection arguments.

            reconnection_interval -- How long the bot should wait
                                     before trying to reconnect.

        How a connection is made:

            When a connection is made the arguments from connection_kwargs are
            used but then overridden by the arguments for the currect server.

            The only requirement is that all servers need to contain server and
            port key and connection_kwargs need to contain nickname key

            Other than that you can send in anything that
            SimpleIRCClient.connect() accept. This means that you don't have to
            change this class if you change the arguments to
            SimpleIRCClient.connect()

        Example:

            server_list = [
                {
                    'server': 'www.example1.com',
                    'port': '6669',
                },
                {
                    'server': 'www.example2.com',
                    'port': '6669',
                },
                {
                    'server': 'www.example3.com',
                    'port': '6669',
                    'ssl': False,
                },
            ]

            connection_kwargs = {
                'nickname': 'bot',
                'ssl': True,
            }

            This config means that ssl will be used for example1 and 2 but not 3

        """

        SimpleIRCClient.__init__(self)
        self.channels = IRCDict()
        self.server_list = server_list
        self.connection_kwargs = connection_kwargs

        for server in self.server_list:
            if not "server" in server or not "port" in server:
                raise Exception("All servers need to contain a port and server")

        if not "nickname" in self.connection_kwargs:
            raise Exception("connection_kwargs need to contain a nickname")

        if not reconnection_interval or reconnection_interval < 0:
            reconnection_interval = 2 ** 31
        self.reconnection_interval = reconnection_interval

        for i in ["disconnect", "join", "kick", "mode", "namreply", "nick", "part", "quit"]:
            self.connection.add_global_handler(i, getattr(self, "_on_" + i), -10)
开发者ID:WizKid,项目名称:python-irclib,代码行数:70,代码来源:ircbot.py

示例13: start

 def start(self):
     '''Starts the IRC bot, which gets it to connect to the server
     that has been specified.
     '''
     SimpleIRCClient.start(self)
开发者ID:Aethaeryn,项目名称:AethBot,代码行数:5,代码来源:__init__.py


注:本文中的irclib.SimpleIRCClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。