Example #1
0
def _initialize(bot):
    api_key = bot.get_config_option('forecast_api_key')
    if api_key:
        _internal['forecast_api_key'] = api_key
        plugins.register_user_command(['forecast'])
    else:
        logger.info('not enabled, need forecast.io API key in config["forecast_api_key"]')
Example #2
0
def _initialise(bot):
    # unbreak slackrtm memory.json usage
    #   previously, this plugin wrote into "user_data" key to store its internal team settings
    _slackrtm_conversations_migrate_20170319(bot)

    # Start and asyncio event loop
    loop = asyncio.get_event_loop()
    slack_sink = bot.get_config_option('slackrtm')
    threads = []
    if isinstance(slack_sink, list):
        for sinkConfig in slack_sink:
            # start up slack listener in a separate thread
            t = SlackRTMThread(bot, loop, sinkConfig)
            t.daemon = True
            t.start()
            t.isFullyLoaded.wait()
            threads.append(t)
    logger.info("%d sink thread(s) started", len(threads))

    plugins.register_handler(_handle_membership_change, type="membership")
    plugins.register_handler(_handle_rename, type="rename")

    plugins.register_admin_command([
        "slacks", "slack_channels", "slack_listsyncs", "slack_syncto",
        "slack_disconnect", "slack_setsyncjoinmsgs", "slack_setimageupload",
        "slack_sethotag", "slack_users", "slack_setslacktag",
        "slack_showslackrealnames", "slack_showhorealnames"
    ])

    plugins.register_user_command(["slack_identify"])

    plugins.start_asyncio_task(_wait_until_unloaded).add_done_callback(
        _plugin_unloaded)
Example #3
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)
Example #4
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.get("bot.command_aliases")
    else:
        myself = bot.user_self()
        # basic
        bot_command_aliases = ["/bot", "/trashcan", "/dumpster", "/trash"]
        # /<first name fragment>
        first_fragment = myself["full_name"].split()[0].lower()
        if first_fragment and 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 len(bot_command_aliases) == 0:
        bot.append("/bot")

    bot._handlers.bot_command = bot_command_aliases
    logger.info("aliases: {}".format(bot_command_aliases))

    plugins.register_user_command(["botalias"])

    return []
