Beispiel #1
0
def main():
    username  = sys.argv[1]
    token     = sys.argv[2]
    channel   = sys.argv[3]

    bot = TwitchBot(username, token, channel)
    bot.start()
Beispiel #2
0
def _main(args, config):
    logging.setup_logging(config)

    fp = config.ircbot_channel_config
    if fp:
        fp = os.path.expanduser(fp)
        if not os.path.exists(fp):
            raise ElasticRecheckException(
                "Unable to read layout config file at %s" % fp)
    else:
        raise ElasticRecheckException(
            "Channel Config must be specified in config file.")

    channel_config = ChannelConfig(yaml.load(open(fp)))
    msgs = MessageConfig(yaml.load(open(fp)))

    if not args.noirc:
        bot = RecheckWatchBot(
            channel_config.channels,
            config=config)
    else:
        bot = None

    recheck = RecheckWatch(
        bot,
        channel_config,
        msgs,
        config=config,
        commenting=not args.nocomment,
    )

    recheck.start()
    if not args.noirc:
        bot.start()
Beispiel #3
0
def bot_init(response_fn=lambda s: s, greeting_fn=lambda s: s):
    import sys
    if len(sys.argv) != 4:
        print("Usage: stacia_alt <server[:port]> <channel> <nickname>")
        sys.exit(1)

    s = sys.argv[1].split(":", 1)
    server = s[0]
    if len(s) == 2:
        try:
            port = int(s[1])
        except ValueError:
            print("Error: Erroneous port.")
            sys.exit(1)
    else:
        port = 6667
    channel = sys.argv[2]
    nickname = sys.argv[3]
    print("getting ready")
    bot = IrcStacia(channel,
                    nickname,
                    server,
                    port,
                    response_fn=response_fn,
                    greeting_fn=greeting_fn)
    bot.start()
    print("started..")
Beispiel #4
0
def main():
    import sys

    if len(sys.argv) != 4:
        print("Usage: testbot <server[:port]> <channel> <nickname>")
        sys.exit(1)

    s = sys.argv[1].split(":", 1)
    server = s[0]
    if len(s) == 2:
        try:
            port = int(s[1])
        except ValueError:
            print("Error: Erroneous port.")
            sys.exit(1)
    else:
        port = 6667
    channel = sys.argv[2]
    nickname = sys.argv[3]

    with open('keys.txt', 'r') as f:
        keys = f.read().splitlines()

    consumer_key = keys[0]
    consumer_secret = keys[1]

    bot = TestBot(channel, nickname, server, port)
    bot.start()
Beispiel #5
0
def main():
    print "meglio una raspa di una ruspa"
    global T800
    global bot
    if len(sys.argv) != 4:
        print "Usage: arnaldo <server[:port]> <channel> <nickname>"
        sys.exit(1)

    s = sys.argv[1].split(":", 1)
    server = s[0]
    if len(s) == 2:
        try:
            port = int(s[1])
        except ValueError:
            print "Error: Erroneous port."
            sys.exit(1)
    else:
        port = 6667

    channel = sys.argv[2]
    nickname = sys.argv[3]

    T800 = Vedetta()
    T800.start()
    # I'm a friend of Sarah Connor. I was told she was here. Could I
    # see her please?

    bot = Arnaldo(channel, nickname, server, port)
    signal.signal(signal.SIGUSR1, fista_duro_e_vai_sicuro)

    try:
        bot.start()
    except KeyboardInterrupt:
        T800.stop()
Beispiel #6
0
def main():
    while True:
        try:
            import sys
            if len(sys.argv) != 4:
                print("Usage: python abacoffee.py <server[:port]> <channel1,channel2,channel3..> <nickname>")
                sys.exit(1)

            s = sys.argv[1].split(":", 1)
            channelList = sys.argv[2].split(",")
            server = s[0]
            if len(s) == 2:
                try:
                    port = int(s[1])
                except ValueError:
                    print("Error: Erroneous port.")
                    sys.exit(1)
            else:
                port = 6667
            nickname = sys.argv[3]
            for i,chan in enumerate(channelList):
                channelList[i] = '#'+chan
            print channelList, nickname, server,
            bot = AbakusCoffeeBot(channelList, nickname, server, port)
            bot.start()
        except KeyboardInterrupt:
            print "Exiting."
            raise
        except:
            pass
