Exemplo n.º 1
0
async def magik(image, intensity):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=magik&image={image}&intensity={intensity}"
    ).json()
    season4 = r.get("message")
    miraculous = url(season4)
    if not miraculous:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(season4).content)
    img = Image.open("temp.png").convert("RGB")
    img.save("temp.webp", "webp")
    return "temp.webp"
Exemplo n.º 2
0
async def whowouldwin(link1, link2):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=whowouldwin&user1={link1}&user2={link2}"
    ).json()
    season4 = r.get("message")
    miraculous = url(season4)
    if not miraculous:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(season4).content)
    img = Image.open("temp.png").convert("RGB")
    img.save("temp.webp", "webp")
    return "temp.webp"
Exemplo n.º 3
0
async def trash(text):
    r = requests.get(f"https://nekobot.xyz/api/imagegen?type=trash&url={text}").json()
    legendx22 = r.get("message")
    hellurl = url(legendx22)
    if not hellurl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(legendx22).content)
    img = Image.open("temp.png")
    if img.mode != "RGB":
        img = img.convert("RGB")
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 4
0
async def ddlc(character, background, body, face, text):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=ddlc&character={character}&background={background}&body={body}&face={face}&text={text}"
    ).json()
    season4 = r.get("message")
    miraculous = url(season4)
    if not miraculous:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(season4).content)
    img = Image.open("temp.png").convert("RGB")
    img.save("temp.webp", "webp")
    return "temp.webp"
Exemplo n.º 5
0
async def kannagen(text):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=kannagen&text={text}"
    ).json()
    wew = r.get("message")
    hburl = url(wew)
    if not hburl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(wew).content)
    img = Image.open("temp.png").convert("RGB")
    img.save("temp.webp", "webp")
    return "temp.webp"
Exemplo n.º 6
0
async def threats(text):
    r = requests.get(f"https://nekobot.xyz/api/imagegen?type=threats&url={text}").json()
    skylord = r.get("message")
    skyurl = url(skylord)
    if not skyurl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(skylord).content)
    img = Image.open("temp.png")
    if img.mode != "RGB":
        img = img.convert("RGB")
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 7
0
async def moditweet(text):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=tweet&text={text}&username=narendramodi"
    ).json()
    lucky = r.get("message")
    triggerurl = url(lucky)
    if not triggerurl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(lucky).content)
    img = Image.open("temp.png").convert("RGB")
    img.save("temp.webp", "webp")
    return "temp.webp"
Exemplo n.º 8
0
async def tweets(text1, text2):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=tweet&text={text1}&username={text2}"
    ).json()
    geng = r.get("message")
    kapak = url(geng)
    if not kapak:
        return "check syntax once more"
    with open("gpx.png", "wb") as f:
        f.write(requests.get(geng).content)
    img = Image.open("gpx.png").convert("RGB")
    img.save("gpx.webp", "webp")
    return "gpx.webp"
Exemplo n.º 9
0
async def changemymind(text):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=changemymind&text={text}"
    ).json()
    wew = r.get("message")
    lapnlboturl = url(wew)
    if not lapnlboturl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(wew).content)
    img = Image.open("temp.png").convert("RGB")
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 10
0
async def changemymind(text):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=changemymind&text={text}"
    ).json()
    geng = r.get("message")
    kapak = url(geng)
    if not kapak:
        return "check syntax once more"
    with open("gpx.png", "wb") as f:
        f.write(requests.get(geng).content)
    img = Image.open("gpx.png").convert("RGB")
    img.save("gpx.jpg", "jpeg")
    return "gpx.jpg"
Exemplo n.º 11
0
async def dani(text):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=tweet&text={text}&username=dani_daniels___"
    ).json()
    wew = r.get("message")
    hburl = url(wew)
    if not hburl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(wew).content)
    img = Image.open("temp.png").convert("RGB")
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 12
0
async def phss(uplded, input, name):
    web = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=phcomment&image={uplded}&text={input}&username={name}"
    ).json()
    alf = web.get("message")
    uri = url(alf)
    if not uri:
        return "check syntax once more"
    with open("alf.png", "wb") as f:
        f.write(requests.get(alf).content)
    img = Image.open("alf.png").convert("RGB")
    img.save("alf.webp", "webp")
    return "alf.webp"