Example #5
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.get("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 and 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 len(bot_command_aliases) == 0:
        bot.append("/bot")

    bot._handlers.bot_command = bot_command_aliases
    print(_("bot aliases: {}").format(bot_command_aliases))

    plugins.register_user_command(["botalias"])

    return []
Example #6
0
def _initialise(bot):
    global EXTSMTPUSER,EXTSMTPPWD,EXTSMTPSERVER,EXTSMTPPORT,INTSMTPADDRESS,INTSMTPPORT
    global CAMMAILCID
    global ALARMSYSURL,ALARMSYSUSR,ALARMSYSPWD,ALARMNOTURL,ALARMSUBJECTFORMAT,ALARMSYSOFFREGEXP
    global CAMPWD,CAMUSR,CAMURLS
    try:
        EXTSMTPUSER       = bot.get_config_option("extsmtpuser") or None
        EXTSMTPPWD        = bot.get_config_option("extsmtppwd") or None
        EXTSMTPSERVER     = bot.get_config_option("extsmtpserver") or "smtp.gmail.com"
        EXTSMTPPORT       = bot.get_config_option("extsmtpport") or "587"
        INTSMTPADDRESS    = bot.get_config_option("intsmtpaddress") or socket.gethostname()
        INTSMTPPORT       = int(bot.get_config_option("intsmtpport") or "10025")
        CAMMAILCID        = bot.get_config_option("cammailCID") or None
        ALARMSYSURL       = bot.get_config_option("alarmsysurl") or None
        ALARMSYSUSR       = bot.get_config_option("alarmsysusr") or None
        ALARMSYSPWD       = bot.get_config_option("alarmsyspwd") or None
        ALARMNOTURL       = bot.get_config_option("alarmnoturl") or None
        ALARMSYSOFFREGEXP = re.compile(bot.get_config_option("alarmsysoffregexp")) or None
        s = bot.get_config_option("alarmsubjectformat") or { "regexp": r"(.*) (.*)( .*)*", "locationindex": 2 }
        ALARMSUBJECTFORMAT= { "regexp" : re.compile(s["regexp"]), "locationindex": s["locationindex"] }
        CAMPWD            = bot.get_config_option("campwd") or None
        CAMUSR            = bot.get_config_option("camusr") or None
        CAMURLS           = bot.get_config_option("camurls") or {}
    except: logger.exception("missing config file entry")
    logger.info("using ALARMSUBJECTFORMAT: " + str(ALARMSUBJECTFORMAT)) 
    global mybot 
    mybot = bot
    # spawn a separate thread for the mail server
    # hoping asyncore and asyncio do not fight
    t = threading.Thread(target = smtpthread)
    t.daemon = True
    t.start()
    plugins.register_user_command(["interceptCamMail"])
    plugins.register_handler(_handle_incoming_message, type="message")
Example #7
0
def _initialise(bot):
    apikey = bot.get_config_option("wolframalpha-apikey")
    if apikey:
        _internal["client"] = wolframalpha.Client(apikey)
        plugins.register_user_command(["ask"])
    else:
        logger.error('WOLFRAMALPHA: config["wolframalpha-apikey"] required')
Example #8
0
def _initialize(bot):
    api_key = bot.get_config_option('forecast_api_key')
    if api_key:
        _internal['forecast_api_key'] = api_key
        plugins.register_user_command(['weather'])
    else:
        logger.error('WEATHER: config["forecast_api_key"] required')
Example #9
0
def _initialise(bot):
    apikey = bot.get_config_option("wolframalpha-apikey")
    if apikey:
        _internal["client"] = wolframalpha.Client(apikey)
        plugins.register_user_command(["ask"])
    else:
        print(_("WOLFRAMALPHA: config.wolframalpha-apikey required"))
Example #10
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)
Example #11
0
def _initialise():
    plugins.register_user_command('quote')
    conn = sqlite3.connect('bot.db')
    c = conn.cursor()
    c.execute("CREATE TABLE IF NOT EXISTS quotes (author TEXT, quote TEXT, id INTEGER PRIMARY KEY AUTOINCREMENT)")
    c.execute("CREATE TABLE IF NOT EXISTS unapp_quotes (author TEXT, quote TEXT, id INTEGER PRIMARY KEY AUTOINCREMENT)")   
    conn.commit()
    conn.close()
Example #12
0
def _initialise(bot):
    load()
    plugins.register_handler(_handle_bad_words, type='message')
    plugins.register_handler(_handle_bad_names, type='rename')
    plugins.register_handler(_handle_toxicity, type='message')
    plugins.register_user_command(['language', 'lastword', 'analyze'])
    plugins.register_admin_command(['langadd', 'langdel', 'langload'])
    plugins.register_user_command(['koby'])
Example #13
0
def _initialize(bot):
    api_key = bot.get_config_option('forecast_api_key')
    if api_key:
        _internal['forecast_api_key'] = api_key
        plugins.register_user_command(['weather', 'forecast'])
        plugins.register_admin_command(['setweatherlocation'])
    else:
        logger.error('WEATHER: config["forecast_api_key"] required')
Example #14
0
def _initialise(bot):
    api_key = bot.get_config_option('openweathermap_apikey')
    geocode_key = bot.get_config_option('geocode_key')
    if api_key:
        _internal['openweathermap_apikey'] = api_key
    if geocode_key:
        _internal['geocode_key'] = geocode_key
    plugins.register_user_command(["wz"])
    plugins.register_user_command(["forecast"])
Example #15
0
def _initialise(bot):
    plugins.register_user_command(["tldr"])
    plugins.register_admin_command(["tldrecho"])
    bot.register_shared("plugin_tldr_shared", tldr_shared)

    # Set the global option
    if not bot.get_config_option('tldr_echo'):
        bot.config.set_by_path(["tldr_echo"], 1) # tldr_echo_options[1] is "GROUP"
        bot.config.save()
