Exemple #1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-v", "--verbose", action="count", default=0)
    args = parser.parse_args()

    level = logging.NOTSET if args.verbose >= 1 else logging.WARNING
    logging.basicConfig(format="[%(levelname)s] %(name)s: %(message)s", level=level)

    config = read_config()
    username = config["username"]
    password = config["password"]
    site = f'https://{config["wiki"]}.fandom.com/'
    bot = ChatBot(username, password, site, socketio_logger=args.verbose >= 2)
    bot.add_plugins(
        HelpPlugin(),
        AdminPlugin(),
        LogPlugin(),
        SeenPlugin(),
        TellPlugin(),
        HelloPlugin(),
        XOPlugin(),
        TwitterPlugin(),
    )
    if config.get("youtube"):
        bot.add_plugin(YouTubePlugin(config["youtube"]))
    try:
        bot.start()
    except ClientError as e:
        logging.critical(str(e))
        sys.exit(1)
Exemple #2
0
def main():
    bot = ChatBot(botUser, botPass, server=server, ssl=False)
    bot.debug = False

    def onLogin(data):
        bot.getUsers()
        bot.getGroups()
        bot.getChannels()
        bot.createChannel(CHANNEL_PLAYER)
        bot.createPrivateChat(CHANNEL_WOLF)
        removeWolves(bot)

    bot.client.on('logged_in', onLogin)

    bot.addPrefixHandler('wolf', makeMeWolf)
    bot.addPrefixHandler('addall', addall)
    bot.addPrefixHandler('list', listPlayers)

    bot.addPrefixHandler('rules', showHelp)
    bot.addPrefixHandler('help', showHelp)
    bot.addPrefixHandler('Rules', showHelp)
    bot.addPrefixHandler('Help', showHelp)

    bot.addPrefixHandler('Join', addPlayers)
    bot.addPrefixHandler('join', addPlayers)

    bot.addPrefixHandler('Go', setup)
    bot.addPrefixHandler('go', setup)

    bot.addPrefixHandler('Reset', resetGame)
    bot.addPrefixHandler('reset', resetGame)
    bot.addPrefixHandler('Restart', resetGame)
    bot.addPrefixHandler('restart', resetGame)

    bot.addPrefixHandler('Bite', killVictim)
    bot.addPrefixHandler('bite', killVictim)

    bot.addPrefixHandler('Hang', hangSuspect)
    bot.addPrefixHandler('hang', hangSuspect)

    bot.start()