Exemplo n.º 13
0
async def awooify(text):
    r = requests.get(f"https://nekobot.xyz/api/imagegen?type=awooify&url={text}").json()
    sandy = r.get("message")
    caturl = url(sandy)
    if not caturl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(sandy).content)
    img = Image.open("temp.png")
    if img.mode != "RGB":
        img = img.convert("RGB")
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 14
0
async def tweets(text1, text2):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=tweet&text={text1}&username={text2}"
    ).json()
    sandy = r.get("message")
    caturl = url(sandy)
    if not caturl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(sandy).content)
    img = Image.open("temp.png").convert("RGB")
    img.save("temp.webp", "webp")
    return "temp.webp"
Exemplo n.º 15
0
async def _(event):
    "shortens the given link"
    input_str = "".join(event.text.split(maxsplit=1)[1:])
    reply = await event.get_reply_message()
    if not input_str and reply:
        input_str = reply.text
    if not input_str:
        return await edit_delete(
            event, "`Either reply to link or give link as input to get data`",
            5)
    check = url(input_str)
    if not check:
        catstr = f"http://{input_str}"
        check = url(catstr)
    if not check:
        return await edit_delete(event, "`the given link is not supported`", 5)
    if not input_str.startswith("http"):
        input_str = f"http://{input_str}"
    sample_url = f"https://da.gd/s?url={input_str}"
    if response_api := requests.get(sample_url).text:
        await edit_or_reply(event,
                            f"Generated {response_api} for {input_str}.",
                            link_preview=False)
Exemplo n.º 16
0
async def lolice(text):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=lolice&url={text}").json()
    aura = r.get("message")
    W2Hurl = url(aura)
    if not W2Hurl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(aura).content)
    img = Image.open("temp.png")
    if img.mode != "RGB":
        img = img.convert("RGB")
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 17
0
async def trash(text):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=trash&url={text}").json()
    sammy = r.get("message")
    wolfurl = url(sammy)
    if not wolfurl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(sammy).content)
    img = Image.open("temp.png")
    if img.mode != 'RGB':
        img = img.convert('RGB')
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 18
0
async def phcomment(text1, text2, text3):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=phcomment&image={text1}&text={text2}&username={text3}").json()
    sandy = r.get("message")
    caturl = url(sandy)
    if not caturl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(sandy).content)
    img = Image.open("temp.png")
    if img.mode != 'RGB':
        img = img.convert('RGB')
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 19
0
async def awooify(text):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=awooify&url={text}").json()
    bristol = r.get("message")
    exelonurl = url(bristol)
    if not exelonurl:
        return "sözdizimini bir kez daha kontrol et"
    with open("temp.png", "wb") as f:
        f.write(requests.get(bristol).content)
    img = Image.open("temp.png")
    if img.mode != 'RGB':
        img = img.convert('RGB')
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 20
0
async def _tweets(text: str, username: str = '', type_: str = "tweet") -> None:
    api_url = f"https://nekobot.xyz/api/imagegen?type={type_}&text={_deEmojify(text)}"
    if username:
        api_url += f"&username={_deEmojify(username)}"
    res = requests.get(api_url).json()
    tweets_ = res.get("message")
    if not url(tweets_):
        return "```Invalid Syntax, Exiting...```"
    tmp_file = Config.DOWN_PATH + "temp.png"
    with open(tmp_file, "wb") as t_f:
        t_f.write(requests.get(tweets_).content)
    img = Image.open(tmp_file)
    img.save(CONVERTED_IMG)
    img.save(CONVERTED_STIKR)
    os.remove(tmp_file)
Exemplo n.º 21
0
async def trap(text1, text2, text3):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=trap&name={text1}&author={text2}&image={text3}"
    ).json()
    kraken = r.get("message")
    hellurl = url(kraken)
    if not hellurl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(kraken).content)
    img = Image.open("temp.png")
    if img.mode != "RGB":
        img = img.convert("RGB")
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 22
0
async def _(event):
    "To get Domain Name System(dns) of the given link."
    input_str = "".join(event.text.split(maxsplit=1)[1:])
    reply = await event.get_reply_message()
    if not input_str and reply:
        input_str = reply.text
    if not input_str:
        return await edit_delete(
            event, "`Either reply to link or give link as input to get data`",
            5)
    check = url(input_str)
    if not check:
        catstr = "http://" + input_str
        check = url(catstr)
    if not check:
        return await edit_delete(event, "`the given link is not supported`", 5)
    sample_url = f"https://da.gd/dns/{input_str}"
    response_api = requests.get(sample_url).text
    if response_api:
        await edit_or_reply(
            event, f"DNS records of {input_str} are \n{response_api}")
    else:
        await edit_or_reply(
            event, f"__I can't seem to find `{input_str}` on the internet__")