Example #16
0
def _initialise(bot):

    giphy_api_key = bot.get_config_option("giphy-apikey")

    if giphy_api_key:
        plugins.register_user_command(['giphy'])
        _conf['giphy_api_key'] = giphy_api_key
    else:
        print(_("GIPHY: config.giphy-apikey required"))
Example #17
0
def _initialise(bot):

    pr_repos = bot.get_config_option('pr_repos')

    if pr_repos:
        plugins.register_user_command(['prs'])
        _conf['pr_repos'] = pr_repos
    else:
        print('PRS: config.pr_repos required')
Example #18
0
def _initialise(bot):
    plugins.register_user_command(["tldr"])
    plugins.register_admin_command(["tldrecho"])
    bot.register_shared("plugin_tldr_shared", tldr_shared)

    # Set the global option
    if not bot.get_config_option('tldr_echo'):
        bot.config.set_by_path(["tldr_echo"], 1) # tldr_echo_options[1] is "GROUP"
        bot.config.save()
Example #19
0
def _initialise(bot):

    giphy_api_key = bot.get_config_option("giphy-apikey")

    if giphy_api_key:
        plugins.register_user_command(['giphy'])
        _conf['giphy_api_key'] = giphy_api_key
    else:
        print(_("GIPHY: config.giphy-apikey required"))
Example #20
0
def _initialise(bot):
    _start_slack_sinks(bot)

    plugins.register_handler(_broadcast, type="sending")
    plugins.register_handler(_repeat, type="allmessages")

    return []

    plugins.register_user_command(["slackusers"])
Example #21
0
File: prs.py Project: luciany/icbot
def _initialise(bot):

    pr_repos = bot.get_config_option('pr_repos')

    if pr_repos:
        plugins.register_user_command(['prs'])
        _conf['pr_repos'] = pr_repos
    else:
        print('PRS: config.pr_repos required')
Example #22
0
def _initialise(bot):
    _start_slack_sinks(bot)

    plugins.register_handler(_broadcast, type="sending")
    plugins.register_handler(_repeat, type="allmessages")

    return []

    plugins.register_user_command(["slackusers"])
Example #23
0
def _initialise(bot):
    appid = bot.get_config_option("oxforddict-appid")
    apikey = bot.get_config_option("oxforddict-apikey")
    if appid and apikey:
        _internal["client"] = OxfordDictionaries(appid, apikey)
        plugins.register_user_command(["define", "synonym", "antonym"])
    else:
        logger.error(
            'Dictionary: config["oxforddict-appid"] and config["oxforddict-apikey"] required'
        )
def _initialise(bot):
##    plugins.register_user_command(["sl","how","walk","portals","hacking","resonators",\
##                                   "xmp","keys","linking","fielding","defensemods",\
##                                   "hackmods","linkamps","leveling","mu","cubes",\
##                                   "farming","terms","virus","placement",\
##                                   "campfire","ultrastrikes","anomaly",\
##                                   "smartfarming","capsules","mufg","softbank",\
##                                   "store", "lawson"])
    plugins.register_user_command(["sl"])
    return []
Example #25
0
def _initialise(bot):
    global config, api
    config = bot.get_config_option("gcal")
    if not config or "secrets" not in config:
        logger.error("gcal: missing path to secrets file")
        return
    store = Storage(config["secrets"])
    http = store.get().authorize(Http())
    api = build("calendar", "v3", http=http).events()
    plugins.register_user_command(["calendar"])
Example #26
0
def _initialise(bot):
    plugins.register_user_command(["possequote"])
    api_user = bot.get_config_option('posseapi_user')
    api_pass = bot.get_config_option('posseapi_pass')
    api_url = bot.get_config_option('posseapi_url')
    if api_user:
        _internal['posseapi_user'] = api_user
    if api_pass:
        _internal['posseapi_pass'] = api_pass
    if api_url:
        _internal['posseapi_url'] = api_url