Beispiel #7
0
def main():
    import logging.config
    with open(os.path.join(os.path.dirname(__file__), 'logging.yml'), 'r') as config:
        logging.config.dictConfig(yaml.load(config))

    dotenv.load_dotenv(os.path.join(os.path.dirname(__file__), '.env'))
    parser = argparse.ArgumentParser(description='IRC Bot for Keeping Score')

    if os.environ.get('NICK'):
        parser.add_argument('--nick', default=os.environ.get('NICK'))
    else:
        parser.add_argument('nick')

    if os.environ.get('CHANNEL'):
        parser.add_argument('--channel', default=os.environ.get('CHANNEL'))
    else:
        parser.add_argument('channel')

    if os.environ.get('RECORD'):
        parser.add_argument('--record', default=os.environ.get('RECORD'))
    else:
        parser.add_argument('record')

    parser.add_argument('--prefix', default=os.environ.get('PREFIX', '!points'))
    parser.add_argument('--server', default=os.environ.get('SERVER', 'irc.freenode.net'))
    parser.add_argument('--port', type=int, default=os.environ.get('PORT', 6667))

    args = parser.parse_args()
    bot = PointBot(args.channel, args.record, args.prefix, args.nick,
                   args.server, args.port)
    bot.start()
Beispiel #8
0
def init(confdir="/etc/cslbot"):
    """The bot's main entry point.

    | Initialize the bot and start processing messages.
    """
    multiprocessing.set_start_method('spawn')

    parser = argparse.ArgumentParser()
    parser.add_argument('-d', '--debug', help='Enable debug logging.', action='store_true')
    args = parser.parse_args()
    loglevel = logging.DEBUG if args.debug else logging.INFO
    logging.basicConfig(level=loglevel)

    bot = IrcBot(confdir)

    try:
        bot.start()
    except KeyboardInterrupt:
        # KeyboardInterrupt means someone tried to ^C, so shut down the bot
        bot.disconnect('Bot received a Ctrl-C')
        bot.shutdown_mp()
        sys.exit(0)
    except Exception as ex:
        bot.shutdown_mp(False)
        logging.error("The bot died! %s" % ex)
        output = "".join(traceback.format_exc()).strip()
        for line in output.split('\n'):
            logging.error(line)
        sys.exit(1)
Beispiel #9
0
def start_confbot(*args):
    if len(args) != 3 and len(args) != 4:
        print "Parameters: <server[:port]> <channel> <nickname> [nickserv pass]"
        print args
        return 1

    logging.basicConfig(level=logging.DEBUG)
    s = args[0].split(":", 1)
    server = s[0]
    if len(s) == 2:
        try:
            port = int(s[0])
        except ValueError:
            print "Error: Erroneous port."
            return 1
    else:
        port = 6667
    channel = args[1]
    nickname = args[2]
    password = None
    if len(args) > 3:
        password = args[3]

    bot = ConfBot(channel, nickname, server, port, password)
    bot.start()
Beispiel #10
0
def main():
	import sys
	if len(sys.argv) < 5:
		print("Usage: IRCbot2LCD.py <server[:port]> <channel> <nicknameToMonitor> <COMport> <optional bot nickname>")
		sys.exit(1)

	s = sys.argv[1].split(":", 1)
	server = s[0]
	if len(s) == 2:
		try:
			port = int(s[1])
		except ValueError:
			print("Error: Erroneous port.")
			sys.exit(1)
	else:
		port = 6667
	channel = sys.argv[2]
	nickname = sys.argv[3]
	COMport = sys.argv[4]
	
	global BotNick	# Declare global variable for "BotNick"
	if len(sys.argv) == 6:	# If there is a argument defined for "BotNick"
		BotNick = sys.argv[5]	# Set "BotNick" to Argument 5(sys.argv[5])
	else:	# Else
		BotNick = nickname + "_"	# Use nickname to monitor and an underscore
	
	global MonitorNick	# Declare global variable for "MonitorNick"
	MonitorNick = nickname	# Set "MonitorNick" to nickname(sys.argv[3])
	
	global ser	# Declare global variable for "ser"
	ser = serial.Serial(str(COMport),baudrate=9600)	# Set "ser" to Serial object
	
	bot = IRC2LCDbot(channel, nickname, server, port)	# Set "bot" to IRC2LCDbot object
	bot.start()	# Start bot
	ser.close()	# Closing Serial port will prevent problems
Beispiel #11
0
def main():
    """The bot's main entry point.

    | Initialize the bot and start processing messages.
    """
    config_file = path.join(path.dirname(__file__), 'config.cfg')
    if not path.exists(config_file):
        logging.info("Setting up config file")
        config.do_setup(config_file)
        return
    botconfig = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation())
    with open(config_file) as f:
        botconfig.read_file(f)
    bot = IrcBot(botconfig)
    try:
        bot.start()
    except KeyboardInterrupt:
        # KeyboardInterrupt means someone tried to ^C, so shut down the bot
        bot.disconnect('Bot received a Ctrl-C')
        bot.shutdown_mp()
        sys.exit(0)
    except Exception as ex:
        bot.shutdown_mp(False)
        logging.error("The bot died! %s" % ex)
        output = "".join(traceback.format_exc())
        for line in output.split('\n'):
            logging.error(line)
        sys.exit(1)