Exemplo n.º 23
0
async def phcomment(text1, text2, text3):
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=phcomment&image={text1}&text={text2}&username={text3}"
    ).json()
    h1m4n5hu0p = r.get("message")
    PETERCORDurl = url(h1m4n5hu0p)
    if not PETERCORDurl:
        return "check syntax once more"
    with open("temp.png", "wb") as f:
        f.write(requests.get(h1m4n5hu0p).content)
    img = Image.open("temp.png")
    if img.mode != "RGB":
        img = img.convert("RGB")
    img.save("temp.jpg", "jpeg")
    return "temp.jpg"
Exemplo n.º 24
0
async def ultd(event):
    ureply = await event.get_reply_message()
    xx = await eor(event, "`...`")
    if not (ureply and (ureply.media)):
        await xx.edit("`Reply to any media`")
        return
    ultt = await ureply.download_media()
    if ultt.endswith(".tgs"):
        await xx.edit("`Ooo Animated Sticker 👀...`")
        cmd = ["lottie_convert.py", ultt, "ult.png"]
        file = "ult.png"
        process = await asyncio.create_subprocess_exec(
            *cmd,
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE,
        )
        stdout, stderr = await process.communicate()
        stderr.decode().strip()
        stdout.decode().strip()
    else:
        await xx.edit("`Processing...`")
        img = cv2.VideoCapture(ultt)
        heh, lol = img.read()
        cv2.imwrite("ult.png", lol)
        file = "ult.png"
    got = upf(file)
    lnk = f"https://telegra.ph{got[0]}"
    r = requests.get(
        f"https://nekobot.xyz/api/imagegen?type=blurpify&image={lnk}",
    ).json()
    ms = r.get("message")
    utd = url(ms)
    if not utd:
        return
    with open("ult.png", "wb") as f:
        f.write(requests.get(ms).content)
    img = Image.open("ult.png").convert("RGB")
    img.save("ult.webp", "webp")
    await event.client.send_file(
        event.chat_id,
        "ult.webp",
        force_document=False,
        reply_to=event.reply_to_msg_id,
    )
    await xx.delete()
    os.remove("ult.png")
    os.remove("ult.webp")
    os.remove(ultt)
Exemplo n.º 25
0
async def bad(event):  # sourcery no-metrics
    "To manage vars in database"
    cmd = event.pattern_match.group(1).lower()
    vname = event.pattern_match.group(2)
    vnlist = "".join(f"{i}. `{each}`\n" for i, each in enumerate(vlist, start=1))
    if not vname:
        return await edit_delete(
            event, f"**📑 Give correct var name from the list :\n\n**{vnlist}", time=60
        )
    vinfo = None
    if " " in vname:
        vname, vinfo = vname.split(" ", 1)
    reply = await event.get_reply_message()
    if not vinfo and reply:
        vinfo = reply.text
    if vname in vlist:
        if vname in oldvars:
            vname = oldvars[vname]
        if cmd == "set":
            if not vinfo:
                return await edit_delete(
                    event, f"Give some values which you want to save for **{vname}**"
                )
            check = vinfo.split(" ")
            for i in check:
                if "PIC" in vname and not url(i):
                    return await edit_delete(event, "**Give me a correct link...**")
            addgvar(vname, vinfo)
            await edit_delete(
                event, f"📑 Value of **{vname}** is changed to :- `{vinfo}`", time=20
            )
        if cmd == "get":
            var_data = gvarstatus(vname)
            await edit_delete(
                event, f"📑 Value of **{vname}** is  `{var_data}`", time=20
            )
        elif cmd == "del":
            delgvar(vname)
            await edit_delete(
                event,
                f"📑 Value of **{vname}** is now deleted & set to default.",
                time=20,
            )
    else:
        await edit_delete(
            event, f"**📑 Give correct var name from the list :\n\n**{vnlist}", time=60
        )