Example #27
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')
Example #28
0
def _initialise(bot):
    dev_key = bot.get_config_option("google-customsearch-devkey")
    _internal["cx"] = bot.get_config_option("google-customsearch-cx")
    if dev_key and _internal["cx"]:
        _internal["service"] = build("customsearch",
                                     "v1",
                                     developerKey=dev_key)
        plugins.register_user_command(["s", "g", "r"])
    else:
        _internal["service"] = None
        logger.error(
            'GOOGLE_SEARCH: config["google-customsearch-devkey"] and config["google-customsearch-cx"] required'
        )
Example #29
0
def _initialise(bot):
    convert_legacy_config(bot)
    plugins.register_user_command(["slack_identify"])
    plugins.register_admin_command(["slack_sync", "slack_unsync"])
    root = bot.get_config_option("slackrtm") or {}
    Base.bot = bot
    for team, config in root.get("teams", {}).items():
        Base.add_slack(Slack(team, config["token"]))
    for sync in root.get("syncs", []):
        Base.add_bridge(BridgeInstance(bot, "slackrtm", sync))
    for slack in Base.slacks.values():
        slack.start()
    plugins.register_handler(on_membership_change, type="membership")
Example #30
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))
def _initialise(bot):
  plugins.register_admin_command(["clearpokedex"])
  plugins.register_user_command(["pokedex", "pokemon"])

  global pokedex_config
  try:
    pokedex_config = bot.get_config_option('pokedex') or {}
  except:
    logger.error('Unable to load pokedex configuration - default configuration will apply.')
  
  try:
    if not pokedex_config['info']:
      pokedex_config['info'] = ['types']
  except KeyError:
    pokedex_config['info'] = ['types']
Example #32
0
def _initialise(Handlers, bot=None):
    admin_commands = ["broadcast", "users", "user", "hangouts", "hangout", "rename", "leave", "reload", "quit", "config", "whereami"]
    user_commands = ["echo", "echoparsed", "whoami"]
    try:
        plugins.register_admin_command(admin_commands)
        plugins.register_user_command(user_commands)
    except Exception as e:
        if "register_admin_command" in dir(Handlers) and "register_user_command" in dir(Handlers):
            print(_("DEFAULT: LEGACY FRAMEWORK MODE"))
            Handlers.register_admin_command(admin_commands)
            Handlers.register_user_command(user_commands)
        else:
            print(_("DEFAULT: OBSOLETE FRAMEWORK MODE"))
            return admin_commands + user_commands
    return []
def _initialise(bot):
    plugins.register_admin_command(["clearpokedex"])
    plugins.register_user_command(["pokedex", "pokemon"])

    global pokedex_config
    try:
        pokedex_config = bot.get_config_option('pokedex') or {}
    except:
        logger.error(
            'Unable to load pokedex configuration - default configuration will apply.'
        )

    try:
        if not pokedex_config['info']:
            pokedex_config['info'] = ['types']
    except KeyError:
        pokedex_config['info'] = ['types']
