예제 #1
0
파일: shorten.py 프로젝트: Jakeable/Ralybot
def expand(text):
    """<url> - unshortens <url>"""
    args = text.split()
    url = args[0]

    try:
        return web.expand(url)
    except web.ServiceError as e:
        return e.message
예제 #2
0
파일: shorten.py 프로젝트: Jakeable/Ralybot
def gitio(text):
    """<url> [custom] - shortens a github URL <url> using git.io with [custom] as an optional custom shortlink,
    or unshortens <url> if already short"""
    args = text.split()
    url = args[0]
    custom = args[1] if len(args) > 1 else None

    try:
        if 'git.io' in url:
            return web.expand(url, 'git.io')
        else:
            return web.shorten(url, custom, 'git.io')
    except web.ServiceError as e:
        return e.message
예제 #3
0
파일: shorten.py 프로젝트: Jakeable/Ralybot
def isgd(text):
    """<url> [custom] - shortens a url using is.gd with [custom] as an optional custom shortlink,
    or unshortens <url> if already short"""
    args = text.split()
    url = args[0]
    custom = args[1] if len(args) > 1 else None

    try:
        if 'is.gd' in url:
            return web.expand(url, 'is.gd')
        else:
            return web.shorten(url, custom, 'is.gd')
    except web.ServiceError as e:
        return e.message