Exemplo n.º 26
0
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    if Config.SCREEN_SHOT_LAYER_ACCESS_KEY is None:
        await edit_or_reply(
            event,
            "Need to get an API key from https://screenshotlayer.com/product \nModule stopping!",
        )
        return
    catevent = await edit_or_reply(event, "Processing ...")
    sample_url = "https://api.screenshotlayer.com/api/capture?access_key={}&url={}&fullpage={}&viewport={}&format={}&force={}"
    input_str = event.pattern_match.group(1)
    caturl = url(input_str)
    if not caturl:
        await catevent.edit("the url must be in the format `https://www.google.com`")
        return
    response_api = requests.get(
        sample_url.format(
            Config.SCREEN_SHOT_LAYER_ACCESS_KEY, input_str, "1", "2560x1440", "PNG", "1"
        )
    )
    # https://stackoverflow.com/a/23718458/4723940
    contentType = response_api.headers["content-type"]
    end = datetime.now()
    ms = (end - start).seconds
    hmm = f"**url : **{input_str} \n**Time :** `{ms} seconds`"
    if "image" in contentType:
        with io.BytesIO(response_api.content) as screenshot_image:
            screenshot_image.name = "screencapture.png"
            try:
                await event.client.send_file(
                    event.chat_id,
                    screenshot_image,
                    caption=hmm,
                    force_document=True,
                    reply_to=event.message.reply_to_msg_id,
                )
                await catevent.delete()
            except Exception as e:
                await catevent.edit(str(e))
    else:
        await catevent.edit(response_api.text)
Exemplo n.º 27
0
def abbrefy():
    # getting the request data
    data = request.get_json()
    # validating the data was sent
    if not data:
        return jsonify({"status": False, "error": "DATA_ERROR"}), 400
    # validating that data sent is a URL
    if not url(data['url']):
        return jsonify({"status": False, "error": "URL_ERROR"}), 400
    # validating that URL isn't already abbrefied
    slug = check_duplicate(data['url'])
    if slug and Link.check_slug(slug):
        return jsonify({"status": False, "error": "DUPLICATE_ERROR"}), 400
    # creating the URL object and abbrefying it
    author = None
    if "current_user" in session:
        author = session['current_user']['public_id']
    new_link = Link(url=data['url'], author=author)
    response = new_link.abbrefy()
    return jsonify(response)
Exemplo n.º 28
0
async def _tweets(msg: Message, text: str, username: str = '', type_: str = "tweet") -> None:
    api_url = f"https://nekobot.xyz/api/imagegen?type={type_}&text={demojify(text)}"
    if username:
        api_url += f"&username={demojify(username)}"
    res = requests.get(api_url).json()
    tweets_ = res.get("message")
    if not url(tweets_):
        await msg.err("Invalid Syntax, Exiting...")
        return
    tmp_file = Config.DOWN_PATH + "temp.png"
    with open(tmp_file, "wb") as t_f:
        t_f.write(requests.get(tweets_).content)
    img = Image.open(tmp_file)
    img.save(CONVERTED_IMG)
    await msg.delete()
    msg_id = msg.reply_to_message.message_id if msg.reply_to_message else None
    await msg.client.send_photo(chat_id=msg.chat.id,
                                photo=CONVERTED_IMG,
                                reply_to_message_id=msg_id)
    os.remove(tmp_file)
    os.remove(CONVERTED_IMG)