Example #34
0
def _initialise(bot):
    if not _telesync_config(bot):
        return

    if not bot.memory.exists(['telesync']):
        bot.memory.set_by_path(['telesync'], {'ho2tg': {}, 'tg2ho': {}})
        bot.memory.save()

    if not bot.memory.exists(['profilesync']):
        bot.memory.set_by_path(['profilesync'], {'ho2tg': {}, 'tg2ho': {}})
        bot.memory.save()

    global client_session
    global tg_bot
    global tg_loop

    client_session = aiohttp.ClientSession()

    tg_bot = TelegramBot(bot)

    tg_bot.set_on_message_callback(tg_on_message)
    tg_bot.set_on_photo_callback(tg_on_photo)
    tg_bot.set_on_sticker_callback(tg_on_sticker)
    tg_bot.set_on_user_join_callback(tg_on_user_join)
    tg_bot.set_on_user_leave_callback(tg_on_user_leave)
    tg_bot.set_on_location_share_callback(tg_on_location_share)
    tg_bot.set_on_supergroup_upgrade_callback(tg_on_supergroup_upgrade)
    tg_bot.add_command("/whoami", tg_command_whoami)
    tg_bot.add_command("/whereami", tg_command_whereami)
    tg_bot.add_command("/setsyncho", tg_command_set_sync_ho)
    tg_bot.add_command("/clearsyncho", tg_command_clear_sync_ho)
    tg_bot.add_command("/addadmin", tg_command_add_bot_admin)
    tg_bot.add_command("/removeadmin", tg_command_remove_bot_admin)
    tg_bot.add_command("/syncprofile", tg_command_sync_profile)
    tg_bot.add_command("/unsyncprofile", tg_command_unsync_profile)
    tg_bot.add_command("/getme", tg_command_get_me)

    tg_loop = MessageLoop(tg_bot)

    plugins.start_asyncio_task(tg_loop.run_forever())
    plugins.start_asyncio_task(tg_bot.setup_bot_info())

    plugins.register_admin_command(["telesync"])
    plugins.register_user_command(["syncprofile"])

    plugins.register_handler(_on_membership_change, type="membership")
Example #35
0
def _initialise(bot):
    global EXTSMTPUSER, EXTSMTPPWD, EXTSMTPSERVER, EXTSMTPPORT, INTSMTPADDRESS, INTSMTPPORT
    global CAMMAILCID
    global ALARMSYSURL, ALARMSYSUSR, ALARMSYSPWD, ALARMNOTURL, ALARMSUBJECTFORMAT, ALARMSYSOFFREGEXP
    global CAMPWD, CAMUSR, CAMURLS
    try:
        EXTSMTPUSER = bot.config.get_option("extsmtpuser") or None
        EXTSMTPPWD = bot.config.get_option("extsmtppwd") or None
        EXTSMTPSERVER = bot.config.get_option(
            "extsmtpserver") or "smtp.gmail.com"
        EXTSMTPPORT = bot.config.get_option("extsmtpport") or "587"
        INTSMTPADDRESS = bot.config.get_option(
            "intsmtpaddress") or socket.gethostname()
        INTSMTPPORT = int(bot.config.get_option("intsmtpport") or "10025")
        CAMMAILCID = bot.config.get_option("cammailCID") or None
        ALARMSYSURL = bot.config.get_option("alarmsysurl") or None
        ALARMSYSUSR = bot.config.get_option("alarmsysusr") or None
        ALARMSYSPWD = bot.config.get_option("alarmsyspwd") or None
        ALARMNOTURL = bot.config.get_option("alarmnoturl") or None
        ALARMSYSOFFREGEXP = re.compile(
            str(bot.config.get_option("alarmsysoffregexp"))) or None
        s = bot.config.get_option("alarmsubjectformat") or {
            "regexp": r"(.*) (.*)( .*)*",
            "locationindex": 2
        }
        ALARMSUBJECTFORMAT = {
            "regexp": re.compile(s["regexp"]),
            "locationindex": s["locationindex"]
        }
        CAMPWD = bot.config.get_option("campwd") or None
        CAMUSR = bot.config.get_option("camusr") or None
        CAMURLS = bot.config.get_option("camurls") or {}
    except:
        logger.exception("missing config file entry")
        return
    logger.info("using ALARMSUBJECTFORMAT: " + str(ALARMSUBJECTFORMAT))
    global mybot
    mybot = bot
    # spawn a separate thread for the mail server
    # hoping asyncore and asyncio do not fight
    t = threading.Thread(target=smtpthread)
    t.daemon = True
    t.start()
    plugins.register_user_command(["interceptCamMail"])
    plugins.register_handler(_handle_incoming_message, type="message")