Beispiel #12
0
def main():
    from mainbot.main import BaseBot
    bot = BaseBot(settings.apikey, settings.channel, settings.username, \
                  settings.callSign, settings.manOpList, settings.commandPrefix, \
                  settings.filterBotMessages, settings.textReplacements)
    
    import mainbot.commands as commands
    commands.ping(bot)
    commands.die(bot)
    commands.cnJoke(bot)
    commands.vote(bot)
    commands.help(bot)
    commands.say(bot)
    commands.set(bot)
   
    import games.textAdv
    games.textAdv.cca(bot)

    import Commands.fun
    Commands.fun.asciiClock(bot)
    Commands.fun.cowsay(bot)
    Commands.fun.slap(bot)

    import games.card
    games.card.blackjack(bot)

    import mainbot.textReaders
    # mainbot.textReaders.youTubeScanner(bot, open("apikeys/youtube.apikey", "r").read().strip())

    mainbot.textReaders.imgurScanner(bot, *open("apikeys/imgur.apikey").read().strip().split("\n"))

    bot.start(1/30)
Beispiel #13
0
def main():
    print "meglio una raspa di una ruspa"
    global T800
    global bot
    if len(sys.argv) != 4:
        print "Usage: arnaldo <server[:port]> <channel> <nickname>"
        sys.exit(1)

    s = sys.argv[1].split(":", 1)
    server = s[0]
    if len(s) == 2:
        try:
            port = int(s[1])
        except ValueError:
            print "Error: Erroneous port."
            sys.exit(1)
    else:
        port = 6667

    channel = sys.argv[2]
    nickname = sys.argv[3]

    T800 = Vedetta()
    T800.start()
    # I'm a friend of Sarah Connor. I was told she was here. Could I
    # see her please?

    bot = Arnaldo(channel, nickname, server, port)
    signal.signal(signal.SIGUSR1, fista_duro_e_vai_sicuro)

    try:
        bot.start()
    except KeyboardInterrupt:
        T800.stop()
def KaliRoulette(streamer_name, bot_name):

    server = irc.bot.ServerSpec('irc.twitch.tv',
                                port=6667,
                                password=oauth_token)
    bot = KaliBot(server, '#{}'.format(streamer_name), streamer_name, bot_name)
    bot.start()
Beispiel #15
0
def main():
    """The bot's main entry point.

    | Initialize the bot and start processing messages.
    """
    config_file = path.join(path.dirname(__file__), 'config.cfg')
    if not path.exists(config_file):
        logging.info("Setting up config file")
        config.do_setup(config_file)
        return
    botconfig = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation())
    with open(config_file) as f:
        botconfig.read_file(f)
    bot = IrcBot(botconfig)
    try:
        bot.start()
    except KeyboardInterrupt:
        # KeyboardInterrupt means someone tried to ^C, so shut down the bot
        bot.disconnect('Bot received a Ctrl-C')
        bot.shutdown_mp()
        sys.exit(0)
    except Exception as ex:
        bot.shutdown_mp(False)
        logging.error("The bot died! %s" % ex)
        output = "".join(traceback.format_exc())
        for line in output.split('\n'):
            logging.error(line)
        sys.exit(1)
Beispiel #16
0
def _main(config):
    setup_logging(config)

    fp = config.get('ircbot', 'channel_config')
    if fp:
        fp = os.path.expanduser(fp)
        if not os.path.exists(fp):
            raise Exception("Unable to read layout config file at %s" % fp)
    else:
        raise Exception("Channel Config must be specified in config file.")

    channel_config = ChannelConfig(yaml.load(open(fp)))

    bot = GerritBot(channel_config.channels,
                    config.get('ircbot', 'nick'),
                    config.get('ircbot', 'pass'),
                    config.get('ircbot', 'server'),
                    config.getint('ircbot', 'port'),
                    config.getboolean('ircbot', 'force_ssl'),
                    config.get('ircbot', 'server_password'))
    g = Gerrit(bot,
               channel_config,
               config.get('gerrit', 'host'),
               config.get('gerrit', 'user'),
               config.getint('gerrit', 'port'),
               config.get('gerrit', 'key'))
    g.start()
    bot.start()
Beispiel #17
0
def main():
    config = configloader.load_config()
    if config is None:
        quit()

    bot = Bot(config)
    bot.start()