Exemplo n.º 29
0
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    if Config.SCREEN_SHOT_LAYER_ACCESS_KEY is None:
        await event.edit(
            "https://screenshotlayer.com/product adresinden bir API anahtarı almanız gerekiyor \nModule stopping!"
        )
        return
    await event.edit("İşleniyor...")
    sample_url = "https://api.screenshotlayer.com/api/capture?access_key={}&url={}&fullpage={}&viewport={}&format={}&force={}"
    input_str = event.pattern_match.group(1)
    exelonurl = url(input_str)
    if not exelonurl:
        await event.edit("url, `https://www.google.com` biçiminde olmalıdır")
        return
    response_api = requests.get(
        sample_url.format(Config.SCREEN_SHOT_LAYER_ACCESS_KEY, input_str, "1",
                          "2560x1440", "PNG", "1"))
    # https://stackoverflow.com/a/23718458/4723940
    contentType = response_api.headers['content-type']
    end = datetime.now()
    ms = (end - start).seconds
    hmm = f"**url : **{input_str} \n**Zaman:** `{ms} saniye`"
    if "image" in contentType:
        with io.BytesIO(response_api.content) as screenshot_image:
            screenshot_image.name = "screencapture.png"
            try:
                await borg.send_file(event.chat_id,
                                     screenshot_image,
                                     caption=hmm,
                                     force_document=True,
                                     reply_to=event.message.reply_to_msg_id)
                await event.delete()
            except Exception as e:
                await event.edit(str(e))
    else:
        await event.edit(response_api.text)
Exemplo n.º 30
0
def publicAbbrefy(user):

    try:
        # getting the request data
        data = request.get_json()
        # validating the data was sent
        if not data:
            return jsonify({"status": False, "error": "DATA_ERROR"}), 400
        # validating that data sent is a URL
        if not url(data['url']):
            return jsonify({"status": False, "error": "URL_ERROR"}), 400
        # validating that URL isn't already abbrefied
        slug = check_duplicate(data['url'])
        if slug and Link.check_slug(slug):
            return jsonify({"status": False, "error": "DUPLICATE_ERROR"}), 400
        # creating the URL object and abbrefying it
        author = user
        new_link = Link(url=data['url'], author=author)
        response = new_link.abbrefy()
        return jsonify(response)

    except KeyError:
        return jsonify({"status": False, "error": "DATA_ERROR"}), 400
Exemplo n.º 31
0
Arquivo: tests.py Projeto: borzecki/q
 def test_proper_url(self):
     for engine, config in self.engines.items():
         for option in config:
             self.assertTrue(url(config[option]), "proper url for engine {0} option {1}".format(engine, option))
Exemplo n.º 32
0
import logging.config
from os import environ

from validators.url import url

from satnogsclient.settings import (SATNOGS_API_TOKEN, DEFAULT_LOGGING, SATNOGS_STATION_ID,
                                    SATNOGS_STATION_LAT, SATNOGS_STATION_LON, SATNOGS_STATION_ELEV,
                                    SATNOGS_NETWORK_API_URL)


# Avoid validation when building docs
if not environ.get('READTHEDOCS', False):
    try:
        url(SATNOGS_NETWORK_API_URL)
    except:
        raise Exception('Invalid SATNOGS_NETWORK_API_URL: {0}'.format(SATNOGS_NETWORK_API_URL))

    if not SATNOGS_STATION_ID:
        raise Exception('SATNOGS_STATION_ID not configured.')

    if not SATNOGS_STATION_LAT:
        raise Exception('SATNOGS_STATION_LAT not configured')

    if not SATNOGS_STATION_LON:
        raise Exception('SATNOGS_STATION_LON not configured')

    if SATNOGS_STATION_ELEV is None:
        raise Exception('SATNOGS_STATION_ELEV not configured')

    if not SATNOGS_API_TOKEN:
        raise Exception('SATNOGS_API_TOKEN not configured')
Exemplo n.º 33
0
import logging.config
from os import environ

from validators.url import url

from satnogsclient.settings import (API_TOKEN, DEFAULT_LOGGING, GROUND_STATION_ID,
                                    GROUND_STATION_LAT, GROUND_STATION_LON, GROUND_STATION_ELEV,
                                    NETWORK_API_URL)


# Avoid validation when building docs
if not environ.get('READTHEDOCS', False):
    try:
        url(NETWORK_API_URL)
    except:
        raise Exception('Invalid NETWORK_API_URL: {0}'.format(NETWORK_API_URL))

    if not GROUND_STATION_ID:
        raise Exception('GROUND_STATION_ID not configured.')

    if not GROUND_STATION_LAT:
        raise Exception('GROUND_STATION_LAT not configured')

    if not GROUND_STATION_LON:
        raise Exception('GROUND_STATION_LON not configured')

    if GROUND_STATION_ELEV is None:
        raise Exception('GROUND_STATION_ELEV not configured')

    if not API_TOKEN:
        raise Exception('API_TOKEN not configured')