Example #36
0
def initialise(bot):
    plugins.register_user_command(["filmrec"], ["filmrate"])
    plugins.register_admin_command(['filmload'])

    if not bot.memory.exists(['filmrec']):
        print("INITIALIZING")
        bot.memory.set_by_path(['filmrec'], {})
        with open("ratings.csv") as csvfile:
            rateread = csv.reader(csvfile)
            for row in rateread:
                ratings[str(row[0])][row[1]] = row[2]
 
        with open("movies.csv") as csvfile:
            filmread = csv.reader(csvfile)
            for row in filmread:
                movies[str(row[0])] = row[1]
        bot.memory.get_by_path(['filmrec'])["ratings"] = ratings
        bot.memory.get_by_path(['filmrec'])["movies"] = movies
Example #37
0
def _initialise(bot):
    global _bot, client
    _bot = bot
    token = bot.get_config_option('discord_token')
    if not token:
        logger.error("discord_token not set")
        return

    plugins.register_handler(_handle_hangout_message, type="allmessages")
    plugins.register_user_command(["dusers"])
    plugins.register_admin_command(['dsync', 'discordfwd','discordfwdfilter'])

    try:
        client.run(token)
    except RuntimeError:
        # client.run will try start an event loop, however this will fail as hangoutsbot will have already started one
        # this isn't anything to worry about
        pass
Example #38
0
def _initialize(bot):
    global tz_def
    
    # Read configuration information and initialize accordingly.
    plugin_conf = bot.config.get_by_path(["timeme"])
    
    if not plugin_conf:
        plugin_conf = {"default_tz": [0, 0]}
        bot.config.set_by_path(["timeme"], plugin_conf)
        bot.config.save()
    
    default_tz = plugin_conf["default_tz"]
    tz_def = timezone(timedelta(hours=default_tz[0], minutes=default_tz[1]))

    # Debugging information, for sanity's sake.
    logger.info("Default timezone offset: {}".format(tz_def))

    # Command registration protocols
    plugins.register_handler(_handle_timeme_action, type="message")
    plugins.register_user_command(["timeme"])
Example #39
0
def _initialise(bot):
    if not _telesync_config(bot):
        return

    if not bot.memory.exists(['telesync']):
        bot.memory.set_by_path(['telesync'], {'ho2tg': {}, 'tg2ho': {}})
        bot.memory.save()

    if not bot.memory.exists(['profilesync']):
        bot.memory.set_by_path(['profilesync'], {'ho2tg': {}, 'tg2ho': {}})
        bot.memory.save()

    global tg_bot

    tg_bot = TelegramBot(bot)

    tg_bot.set_on_message_callback(tg_on_message)
    tg_bot.set_on_photo_callback(tg_on_photo)
    tg_bot.set_on_sticker_callback(tg_on_sticker)
    tg_bot.set_on_user_join_callback(tg_on_user_join)
    tg_bot.set_on_user_leave_callback(tg_on_user_leave)
    tg_bot.set_on_location_share_callback(tg_on_location_share)
    tg_bot.set_on_supergroup_upgrade_callback(tg_on_supergroup_upgrade)
    tg_bot.add_command("/whoami", tg_command_whoami)
    tg_bot.add_command("/whereami", tg_command_whereami)
    tg_bot.add_command("/setsyncho", tg_command_set_sync_ho)
    tg_bot.add_command("/clearsyncho", tg_command_clear_sync_ho)
    tg_bot.add_command("/addadmin", tg_command_add_bot_admin)
    tg_bot.add_command("/removeadmin", tg_command_remove_bot_admin)
    tg_bot.add_command("/tldr", tg_command_tldr)
    tg_bot.add_command("/syncprofile", tg_command_sync_profile)
    tg_bot.add_command("/unsyncprofile", tg_command_unsync_profile)
    tg_bot.add_command("/getme", tg_command_get_me)

    plugins.start_asyncio_task(tg_bot.message_loop(timeout=50))
    plugins.start_asyncio_task(tg_bot.setup_bot_info())

    plugins.register_admin_command(["telesync"])
    plugins.register_user_command(["syncprofile"])

    plugins.register_handler(_on_membership_change, type="membership")