Beispiel #18
0
def main():
    logger.setLevel(10)

    if len(sys.argv) <= 1:
        exit_usage()
    elif len(sys.argv) == 2:
        print_usage()
        nickname = sys.argv[1]
        channel = IRC_CHANNEL
        server = IRC_SERVER
        port = int(IRC_PORT)
    elif len(sys.argv) == 4:
        url = sys.argv[1]
        server, port = url.split(":", 1) if ":" in url else (url, IRC_PORT)
        port = int(port)
        channel = sys.argv[2]
        nickname = sys.argv[3]
    else:
        exit_usage()

    channel = ensure_hashtag_channel(channel)
    logger.info(("\n\tinitalizing with:\n"
                 f"\t\tchannel = {channel}\n"
                 f"\t\tnickname = {nickname}\n"
                 f"\t\tserver = {server}\n"
                 f"\t\tport = {port}\n"))
    bot = RasaIRCBot(channel=channel,
                     nickname=nickname,
                     server=server,
                     port=port)
    bot.start()
Beispiel #19
0
def main():
    # if len(sys.argv) != 5:
    #     print("Usage: twitchbot <username> <client id> <token> <channel>")
    #     sys.exit(1)

    # username  = sys.argv[1]
    # client_id = sys.argv[2]
    # token     = sys.argv[3]
    # channel   = sys.argv[4]

    username = '******'
    client_id = 'idgnrmfdwlmb2b4wldetuzewc6s1kd'
    token = 'o46q25lvzkat7ifntm8ndv9urbsjra'
    channel = 'gay_zach'

    try:
        bot = TwitchBot(username, client_id, token, channel)
        bot.start()
    except KeyboardInterrupt:
        bot.message('bot has committed honorable sudoku')
        bot.points.save()
        bot.events.lottery.save()
    except:
        bot.message('someone murdered me.')
        bot.points.save()
        bot.events.lottery.save()
        raise
Beispiel #20
0
def start(configpath):
    with open(configpath, 'r') as fp:
        config = json.load(fp, object_pairs_hook=collections.OrderedDict)

    if 'log_config' in config:
        log_config = config['log_config']
        fp = os.path.expanduser(log_config)
        if not os.path.exists(fp):
            raise Exception("Unable to read logging config file at %s" % fp)
        logging.config.fileConfig(fp)
    else:
        logging.basicConfig(level=logging.DEBUG)

    db = ptgbot.db.PTGDataBase(config['db_filename'],
                               config['slots'],
                               config['scheduled'],
                               config['extrarooms'])

    bot = PTGBot(config['irc_nick'],
                 config.get('irc_pass', ''),
                 config['irc_server'],
                 config['irc_port'],
                 config['irc_channel'],
                 db)
    bot.start()
Beispiel #21
0
def _main():
    config = ConfigParser.ConfigParser({'server_password': None})
    config.read(sys.argv[1])
    setup_logging(config)

    fp = config.get('ircbot', 'channel_config')
    if fp:
        fp = os.path.expanduser(fp)
        if not os.path.exists(fp):
            raise Exception("Unable to read layout config file at %s" % fp)
    else:
        raise Exception("Channel Config must be specified in config file.")

    channel_config = ChannelConfig(yaml.load(open(fp)))

    doge = DogeMessage(config.get('doge', 'prefix').upper().split(','),
                       config.get('doge', 'positive').upper().split(','),
                       config.get('doge', 'neutral').upper().split(','),
                       config.get('doge', 'negative').upper().split(','))

    bot = GerritBot(channel_config.channels,
                    config.get('ircbot', 'nick'),
                    config.get('ircbot', 'pass'),
                    config.get('ircbot', 'server'),
                    config.getint('ircbot', 'port'),
                    config.get('ircbot', 'server_password'))
    g = Gerrit(bot,
               doge,
               channel_config,
               config.get('gerrit', 'host'),
               config.get('gerrit', 'user'),
               config.getint('gerrit', 'port'),
               config.get('gerrit', 'key'))
    g.start()
    bot.start()
Beispiel #22
0
def main():
    try:
        os.remove('log.log')
    except OSError as e:
        print e
    
    logging.basicConfig(filename='log.log',level=logging.DEBUG)
    
    config = {}
    execfile('config.cfg', config)
    
    # Set up like this so i can just uncomment a line to test
    testing = False
    #testing = True
    
    bot = Bot(config, testing)
    
    done = 0
    
    while done == 0:
        try:
            bot.start()
        except UnicodeDecodeError:
            print "unicodedecodeerror"
        else:
            done = 1
Beispiel #23
0
def main():
    username  = ""
    token     = "" # get it from - https://twitchapps.com/tmi/
    channel   = ""

    bot = TwitchBot(username, token, channel)
    bot.start()
Beispiel #24
0
def main():
    server = 'irc.snoonet.org'
    port = 6667
    channel = '#random'
    nickname = 'SnootBot'
    bot = SnootBot(channel, nickname, server, port)
    bot.start()
