def __init__(self): config = lib.aiml.configFile.get() try: server = config['irc.server'] if server == "": raise KeyError except KeyError: server = raw_input("Server: ") try: port = int(config['irc.port']) except: port = raw_input("Port: ") try: nickname = config['irc.nick'] if nickname == "": raise KeyError except KeyError: nickname = raw_input("Nick: ") try: channel = config['irc.channel'] if channel == "": raise KeyError except KeyError: channel = raw_input("Channel: ") SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel try: self._maxdelay = int(config['general.maxdelay']) except KeyError: self._maxdelay = 0 self.start()
def __init__( self ): self.last_msg = -1 self.msg_flood_limit = 0.25 with open(os.path.join(os.path.dirname(__file__), 'ircbot.conf')) as f: data = json.load(f) self.servers = data['servers'] self.select_server(0) self.db = sqlite3.connect( os.path.join( os.path.dirname( __file__ ), 'ircbot.sqlite3' ), check_same_thread = False ) cursor = self.db.cursor() try: cursor.execute( 'select * from config limit 1' ) except sqlite3.OperationalError: # table no exist cursor.execute( 'create table config ( `group` varchar(100), `key` varchar(100), `value` varchar(100) NULL )' ) cursor.close() self.modules = ModuleManager( self ) self.channel_ops = {} server = self.current_server['host'] port = self.current_server['port'] if 'port' in self.current_server else 6667 password = self.current_server['password'] if 'password' in self.current_server else '' nickname = self.current_server['nickname'] if len(password): SingleServerIRCBot.__init__( self, [( server, port, password )], nickname, nickname, ipv6 = True ) else: SingleServerIRCBot.__init__( self, [( server, port )], nickname, nickname, ipv6 = True ) for module_name in self.modules.get_available_modules(): self.modules.enable_module( module_name )
def __init__(self, parent, server_info, nickname ="orcbot"): server = server_info[0] port = int(server_info[1]) self.orc = parent SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
def __init__(self): """ Setup the robot, pulls a list of the latest phrases from the DB, sets channel list and modes. """ self.nicks, address = settings.IRC self.nick = self.nicks[0] SingleServerIRCBot.__init__(self, [address], self.nick, self.nick) self.c = Client(self.nick) # Channel related things self.c.modes = {} # Channel history self._history = {} self.c.to_join = [c for c in settings.IRC_CHANNELS] self.credentials = settings.IRC_CREDENTIALS self.output = Queue.Queue(20) self.c.verbosity = settings.VERBOSITY self.processor = None self.handler = None self.init_responders()
def __init__(self, server_list, nick, real, channel, listen_addr=None, script=None, deop=True): SingleServerIRCBot.__init__(self, server_list, nick, real, reconnection_interval=30) self.channel = decode(channel) self.script = decode(script) self.listen_addr = listen_addr self.deop = deop self.match = '^!' self.match_timer = 0 self.script_modified = 0 self.dispatchers = {} self.irc_socket = None self.send_timer = 0 self.send_buffer = [] self.recv_buffers = {} self.setup_logging() self.setup_throttling() self.setup_listener() self.running = False
def __init__(self, config, trigger='!', cb=None): self.config = config self.active = False self.joined = False self.registerNick = False self.callback = cb self.starttime = time.strftime('%H:%M on %A, %d %B', time.gmtime(time.time()) ) self.nickname = config.nickname self.password = config.password self.chanlist = config.channels self.server = config.server self.realname = self.nickname self.port = 6667 self.trigger = '!' if config.port is not None: self.port = config.port if config.trigger is not None: self.trigger = config.trigger if self.nickname is not None: self.nicklength = len(self.nickname) SingleServerIRCBot.__init__(self, [(self.server, self.port)], self.nickname, self.realname) else: raise Exception('nickname not defined, rbot init has stopped')
def __init__(self, rcfeed, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.server = server self.rcfeed = rcfeed self.nickname = nickname self.lastsulname = None self.lastbot = bot1
def __init__(self, rcfeed, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.server = server self.rcfeed = rcfeed self.nickname = nickname globals()['lastsulname'] = None globals()['lastbot'] = 1
def __init__(self, channels, nickname, password, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port), password], nickname, nickname) self.channelsDict = channels self.password = password self.botNick = nickname self.channels = {} self.logger = Logger(self.channels)
def __init__(self, *args, **kwargs): SingleServerIRCBot.__init__(self, *args) self.channel = kwargs['channel'] self.qpassword = kwargs['qpassword'] self.nick = args[1] self.queue = OutputManager(self.connection) self.queue.start() self.exceptions = [] self.bans = [] self.hosts = {} self.ban_for_nick_change = False try: with file('exceptions', 'r') as f: self.exceptions = pickle.load(f) except: pass try: with file('bans', 'r') as f: self.bans = pickle.load(f) except: pass try: with file('hosts', 'r') as f: self.hosts = pickle.load(f) except: pass
def __init__(self, channel, nickname, server, port): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.nickname = nickname self.queue = botcommon.OutputManager(self.connection) self.queue.start() self.start()
def __init__(self, servers=servers, names=names, channels=channels, interval=60): print "IRC: connecting..." self.names = names SingleServerIRCBot.__init__(self, servers, random.sample(self.names, 1)[0], random.sample(names, 1)[0], interval) self.channelswanted = channels
def __init__(self, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.version = '0.4.6' self.github = 'https://github.com/Nikola-K/BBBot/' self.nickname = nickname self.initial_channels = brba.initialch self.banned_users = brba.banned self.admin = brba.admin self.authorized = brba.auth self.ircpass = brba.password self.cc = '#' + brba.cc self.debug = False self.logdebug = False self.maxlen = 440 self.cmdlimits = {'!stream': 0, '!download': 0, '!i': 0, 'notify': 20, 'timelimit': 10, 'notifytime': 10} self.allcmds = ['bot', '.time', '.ban', '.unban', '.ath', '.rmath', '.join', '.quit', '.say', '.add', '.remove', '.update', '!i', '!download', '!stream', '!imdb', '!suggest', '.help' ] self.disabledcmds = ['!imdb', '!download'] self.loggedinusers = [] self.restrictedcmds = ['.time', '.ban', '.unban', '.ath', '.rmath', '.join', '.quit', '.say', '.add', '.remove', '.update' ] self.cmdqueue = []
def __init__(self, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.sqldb = botsqlite.botsqlite('bot.db') self.connection.add_global_handler("whoreply", self.who_parser) self.is_connected = 0
def __init__(self, channels=[], nickname="", server="", port=6667, module_list=[]): """MooBot initializer - gets values from config files and uses those unless passed values directly""" # Get values from config files and replace any of the empty ones above configs = self.get_configs() config_nick = configs['nick'] config_server = configs['server'] config_port = configs['port'] config_channels = configs['channels'] config_module_list = configs['module_list'] config_others = configs['others'] # If we are passed any values directly, use those, but if they are empty # we will fall back to the values we got from the config file if channels == []: channels = config_channels if nickname == "": nickname = config_nick if server == "": server = config_server if port == 6667: port = config_port if module_list == []: module_list = config_module_list # Now that we have our values, initialize it all SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channels = IRCDict() for channel in channels: self.channels[channel] = Channel() self.handlers = [] self.configs = config_others self.module_list = module_list
def __init__(self, channel, server, port=6667, password=None, name="beardbot", noadmin=False): SingleServerIRCBot.__init__(self, [(server, port, password)], name, "The Beardy-Based Botulator") # The channel the bot is a member of self.channel = channel # The last place a message was recieved from (used by "reply") self.last_message_sender = self.channel # If bot should have no administrators self.noadmin = noadmin # The loaded modules self.modules = {} #list of nicks to ignore self.ignore = [] # Try to load previously loaded modules try: old_modules = pickle.load(open(self.channel + "_modules.db", "r")) for module in old_modules: try: self.load_module(module) except Exception, e: traceback.print_exc(file=sys.stdout) except: # Otherwise just start the admin try: self.load_module("admin") except Exception, e: print e
def __init__(self, channel, nickname, server, password, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.server = server self.channel = channel self.nickname = nickname self.password = password self.version = '1.5'
def start(self): # Schedule active plugins for plugin in self.active: self.connection.execute_delayed(plugin.period(), activate, (self.connection, plugin)) # Start it SingleServerIRCBot.start(self)
def __init__(self, server = SERVER): self.channel = '#takano32bot' SingleServerIRCBot.__init__(self, [(SERVER, PORT)], NICKNAME, NICKNAME) xmlrpc_host = CONFIG['skype']['xmlrpc_host'] xmlrpc_port = CONFIG['skype']['xmlrpc_port'] self.skype = xmlrpclib.ServerProxy('http://%s:%s' % (xmlrpc_host, xmlrpc_port))
def __init__(self, name = bot['name'], server = bot['server'], ssl = bot['ssl'], password = bot['password'], port = bot['port'], channel = bot['channel'], **kwargs): SingleServerIRCBot.__init__(self, [(server, port)], name, "IRCBot available on : https://git.io/vHtZ6",password=password, ssl=ssl) self._name = name self._channel = channel self._server = server self._port = port self._ssl = ssl self._stdout = kwargs.pop('stdout', sys.stdout) self._stat = kwargs.pop('stat', {}) self._prompt.update(kwargs.pop('prompt', {})) self._function = kwargs.pop('function', bot.get('function', True)) function = kwargs.pop('function_access', {}) self.__function__ = { key[3:]: function[key[3:]] if key[3:] in function and type(function[key[3:]]) is int else bot.get('__function__', 0) for key in dir(self) if key.startswith('do_') } self.__function_intervall = kwargs.pop('function_intervall', 5) self.__next_function = datetime.now()
def __init__(self): self.load_settings() SingleServerIRCBot.__init__(self, [(self.server, int(self.port))], self.nickname, self.nickname) self.ircobj.execute_delayed(OPPAI_INTERVAL, self.on_timer) self.offset = 0 self.urlList = [] self.load_oppai()
def __init__(self, channel, nickname, server, port=6667, hub=None): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.connection.add_global_handler("all_events", self.on_all_events, -100) self.channel = channel self.chat_channel = "#pyIRDC" self.channel_users = IRCChannelUsers() self.send_queue = [] self.hub = hub
def start(self): """Override default start function to avoid starting/stalling the bot with no connection""" while not self.connection.is_connected(): self._connect() if not self.connection.is_connected(): time.sleep(self.reconnection_interval) self.server_list.append(self.server_list.pop(0)) SingleServerIRCBot.start(self)
def start(self): try: SingleServerIRCBot.start(self) except BaseException: sys.stderr.write(traceback.format_exc()) if self.mention_grabber: self.mention_grabber.terminate() exit(1)
def __init__(self, channel, nickname, server, port): self.child = pexpect.spawn(frotz_binary + " " + story_file) SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.nickname = nickname self.queue = botcommon.OutputManager(self.connection) self.queue.start() self.start()
def __init__(self, server, channels, nick, name, nickpass=None, recon=60): SingleServerIRCBot.__init__(self, [server], nick, name, recon) self.queue = botcommon.OutputManager(self.connection, .2) self.queue.start() self.nickname = nick self.name = name self.join_channels = channels self.plugins = []
def __init__(self, as): # Connect to IRC server self.as = as self.logfile = open(logFile, "a") print "Connecting to %s as %s..." % (server, nickname) SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.start()
def __init__(self, server_list, nickname, channel): SingleServerIRCBot.__init__(self, server_list, nickname, nickname) self.channel = channel # for all other possible events to handle, see irclib.py > numeric_events, generated_events # and protocol_events self.my_names.append(nickname) self.startTime = datetime.datetime.now() self.loadPlugins()
def __init__(self, channel, nickname, server, port): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.nickname = nickname self.queue = botcommon.OutputManager(self.connection) self.queue.start() self.inputthread = UDPInput(self, ('localhost', 4242)) self.inputthread.start() self.start()
def __init__(self, channel="#Bitcoin-Watch", nickname="bcbot", server="chat.freenode.net", port=6667, realname="Bitcoin monitoring bot https://github.com/davesteele/python-bitcoin-talk"): SingleServerIRCBot.__init__(self, [(server, port)], nickname, realname) self.channel = channel self.txCallbacks = []
def __init__(self, server, port, server_pass=None, channels=[], nick="timber", nick_pass=None, format=default_format): SingleServerIRCBot.__init__(self, [(server, port, server_pass)], nick, nick) self.chans = [x.lower() for x in channels] self.format = format self.set_ftp() self.count = 0 self.nick_pass = nick_pass print "Logbot %s" % __version__ print "Connecting to %s:%i..." % (server, port) print "Press Ctrl-C to quit"
def __init__(self, channel, nickname, server, port=6667, owner='', speech_queue=None): #TBD error check the var type for deque self.speech_queue = speech_queue SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.owner = owner self.last_sender = '' self.pronounce_dict = { 'api': 'API', 'lol': 'ha ha', 'lolol': 'ha ha', 'brb': 'be right back', 'thx': 'thanks', 'yeah': 'ya', }
def __init__(self, server_list, channels=[], nick="timber", nick_pass=None, format=default_format): SingleServerIRCBot.__init__(self, server_list, nick, nick) self.chans = [x.lower() for x in channels] self.format = format self.set_ftp() self.count = 0 self.nick_pass = nick_pass self.load_channel_locations() print "Logbot %s" % __version__ servers_to_connect = [ "%s:%i" % (server, port) for (server, port, passwd) in server_list ] print "Connecting to %s ..." % (servers_to_connect) print "Press Ctrl-C to quit"
def __init__(self, settings, plugins=[]): if not settings.has_key('port'): port = 6667 else: port = settings['port'] self.settings = settings SingleServerIRCBot.__init__(self, [(settings['server'], port)], settings['nick'], settings['user']) self.channel = settings['channel'] self.plugins = [] for plugin in plugins: self.register_plugin(plugin) self.ticker = 0 self.ircobj.execute_delayed(1.0, self._timed_events) self.log = {} if settings.has_key('debug'): self.debug = True
def __init__(self, server, port, server_pass=None, channels=[], nick="timber", nick_pass=None, operators=OPERATORS): SingleServerIRCBot.__init__(self, [(server, port, server_pass)], nick, nick) self.chans = [x.lower() for x in channels] self.operators = operators self.count = 0 self.nick_pass = nick_pass self.question_queue = [] self.timestamps = {} print "ClassBot %s" % __version__ print "Connecting to %s:%i..." % (server, port) print "Press Ctrl-C to quit"
def __init__(self, config, trigger='!', cb=None): self.active = False self.joined = False self.registerNick = False self.callback = cb self.starttime = time.strftime('%H:%M on %A, %d %B', time.gmtime(time.time())) self.nickname = config.nickname self.password = config.password self.chanlist = config.channels self.server = config.server self.port = config.port self.trigger = config.trigger self.nicklength = len(self.nickname) self.realname = self.nickname SingleServerIRCBot.__init__(self, [(self.server, self.port)], self.nickname, self.realname, ssl=True)
def __init__(self, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.doingcommand = False self.commandaccesslist = {} self.commandcooldownlast = {} self.spam = {} config = ConfigParser.ConfigParser() try: cfgfile = open('genmaybot.cfg') except IOError: print "You need to create a .cfg file using the example" sys.exit(1) config.readfp(cfgfile) self.identpassword = config.get("irc", "identpassword") self.botadmins = config.get("irc", "botadmins").split(",") print self.loadmodules()
def __init__(self, nickname, channel, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.nick = nickname self.channel = channel self.server = server self.commands = {} self.quiet = False self.wordOfTheDay = "Banana" self.generalLogger = Logger(server, channel, "all") self.topicalLogger = False self.namexFile = ResourceFile("namex") self.policyFile = ResourceFile("policy") self.actionFile = ResourceFile("actions") self.murderFile = ResourceFile("murder") self.weaponFile = ResourceFile("weapons") self.initCommands() self.initTimers()
def on_ctcp(self, c, e): args = e.arguments() type = args[0] source = nm_to_n(e.source()) channel = e.target() if type == 'ACTION': if len(args) > 1: msg = args[1] else: msg = "" if self.i_am_mentioned(c, msg) and self.is_listening(channel): if not self.nick_is_voiced(channel, source): self.privmsg_multiline(c, channel, random.choice(self.deepthoughts)) else: return SingleServerIRCBot.on_ctcp(self, c, e)
def __init__(self, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel print "Joining %s"%(channel,)
def __init__(self, channel, nickname, server, parentclient, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.ircobj.runCond = True self.channel = channel self.parentclient = parentclient
def __init__(self, channel, nickname, server, port): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel
def on_ctcp(self, c, e): """ Executed on CTCP events.""" self.on_other(c, e) SingleServerIRCBot.on_ctcp(self, c, e)
def __init__(self): SingleServerIRCBot.__init__(self, servers, nick, (botname + " " + topics).encode("UTF-8"), reconnect_interval)
def __init__(self, server=SERVER): SingleServerIRCBot.__init__(self, [(SERVER, PORT)], NICKNAME, NICKNAME) self.channel = '#takano32bot'
def __init__(self, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.brain = ParaBrain(self)
def __init__(self, skype, server=SERVER): SingleServerIRCBot.__init__(self, [(SERVER, PORT)], NICKNAME, NICKNAME) self.skype = skype self.channel = CHANNEL
def __init__(self, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
def __init__(self, channel, nickname, server, cmd, message, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.message = message self.cmd = cmd
def __init__(self, channel, nick, password, name): self.channel = channel self.password = password SingleServerIRCBot.__init__(self, [(channel.server, channel.port)], nick, name)
def __init__(self, *args, **kw): try: self.__singleton__ except: SingleServerIRCBot.__init__(self, *args, **kw) self.__singleton__ = True
def __init__(self, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.rcbot = rciw.IWRCBot(site) self.tasks = []
def do_join(self, event, cmd, data): SingleServerIRCBot._on_join(self, self.connection, event) self.connection.join(data[1], data[2])
def __init__(self, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) feederThread = threading.Thread(target=self.feederBot) feederThread.setDaemon(True) feederThread.start()
def __init__(self, chans, nickname, server): print "*** Connecting to IRC server %s..." % server SingleServerIRCBot.__init__(self, [(server, 6667)], nickname, "IRC echo bot") self.chans = chans
def __init__(self, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.checker = CheckPages([['localhost', '/']], self)
def __new__(cls, *args, **kw): if not KGB._instance: KGB._instance = SingleServerIRCBot.___new__(cls, *args, **kw) return cls._instance
def __init__(self, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.nickname = nickname self.channel = channel self.deepthoughts = self.meditate() self.start()
def __init__(self, channel, pswd, nickname, server, main_server): SingleServerIRCBot.__init__(self, [(s, 6667) for s in server], main_server, nickname, nickname) self.channel = channel self.pswd = pswd self.engine = create_engine('sqlite:///db/irclog.db', echo=True) self.main_server = main_server