Example #40
0
def _initialise(bot):
    # unbreak slackrtm memory.json usage
    #   previously, this plugin wrote into "user_data" key to store its internal team settings
    _slackrtm_conversations_migrate_20170319(bot)

    # Start and asyncio event loop
    loop = asyncio.get_event_loop()
    slack_sink = bot.get_config_option('slackrtm')
    threads = []
    if isinstance(slack_sink, list):
        for sinkConfig in slack_sink:
            # start up slack listener in a separate thread
            t = SlackRTMThread(bot, loop, sinkConfig)
            t.daemon = True
            t.start()
            t.isFullyLoaded.wait()
            threads.append(t)
    logger.info("%d sink thread(s) started", len(threads))

    plugins.register_handler(_handle_membership_change, type="membership")
    plugins.register_handler(_handle_rename, type="rename")

    plugins.register_admin_command([ "slacks",
                                     "slack_channels",
                                     "slack_listsyncs",
                                     "slack_syncto",
                                     "slack_disconnect",
                                     "slack_setsyncjoinmsgs",
                                     "slack_setimageupload",
                                     "slack_sethotag",
                                     "slack_users",
                                     "slack_setslacktag",
                                     "slack_showslackrealnames",
                                     "slack_showhorealnames" ])

    plugins.register_user_command([ "slack_identify" ])

    plugins.start_asyncio_task(_wait_until_unloaded).add_done_callback(_plugin_unloaded)
Example #41
0
def _initialise(bot):
    plugins.register_user_command(["ask"])
Example #42
0
def _initialise(bot):
    plugins.register_handler(_handle_incoming_message, type="message")
    plugins.register_user_command(["chat"])
    plugins.register_handler(_scan_for_triggers)
Example #43
0
def _initialise(bot):
    _migrate_mention_config_to_memory(bot)
    plugins.register_handler(_handle_mention, "message")
    plugins.register_user_command(
        ["pushbulletapi", "setnickname", "bemorespecific"])
    plugins.register_admin_command(["mention"])
Example #44
0
def _initialise(bot):
  plugins.register_user_command(["news"])
Example #45
0
def _initialise(bot):
    plugins.register_handler(_handle_incoming_message, type="message")
    plugins.register_user_command(["chat"])
def _initialise():
    plugins.register_user_command(["celebrate"])
Example #47
0
def _initialise(bot):
    plugins.register_user_command(["mixme", "illhaveone"])
    bot.register_shared("mixme.here", get_one_here)
Example #48
0
def _initialise(bot):
    _migrate_mention_config_to_memory(bot)
    plugins.register_handler(_handle_mention, "message")
    plugins.register_user_command(["pushbulletapi", "setnickname", "bemorespecific"])
    plugins.register_admin_command(["mention"])
Example #49
0
def _initialise(bot):
    plugins.register_admin_command(["broadcast", "users", "user", "hangouts", "rename", "leave", "reload", "quit", "config", "whereami"])
    plugins.register_user_command(["echo", "whoami"])
Example #50
0
def _initialise(bot):
    plugins.register_user_command(["urbandict"])
Example #51
0
def initialise(bot):
    plugins.register_user_command(["remindme","remindall"])
Example #52
0
def _initialise(bot):
  plugins.register_user_command(["compliment"])
Example #53
0
def _initialise(bot):
    plugins.register_user_command(["screen", "coc"])
    plugins.register_admin_command(["setlog", "clearlog"])
Example #54
0
def _initialise():
    plugins.register_handler(_handle_keyword)
    plugins.register_user_command(["subscribe", "unsubscribe"])
Example #55
0
def _initialise():
    plugins.register_handler(_handle_keyword)
    plugins.register_user_command(["subscribe", "unsubscribe"])
Example #56
0
def _initialise(bot):
    _start_slack_sinks(bot)
    plugins.register_handler(_handle_slackout)
    plugins.register_user_command(["slackusers"])
def _initialise(bot):
    plugins.register_admin_command(["invite"])
    plugins.register_user_command(["rsvp"])
    plugins.register_handler(_issue_invite_on_exit, type="membership")