Beispiel #25
0
def main():
    # import sys
    # if len(sys.argv) != 5:
    # print("Usage: testbot <server[:port]> <channel> <nickname> <password>")
    # sys.exit(1)

    # s = sys.argv[1].split(":", 1)
    # server = s[0]
    # if len(s) == 2:
    # try:
    # port = int(s[1])
    # except ValueError:
    # print("Error: Erroneous port.")
    # sys.exit(1)
    # else:
    # port = 6667
    # channel = sys.argv[2]
    # nickname = sys.argv[3]
    # password = sys.argv[4]
    try:
        with open("config.json", encoding="utf-8") as f:
            config = json.loads(f.read())
            for k in [
                    "server", "port", "password", "channel", "nickname",
                    "prefix", "swears", "dbip", "dbname", "dbuser", "dbpass"
            ]:
                a = config[k]
    except:
        print("VALAMI NEM JÓ A config.json FÁJLBAN:")
        traceback.print_exc()
        exit()

    bot = TestBot(config)
    bot.start()
Beispiel #26
0
def main():
    import sys
    if len(sys.argv) != 4:
        print("Usage: " + inspect.getfile(inspect.currentframe()) + " <server[:port]> <channel> <nickname>")
        sys.exit(1)

    s = sys.argv[1].split(":", 1)
    server = s[0]
    if len(s) == 2:
        try:
            port = int(s[1])
        except ValueError:
            print("Error: Erroneous port.")
            sys.exit(1)
    else:
        port = 6667
    channel = sys.argv[2]
    nickname = sys.argv[3]
    print("Server, channel and nickname set.")

    code = ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for _ in range(24))
    print("Self-destruct code generated")


    bot = ChatBot(code, channel, nickname, server, port)
    print("Bot set, connecting...")
    bot.start()
Beispiel #27
0
def main():
    server = args.s
    port = args.p
    nick = args.n
    password = args.w
    user = args.u
    chans = args.c
    global bot

    if args.ssl:
        print("using ssl")
        ssl_factory = irc.connection.Factory(wrapper=ssl.wrap_socket)
        bot = IRCBot(chans,
                     nick,
                     server,
                     port,
                     password=password,
                     username=user,
                     connect_factory=ssl_factory)
    else:
        bot = IRCBot(chans,
                     nick,
                     server,
                     port,
                     password=password,
                     username=user)
    signal.signal(signal.SIGTERM, sig_handler)
    signal.signal(signal.SIGINT, sig_handler)
    if args.v:
        print("Connecting to server")
    bot.start()
Beispiel #28
0
def main():
  import sys
  if len(sys.argv) != 5:
    print("Usage: docbot <server[:port]> <channel> <nickname> <database>")
    sys.exit(1)

  database = sys.argv[4]
  db_init()
  reload_specs()

  s = sys.argv[1].split(":", 1)
  server = s[0]
  if len(s) == 2:
    try:
      port = int(s[1])
    except ValueError:
      print("Bad port")
      sys.exit(1)
  else:
    port = 6667
  chan = sys.argv[2]
  nick = sys.argv[3]
  database = sys.argv[4]
  
  bot = DocBot(chan, nick, server, port)
  bot.start()
Beispiel #29
0
def main():
    parser = argparse.ArgumentParser(
        description='Simple reimplementation of Quakenet\'s fishbot.')
    parser.add_argument('host', help='adress of the IRC server to connect to')
    parser.add_argument('-p', help='port of the IRC server ')
    parser.add_argument('nickname', help='nickname used by the bot')
    parser.add_argument(
        'channels',
        help=
        'list of channels to join without leading #. Example: "channel1,channel2" '
    )
    parser.add_argument('-o', help='optional OAuth token')

    args = parser.parse_args()

    token = ''
    if args.o:
        token = args.o

    channels = args.channels.split(',')
    port = 6667

    if args.p:
        port = args.p

    bot = FishBot(args.nickname, channels, args.host, port, oauth_token=token)
    bot.start()
Beispiel #30
0
def main():
    global bt, ml, bot
    bt = Bugtracker()
    bt.update_history()
    bot = TestBot()
    bot.recurring(poll_interval * 60, polling)
    bot.start()
Beispiel #31
0
def main():
    # TODO: pull most info here from config file
    debug = False # TODO: get from cmdline arg
    import sys
    if len(sys.argv) != 4:
        print("Usage: votebot <server[:port]> <channel>")
        sys.exit(1)
    print(sys.argv)
    sargs = sys.argv[1].split(":", 1)
    server = sargs[0]
    if len(sargs) == 2:
        try:
            port = int(sargs[1])
        except ValueError:
            print("Error: Erroneous port.")
            sys.exit(1)
    else:
        port = 6667
    channel = sys.argv[2]

    bot = VoteBot(channel, server, port)
    if not debug:
        while True:
            try:
                bot.start()
            except Exception as err:
                print("error!")
                print(err)
                print("restarting")
    else:
        bot.start()
