コード例 #1
0

@bot.on(admin_cmd(pattern="anime(?: |$)(.*)"))
@bot.on(sudo_cmd(pattern="anime(?: |$)(.*)", allow_sudo=True))
async def nope(kraken):
    hell = kraken.pattern_match.group(1)
    if not hell:
        if kraken.is_reply:
            (await kraken.get_reply_message()).message
        else:
            await edit_or_reply(
                kraken,
                "`Sir please give some query to search and download it for you..!`"
            )
            return

    troll = await bot.inline_query("animedb_bot", f"{(deEmojify(hell))}")

    await troll[0].click(
        kraken.chat_id,
        reply_to=kraken.reply_to_msg_id,
        silent=True if kraken.is_reply else False,
        hide_via=True,
    )
    await kraken.delete()


CmdHelp("anime").add_command(
    "anime", "<anime name>",
    "Searches for the given anime and sends the details.").add()
コード例 #2
0

CmdHelp("tools").add_command(
    "xkcd", "<query>", "Searches for the query for the relevant XKCD comic"
).add_command(
    "color", "<color code>", "Sends you a plain image of the color",
    ".color #ff0000"
).add_command(
    "ifsc", "<IFSC code>",
    "Helps to get details of the relevant bank or branch", ".ifsc SBIN0016086"
).add_command(
    "currencies", None, "Shows you the some list of currencies"
).add_command(
    "currency", "<amount> <from> <to>", "Currency converter for HellBot",
    ".currency 10 usd inr"
).add_command(
    "cal", "<year ; month>", "Shows you the calendar of given month and year"
).add_command(
    "decode", "<reply to barcode/qrcode>",
    "To get decoded content of those codes."
).add_command(
    "barcode", "<content>", "Make a BarCode from the given content.",
    ".barcode www.google.com"
).add_command(
    "makeqr", "<content>", "Make a Qrcode from the given content.",
    ".makeqr www.google.com"
).add_command(
    "scan", "<reply to media or file>",
    "It scans the media or file and checks either any virus is in the file or media"
).add()
コード例 #3
0
ファイル: anime_dl.py プロジェクト: utkarsh542/Vader
    args = event.pattern_match.group(1)
    if not args:
        await event.edit("`Enter anime name`")
        return
    chat = -1001499176427
    current_chat = event.chat_id
    current_msg = event.id
    try:
        async for event in event.client.iter_messages(chat,
                                                      search=args,
                                                      limit=1):
            await bot.forward_messages(current_chat, event)
    except:
        await event.reply("`Anime not found. Make sure you give correct name`")
        return
    await event.client.delete_messages(current_chat, current_msg)


CmdHelp("anime_dl").add_command(
    "animehub", "<anime name>",
    "Gives the download link of searched anime. Note that search query should be perfectly spelled. Check .anilist <anime name> to get info about that anime and their perfect spelling"
).add_command(
    "ganime", "<anime name>",
    "Gives the download link of searched anime in GDrive. If <.animehub> fails try this."
).add_command(
    "animedl", "<anime name>",
    "Gives the download link of searched anime in telegram channels link. Easy to download links."
).add_command("ecchi", "<anime name>",
              "Gives the download link of searched ecchi anime.").add_info(
                  "Anime Downloader").add()
コード例 #4
0
async def _(event):
    if event.fwd_from:
        return
    await eor(event, "Restarting **[ ░░░ ]** ...\nType `.ping` to check if I am working...")
    await eor(event, "Restarting **[ █░░ ]** ...\nType `.ping` to check if I am working...")
    await eor(event, "Restarting **[ ██░ ]** ...\nType `.ping` to check if I am working...")
    await eor(event, "Restarting **[ ███ ]** ...\nType `.ping` to check if I am working...")
    await eor(event, "Restarted  **[  ✓  ]** ...\nType `.ping` to check if I am working...")
    await bot.disconnect()
    os.execl(sys.executable, sys.executable, *sys.argv)
    quit()

@bot.on(admin_cmd(pattern="shutdown$"))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("**[ ! ]** `Turning off bot now ... Manually turn me on later` ಠ_ಠ")
    if HEROKU_APP is not None:
        HEROKU_APP.process_formation()["userbot"].scale(0)
    else:
        sys.exit(0)


CmdHelp("power_tools").add_command(
  "restart", None, "Restarts your userbot. Redtarting Bot may result in better functioning of bot when its laggy"
).add_command(
  "shutdown", None, "Turns off Dynos of Userbot. Userbot will stop working unless you manually turn it on from heroku"
).add_info(
  "Power Switch For Bot"
).add()
コード例 #5
0
ファイル: qr_img.py プロジェクト: ilmacoder/Vader
    tx = event.pattern_match.group(1)
    r = await event.get_reply_message()
    if not (tx and r and r.media):
        return await eor(event, "reply to image and Give Text")
    await eor(event, "processing")
    d = await bot.download_media(r.media)
    out = "hellbot.png"
    qr_img.watermark_qr(event, d, tx, out)
    await bot.send_file(event.chat_id, out, force_document=False)
    await event.delete()


@bot.on(admin_cmd(pattern="qrdecode$"))
@bot.on(sudo_cmd(pattern="qrdecode$", allow_sudo=True))
async def _(event):
    r = await event.get_reply_message()
    if not (r and r.media):
        return await eor(event, "reply to image and Give Text")
    await eor(event, "processing")
    image = await bot.download_media(r.media)
    tx = qr_img.qr_decode(image)
    await eor(event, "Decoded Text:\n\n" + tx)


CmdHelp("qr_img").add_command(
    "qrimg", "<reply to a image> <text>",
    "Makes a qrcode with that image").add_command(
        "qrmark", "<reply to image> <text>",
        "Draws a qr code on the replied image").add_command(
            "qrdecode", "<reply to image> <text>",
            "Decodes the value of replied qr code").add_info("QR Codes").add()
