예제 #1
0
파일: url.py 프로젝트: buzzworkers/tl
def init():
    global state
    global initdone
    state = PlugState()
    state.define('urls', {})
    initdone = True
    return 1
예제 #2
0
파일: overflow.py 프로젝트: buzzworkers/tl
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")
예제 #3
0
파일: colors.py 프로젝트: buzzworkers/tl
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
예제 #4
0
파일: plus.py 프로젝트: buzzworkers/tl
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)