Beispiel #32
0
def main():
    # Read in configuration
    full_config = read_config("./config/config.yaml")
    global commands
    commands = full_config["commands"]
    config = full_config["config"]

    # IRC settings
    irc_channel = config["irc_channel"]
    irc_nickname = config["irc_nickname"]
    irc_server = config["irc_server"]
    irc_port = config["irc_port"]

    # MQTT settings
    global mqtt_host
    global mqtt_port
    global mqtt_client_id
    global mqtt_username
    global mqtt_password
    mqtt_host = config["mqtt_host"]
    mqtt_port = config["mqtt_port"]
    mqtt_client_id = config["mqtt_client_id"]
    mqtt_username = config["mqtt_username"]
    mqtt_password = config["mqtt_password"]

    bot = ListenerBot(
        irc_channel,
        irc_nickname,
        irc_server,
        irc_port,
    )
    bot.start()
Beispiel #33
0
def main():

    # Set up logging
    logging.basicConfig(
        format='[%(asctime)s] %(levelname)s: %(message)s',
        level=logging.INFO
    )
    logging.info("Megatron bootup sequence initiated")

    # Setup the Markov chain
    with open(MARKOV_CORPUS_FILE) as f:
        text = f.read()
    text_model = markovify.Text(text)

    # Initialize the bot
    bot = MegatronBot(
        IRC_SERVER, IRC_PORT, IRC_CHANNEL, IRC_NICKNAME, text_model
    )
    watcher = NationWatcher(bot)
    bot.add_handler('watch', watcher.register)
    bot.add_handler('unwatch', watcher.unregister)
    bot.add_handler('list', watcher.list)
    bot.add_handler('see', see_nation)
    bot.add_handler('help', lambda b, c, n, a: b.connection.privmsg(
        c,
        "Commands: !help, !watch, !unwatch, !list, !see"
    ))

    # Run the bot
    logging.info("Megatron bootup sequence finished")
    bot.start()
Beispiel #34
0
def main():

    #Search for the book.
    #input "c" will cancel the search and go straight to the convert process.
    #input "q" will end the program.
    #if no nickname is set, you can choose a nickname, doesnt really matter though. scout is currently set.

    global nickname
    searchterm = ""
    if len(sys.argv) == 3:
        searchterm = sys.argv[1]
        nickname = sys.argv[2]
    else:
        searchterm = input("Search:\n")
        if searchterm == "c":
            print("\nSkip Search. Converting.\n")
            time.sleep(2)
            ebook.run_convert()
            ebook.send_it()
            quit()
        if searchterm == "q":
            quit()
        if nickname == "":
            nickname = input("Enter Nickname:\n")
    server = "irc.irchighway.net"
    port = 6667
    channel = "#ebooks"
    bot = TestBot(searchterm, channel, nickname, server, port)
    bot.start()
Beispiel #35
0
def main():
    if len(sys.argv) > 1:
        name = sys.argv[1].lower()
        bot = RoboBoboBot(name)
    else:
        bot = RoboBoboBot()
    bot.start()
Beispiel #36
0
def main(args):
	import yaml
	import argparse

	parser = argparse.ArgumentParser()
	parser.add_argument('-c','--config',default='config.yaml')
	parser.add_argument('-l','--log-level',type=int,default=0)
	opts = parser.parse_args(args)

	logger.setLevel(opts.log_level)

	with open(opts.config,'rb') as fp:
		config = yaml.load(fp)

	server, port = config.get('host','irc.twitch.tv:6667').split(':',1)
	port = int(port)

	bot = HiBot(
		config['nickname'],
		config['channels'],
		config.get('nickalias'),
		config.get('password'),
		server,
		port,
		config.get('greet_timeout',3600),
		config.get('greet_delay',3),
		config.get('greet_delay_random',3),
		config.get('proxyusers',{'ytchat'}))
	bot.start()
Beispiel #37
0
def _main():
    config = ConfigParser.ConfigParser({'server_password': None})
    config.read(sys.argv[1])
    setup_logging(config)

    fp = config.get('ircbot', 'channel_config')
    if fp:
        fp = os.path.expanduser(fp)
        if not os.path.exists(fp):
            raise Exception("Unable to read layout config file at %s" % fp)
    else:
        raise Exception("Channel Config must be specified in config file.")

    channel_config = ChannelConfig(yaml.load(open(fp)))

    bot = RecheckWatchBot(channel_config.channels,
                          config.get('ircbot', 'nick'),
                          config.get('ircbot', 'pass'),
                          config.get('ircbot', 'server'),
                          config.getint('ircbot', 'port'),
                          config.get('ircbot', 'server_password'))
    recheck = RecheckWatch(bot, channel_config, config.get('gerrit', 'user'))

    recheck.start()
    bot.start()
