Exemple #1
0
def _initialise(bot):
    """load in bot aliases from memory, create defaults if none"""

    if bot.memory.exists(["bot.command_aliases"]):
        bot_command_aliases = bot.memory["bot.command_aliases"]
    else:
        myself = bot.user_self()
        # basic
        bot_command_aliases = ["/bot"]

        # /<first name fragment>
        first_fragment = myself["full_name"].split()[0].lower()
        if first_fragment != "unknown":
            alias_firstname = "/" + first_fragment
            bot_command_aliases.append(alias_firstname)

        # /<chat_id>
        bot_command_aliases.append("/" + myself["chat_id"])

        bot.memory.set_by_path(["bot.command_aliases"], bot_command_aliases)
        bot.memory.save()

    if not isinstance(bot_command_aliases, list):
        bot_command_aliases = []

    if not bot_command_aliases:
        bot.append("/bot")

    bot._handlers.bot_command = bot_command_aliases
    logger.info("aliases: %s", bot_command_aliases)

    plugins.register_user_command(["botalias"])
    plugins.register_help(HELP)
Exemple #2
0
def _initialise():
    """register the commands and their help entrys"""
    plugins.register_admin_command([
        "broadcast", "users", "user", "hangouts", "rename", "leave", "reload",
        "quit", "config", "whereami"
    ])
    plugins.register_user_command(["echo", "whoami"])
    plugins.register_help(HELP)
Exemple #3
0
def _initalize(bot):
    """register the showme command if sources are configured in config

    Args:
        bot: HangupsBot instance
    """
    if bot.config.get_option("showme") is not None:
        plugins.register_user_command(["showme"])
        plugins.register_help(HELP, "showme")
    else:
        logger.info('SHOWME: config["showme"] dict required')
Exemple #4
0
def _initialise(bot):
    """register the commands and help, shareds on the aliases

    Args:
        bot: HangupsBot instance
    """
    bot.memory.validate({'hoalias': {}})

    plugins.register_user_command(['gethoalias'])
    plugins.register_admin_command(['sethoalias'])
    plugins.register_help(HELP)

    plugins.register_shared('convid2alias', functools.partial(get_alias, bot))
    plugins.register_shared('alias2convid', functools.partial(get_convid, bot))
Exemple #5
0
def _initialise():
    """register the commands and their help entrys"""
    plugins.register_user_command(["remindme", "remindall"])
    plugins.register_help(HELP)
Exemple #6
0
def _initialise():
    """register the message handler, commands and the help entrys"""
    plugins.register_handler(_handle_me_action)
    plugins.register_user_command(["diceroll", "coinflip"])
    plugins.register_help(HELP)
Exemple #7
0
def _initialise():
    """register commands and their user help"""
    plugins.register_admin_command(["addme", "addusers", "createconversation",
                                    "refresh", "kick", "realkick"])
    plugins.register_help(HELP)