コード例 #6
0
ファイル: memify.py プロジェクト: ilmacoder/Vader
                ),
                text=l_text,
                font=m_font,
                fill=(0, 0, 0),
            )
            draw.text(
                xy=(
                    (i_width - u_width) / 2,
                    i_height - u_height - int((20 / 640) * i_width),
                ),
                text=l_text,
                font=m_font,
                fill=(255, 255, 255),
            )
            current_h += u_height + pad

    lumd = "badass.png"
    img.save(lumd, "png")
    return lumd


CmdHelp("memify").add_command(
    "mmf", "<reply to a img/stcr/gif> <upper text> ; <lower text>",
    "Memifies the replied image/gif/sticker with your text and sends output in sticker format.",
    "mmf <reply to a img/stcr/gif> hii ; hello"
).add_command(
    "mms", "<reply to a img/stcr/gif> <upper text> ; <lower text>",
    "Memifies the replied image/gif/sticker with your text and sends output in image format.",
    "mms <reply to a img/stcr/gif> hii ; hello").add_info(
        "Make Memes on telegram 😉").add()
コード例 #7
0
                FileNotFoundError) as exc:
            await edit_or_reply(event, str(exc))
            # continue sending required_file_name
        else:
            os.remove(required_file_name)
            required_file_name = required_file_name + ".opus"
        end = datetime.now()
        ms = (end - start).seconds
        await borg.send_file(
            event.chat_id,
            required_file_name,
            # caption="Processed {} ({}) in {} seconds!".format(text[0:97], lan, ms),
            reply_to=event.message.reply_to_msg_id,
            allow_cache=False,
            voice_note=True,
        )
        os.remove(required_file_name)
        await edit_or_reply(
            event,
            "Processed {} ({}) in {} seconds!".format(text[0:97], lan, ms))
        await asyncio.sleep(5)
        await event.delete()
    except Exception as e:
        await edit_or_reply(event, str(e))


CmdHelp("text_to_speech").add_command(
    "txts", "<reply to text>/<text>",
    "Google Text To Speech Module. Alternetive for Voice module. Use .voice if this doesn't work"
).add_command("voice", "<reply to text>/<text>", "Same shit..").add()
コード例 #8
0
                asyncio.get_event_loop().create_task(
                    deploy_start(bot, message, HEROKU_GIT_REF_SPEC, remote))

            else:
                await message.edit(
                    "Config var `HEROKU_APP_NAME` not found. Please set it from Heroku Site..."
                )
                return
        else:
            await message.edit(NO_HEROKU_APP_CFGD)
    else:
        await message.edit(
            "Var `HEROKU_API_KEY` is either empty or incorrect values are filled."
        )


async def deploy_start(tgbot, message, refspec, remote):
    await message.edit(RESTARTING_APP)
    await message.edit(
        "Updated your Hêllẞø† successfully sur!!!\n\nNow type .ping after 5 mins to check if I'm on🚶😏\n"
    )
    await remote.push(refspec=refspec)
    await tgbot.disconnect()
    os.execl(sys.executable, sys.executable, *sys.argv)


CmdHelp("updater").add_command(
    'update', None,
    'Checks if the bot is up-to-date or not. Also, Updates your bot to new codes if any else Force updates bot.'
).add()
コード例 #9
0
ファイル: fun_img.py プロジェクト: ilmacoder/Vader
    c1 = vcam(H=H, W=W)
    plane = meshGen(H, W)
    plane.Z += 20 * np.exp(-0.5 * (
        (plane.X * 1.0 / plane.W) / 0.1)**2) / (0.1 * np.sqrt(2 * np.pi))
    pts3d = plane.getPlane()
    pts2d = c1.project(pts3d)
    map_x, map_y = c1.getMaps(pts2d)
    output = cv2.remap(img,
                       map_x,
                       map_y,
                       interpolation=cv2.INTER_LINEAR,
                       borderMode=0)
    output = cv2.flip(output, 1)
    out1 = cv2.resize(output, (700, 350))
    cv2.imwrite(file_name, out1)
    await bot.send_file(event.chat_id, file_name)
    for files in (hehe, lol):
        if files and os.path.exists(files):
            os.remove(files)
    hoi = await event.delete()


CmdHelp("fun_img").add_command(
    "funimg", "<reply to a img/stcr>",
    "Edits the replied image or sticker to a 3-D Box like image.").add_command(
        "funimg2", "<reply to a img/stcr>",
        "Edits the replied image or sticker to a funny image. `#Must_Try` !!"
    ).add_command(
        "funimg3", "<reply to a img/stcr>",
        "Edits the replied image or sticker to a funny image. `#Must_Try` !!"
    ).add_info("Funs are here boiz").add()
コード例 #10
0
import urllib.request
from bs4 import BeautifulSoup
from hellbot.utils import admin_cmd, edit_or_reply as eor, sudo_cmd
from hellbot.cmdhelp import CmdHelp


@bot.on(admin_cmd(pattern="cs$"))
@bot.on(sudo_cmd(pattern="cs$", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    score_page = "http://static.cricinfo.com/rss/livescores.xml"
    page = urllib.request.urlopen(score_page)
    soup = BeautifulSoup(page, "html.parser")
    result = soup.find_all("description")
    Sed = ""
    for match in result:
        Sed += match.get_text() + "\n\n"
    await event.edit(
        f"<b><u>Match information gathered successful</b></u>\n\n\n<code>{Sed}</code>",
        parse_mode="HTML",
    )


CmdHelp("cricket").add_command(
    "cs", None, "Collects all the live cricket scores.").add_info(
        "Cricket Kheloge Vro?").add()