Beispiel #38
0
def main(args):
	import yaml
	import argparse

	parser = argparse.ArgumentParser()
	parser.add_argument('-c','--config',default='config.yaml')
	parser.add_argument('-l','--log-level',type=int,default=0)
	opts = parser.parse_args(args)

	logger.setLevel(opts.log_level)

	with open(opts.config,'rb') as fp:
		config = yaml.load(fp)

	server, port = config.get('host','irc.twitch.tv:6667').split(':',1)
	port = int(port)

	connection = sqlite3.connect(config.get('quotes','quotes.db'))
	try:
		connection.create_function('rank', 1, rank)

		bot = QuoteBot(
			config['nickname'],
			config['channels'],
			connection.cursor(),
			config.get('password'),
			server,
			port,
			config.get('min_score', 0),
			config.get('reply_with_next_line', False),
			config.get('react_to_messages', True))
		bot.start()
	finally:
		connection.close()
Beispiel #39
0
def main():

    args = get_args()
    irc.logging.setup(args)

    bot = BogBot(args.channel, args.nickname, args.realname, args.server, args.port)
    bot.start()
Beispiel #40
0
def main():
	import sys
	if len(sys.argv) != 4 and len(sys.argv) != 5:
		print("Only python3 or higher")
		print("Usage: python3 Imouto.py <server[:port]> <channel> <nickname> [configpath]")
		print("Remember to escape \"#\" by typing \"\#\"")
		sys.exit(1)

	s = sys.argv[1].split(":", 1)
	server = s[0]
	if len(s) == 2:
		try:
			port = int(s[1])
		except ValueError:
			print("Error: Erroneous port")
			sys.exit(1)
	else:
		port = 6667
	channel = sys.argv[2]
	nickname = sys.argv[3]
	configpath = ""
	if len(sys.argv) == 4:
		path = os.path.dirname(os.path.realpath(__file__))
		configpath = path + "/config.ini"
	else:
		configpath = sys.argv[4]
	bot = Imouto(channel, nickname, server, configpath, port)
	bot.start()
Beispiel #41
0
def main():
    bot = TRRCBot(_channel, _nickname, _password, _server, _port)
    t = threading.Timer(10, announce_show, (bot,))
    t.daemon = True
    t.start()
    print(u'Timer started.')
    bot.start()
Beispiel #42
0
def _main():
    config = ConfigParser.ConfigParser({'server_password': None})
    config.read(sys.argv[1])
    setup_logging(config)

    fp = config.get('ircbot', 'channel_config')
    if fp:
        fp = os.path.expanduser(fp)
        if not os.path.exists(fp):
            raise Exception("Unable to read layout config file at %s" % fp)
    else:
        raise Exception("Channel Config must be specified in config file.")

    channel_config = ChannelConfig(yaml.load(open(fp)))

    bot = GerritBot(channel_config.channels, config.get('ircbot', 'nick'),
                    config.get('ircbot', 'pass'),
                    config.get('ircbot', 'server'),
                    config.getint('ircbot', 'port'),
                    config.get('ircbot', 'server_password'))
    g = Gerrit(bot, channel_config, config.get('gerrit', 'host'),
               config.get('gerrit', 'user'), config.getint('gerrit', 'port'),
               config.get('gerrit', 'key'))
    g.start()
    bot.start()
Beispiel #43
0
def main():
  import sys
  if len(sys.argv) < 4:
    print("Usage: testbot <server[:port]> <channel> <nickname> [debug]")
    sys.exit(1)
  
  """
    Commandline arg parsing
  """
  s = sys.argv[1].split(":", 1)
  server = s[0]
  if len(s) == 2:
    try:
      port = int(s[1])
    except ValueError:
      print("Error: Erroneous port.")
      sys.exit(1)
  else:
    port = 6667
  channels = sys.argv[2].split(",")
  nickname = sys.argv[3]
  debug = len(sys.argv) >= 5


  """
    Logging setup
  """
  botlogger = logging.getLogger('RatBotLogger')
  sysloghandler = logging.handlers.SysLogHandler('/dev/log')
  sysloghandler.setFormatter(logging.Formatter('ratbot %(levelname)s: %(message)s'))
  botlogger.addHandler(sysloghandler)

  if debug:
    botlogger.setLevel(logging.DEBUG)
    stderrhandler = logging.StreamHandler()
    stderrhandler.setFormatter(logging.Formatter('ratbot %(levelname)s: %(message)s'))
    botlogger.addHandler(stderrhandler)
    botlib.systemsearch.DEBUG = True
  else:
    botlogger.setLevel(logging.INFO)

  """
    This loop keeps spawning a new bot if an unhandled exception occurs or the bot exits after setting the reset flag
  """
  bot = None
  while True:
    try:
      bot = TestBot(channels, nickname, server, port, debug)
      bot.start()
    except KeyboardInterrupt as e:
      raise
    except SystemExit:
      if bot.reset is None or bot.reset:
        botlogger.debug("Continuing")
        continue
      else:
        break
    except:
      botlogger.exception("Thrown")
