def init(): global state global initdone state = PlugState() state.define('urls', {}) initdone = True return 1
import os import logging import uuid import time import io import gzip import urllib.request, urllib.parse, urllib.error ## defines cfg = PersistConfig() cfg.define("enable", 0) cfg.define("sleep", 5) state = PlugState() state.define("ids", {}) state.define("seen", []) state.define("names", {}) state.define("watch", []) teller = 0 dostop = False ## plugin init def init_threaded(): try: if cfg.enable: sync() ; scan() except URLNotEnabled: logging.error("URL fetching is not enabled")
from tl.lib.commands import cmnds from tl.lib.examples import examples from tl.lib.callbacks import first_callbacks from tl.lib.morphs import outputmorphs from tl.lib.persiststate import PlugState from tl.utils.lazydict import LazyDict ## basic imports import re import logging ## defines state = PlugState() state.define("colormapping", {}) ## the morph def docolormorph(txt, event): """ add the color to the txt. """ if not txt: return txt if event and not event.bottype == "irc": return txt splitted = txt.split() for s in splitted: for t, color in state.data.colormapping.items(): try: c = int(color) except: logging.warn("color - %s is not a digit" % color) ; continue if c < 0: d = "00" elif c < 9: d = "0%s" % c
from tl.imports import getjson json = getjson() ## basic imports import os import logging import uuid ## defines cfg = PersistConfig() cfg.define("enable", 0) state = PlugState() state.define("ids", {}) state.define("seen", {}) teller = 0 ## getplus function def getplus(target): credentials = import_byfile("credentials", getdatadir() + os.sep + "config" + os.sep + "credentials.py") url = "https://www.googleapis.com/plus/v1/people/%s/activities/public?alt=json&pp=1&key=%s" % (target, credentials.googleclient_apikey) result = geturl2(url) data = json.loads(result) res = [] for item in data['items']: i = LazyDict(item)