Beispiel #44
0
def main():
        args = parser.parse_args()
        channel = args.channel
        nick = args.nick
        host = args.host
        port = args.port
        bot = Bot(channel, nick, host, port)
        bot.start()
Beispiel #45
0
def main():
    server = "chat.freenode.net"
    port = 6667
    channels = ["#vidyadev", "##agdg"]
    filters = ["bro-bot-indev", "bro-bot", "AGDGBot", "Clobot"]
    owners = ["unaffiliated/morgawr", "unaffiliated/kuraitou"]
    bot = VidyaBot(channels, "VidyaLink", server, port, owners, filters)
    bot.start()
Beispiel #46
0
def main():
    username = "******"
    client_id = "saxy6rk8qyaj31s5h2sxkujauwsr7c"
    token = "oauth:k31tvibwb9i8fquqcctxos4wdj81td"
    channel = "serpent_ai"

    bot = TwitchBot(username, client_id, token, channel)
    bot.start()
Beispiel #47
0
def main():
    server = 'chat.freenode.net'
    port = 6667
    channel = '#tcxpl-bureau'
    nickname = 'Gniewomir'

    bot = TcxBot(channel, nickname, server, port)
    bot.start()
Beispiel #48
0
def main():
    username  = "******"
    client_id = "foo"
    token     = "bar"
    channel   = "jerma985"

    bot = TwitchBot(username, client_id, token, channel)
    bot.start()
Beispiel #49
0
def main():
    server = 'chat.freenode.net'
    port = 6667
    channel = '#tcxpl-bureau'
    nickname = 'Gniewomir'

    bot = TcxBot(channel, nickname, server, port)
    bot.start()
Beispiel #50
0
def main():
    username = '******'
    client_id = '0ecb43trffudcqwxflq1k13ivl9rlv'
    token = 'utxgm9i6s8z3goc2xwmsglc1rbk09q'
    channel = 'xjavathehutt'

    bot = TwitchBot(username, client_id, token, channel)
    bot.start()
Beispiel #51
0
def main():

    args = get_args()
    irc.logging.setup(args)

    bot = BogBot(args.channel, args.nickname, args.realname, args.server,
                 args.port)
    bot.start()
def main():
    nickname = os.getenv("BOT_NICKNAME")
    server = "irc.ppy.sh"
    port = 6667

    spec = ServerSpec(server, port, os.getenv("BOT_PASSWORD"))
    bot = BookmarksBot(nickname, spec)
    bot.start()
Beispiel #53
0
def main(video_queue):
    username = config.c_username
    client_id = config.c_client_id
    token = config.c_token
    channel = config.c_channel

    bot = TwitchBot(username, client_id, token, channel, video_queue)
    bot.start()
Beispiel #54
0
def main():
    server = "irc.rizon.net"
    channel = "#NIBL"
    nickname = "Niblette"
    port = 6667

    bot = Niblette(channel, nickname, server, port)
    bot.start()
Beispiel #55
0
def main():
    server = "jacobly.com"
    port = 10000
    channels = "#icedev"
    nickname = "ICEbot/EFnet"

    bot = IceBot(channels, nickname, server, port)
    bot.start()
Beispiel #56
0
def main():
    channel = config.prebot.get("channel")
    nick = config.prebot.get("nick")
    server = config.prebot.get("server")
    port = config.prebot.get("port")

    log.info("Pre: Bot Nick - {}".format(nick))
    bot = TestBot(channel, nick, server, port)
    bot.start()
Beispiel #57
0
def StartBot():
    server = "irc.twitch.tv"
    port = 6667
    channel = "#twitchplaysdark"
    nickname = "thebagmaster"
    # thebagmaster oauth:fe20g2udsuh4fj3lo939a4531ggg1y
    # TPD_BanHammer oauth:mfnv3lmqg0fii1iuivp4s1o8x5woaj
    bot = Bot(channel, nickname, server, port)
    bot.start()
Beispiel #58
0
def notify_irc(*msgs):
    bot = TestBot(channel, nickname, server)
    if isinstance(msgs, str):
        msgs = [msgs]
    bot.msgs = msgs
    try:
        bot.start()
    except SystemExit:
        print 'exiting'