コード例 #1
0
        # to make the copy-pasted code work fine
        t = paytext
        # get the string start (1st character)
        ts = t[0]
        # get the string end (last character)
        te = t[-1]
        # get the string middle
        tm = t[1:-1]
        # do 15 times
        for j in range(15):
            # transform the text to previous text without the last character + middle + end
            t = t[:-1] + tm + te
            # edit the message with the new text
            await e.edit(t)

register_module_desc("Memes! This module contains various animations.")
register_cmd_usage("oof", "", "Oooooof")
register_cmd_usage("hmm", "", "Hmmmmmm")
register_cmd_usage("lool", "", "LOOOOOOL")
register_cmd_usage("gay", "", "Gaaaaay")
register_cmd_usage("ree", "", "Reeeeee")
register_cmd_usage("brr", "", "Brrrrrr")
register_cmd_usage("x", "<text to extend, preferrably 3 characters>", "Like the above commands but customizable.")
register_module_info(
    name="Memes - animated",
    authors="githubcatw, @BottomTextBot, Haklerman, help from prototype74",
    version=VERSION
)
_f_='welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
コード例 #2
0
        await event.edit(f"`{result}`")
    except Exception as e:
        log.warning(e)
        await event.edit(msgRep.SYSD_NEOFETCH_REQ)
    return


@ehandler.on(command="sendlog", outgoing=True)
async def send_log(event):
    chat = await event.get_chat()
    await event.edit(msgRep.UPLD_LOG)
    time.sleep(1)
    try:
        await event.client.send_file(chat, "hyper.log")
        await event.edit(msgRep.SUCCESS_UPLD_LOG)
    except Exception as e:
        log.error(f"Failed to upload HyperUBot log file: {e}")
        await event.edit(msgRep.FAILED_UPLD_LOG)
    return


for cmd in ("status", "storage", "shutdown", "reboot", "sysd", "sendlog"):
    register_cmd_usage(cmd,
                       usageRep.SYSTOOLS_USAGE.get(cmd, {}).get("args"),
                       usageRep.SYSTOOLS_USAGE.get(cmd, {}).get("usage"))

register_module_desc(descRep.SYSTOOLS_DESC)
register_module_info(name="System Tools",
                     authors="nunopenim, prototpye74",
                     version=VERSION)
コード例 #3
0
ファイル: messages.py プロジェクト: DrDoubt/HyperUBot
            await event.client.unpin_message(chat.id, msg_id)
            await event.edit(msgRep.UNPIN_SUCCESS)
            log_text = f"{msgRep.LOG_PIN_MSG_ID}: {event.reply_to_msg_id}"
        if LOGGING:
            await event_log(event, "UNPINNED MESSAGES"
                            if all_msgs else "UNPINNED MESSAGE",
                            chat_title=chat.title
                            if hasattr(chat, "title") else None,
                            chat_link=chat.username
                            if hasattr(chat, "username") else None,
                            chat_id=chat.id, custom_text=log_text)
    except ChatAdminRequiredError:
        await event.edit(msgRep.NO_ADMIN)
    except Exception as e:
        log.warning(e)
        await event.edit(msgRep.UNPIN_FAILED)

    return

for cmd in ("msgs", "pin", "unpin"):
    register_cmd_usage(cmd,
                       usageRep.MESSAGES_USAGE.get(cmd, {}).get("args"),
                       usageRep.MESSAGES_USAGE.get(cmd, {}).get("usage"))

register_module_desc(descRep.MESSAGES_DESC)
register_module_info(
    name="Messages",
    authors="nunopenim, prototype74",
    version=VERSION
)
コード例 #4
0
# HyperBot++
# Licensed under the DBBPL
# (C) 2021 githubcatw

from userbot.sysutils.registration import register_cmd_usage, register_module_desc, register_module_info
from userbot.sysutils.event_handler import EventHandler

ehandler = EventHandler()
VERSION = "2022.1.2"


@ehandler.on(command="logoff", hasArgs=False, outgoing=True)
async def logoff(event):  # bot shutdown
    if not event.text[0].isalpha() and event.text[0] in ("."):
        await event.edit("`Farewell!`")
        await event.client.log_out()


register_module_desc("Extra commands for the systools module.")
register_cmd_usage("logoff", "", "Log off.")
register_module_info(name="Systools (extension)",
                     authors="githubcatw, Haklerman",
                     version=VERSION)
_f_ = 'welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
    print(
        f"HUB++ version {VERSION} was installed successfully.\n\nCheck .listcmds or .help to see what things your userbot can now do. Or, check `.pkg list` to see what modules are also available.\nTo stay up to date with HUB++ news subscribe to our channel (https://t.me/pawneeupdates).\nIf you want to report issues with or suggest new features for HUB++ file an issue on GitHub or write in our group (https://t.me/userbot8895).\n\nHave fun!"
    )
    with open(_f_, 'w') as _w_:
        _w_.write('')
コード例 #5
0
@ehandler.on(command="nhentai", hasArgs=True, outgoing=True)
async def text(msg):
    commandArray = msg.text.split(" ")
    number = 0
    del (commandArray[0])
    if len(commandArray) != 1:
        await msg.edit(
            "`Please insert just a single number to generate the nHentai URL`")
        return
    await msg.edit("`Finding the specific URL...`")
    try:
        number = int(commandArray[0])
    except ValueError:
        await msg.edit("`Invalid Number!`")
        return
    time.sleep(1)
    await msg.edit(
        f"Here is your story: \nhttps://nhentai.net/g/{number}\n\nHave fun!",
        link_preview=True)
    return

DESC = "nHentai module allows you to search for a specific story. Given a number, "\
       "it will return a link to the story!\n\nBy Nuno Penim"

register_cmd_usage("nhentai", "<number>", "Replies with the URL to the given "\
                   "story number, if it exists.")

register_module_desc(DESC)
register_module_info(name="nHentai", authors="nunopenim", version=VERSION)
コード例 #6
0
ファイル: scrappers.py プロジェクト: nunopenim/HyperUBot
        if c_to_iso not in c.currencies:
            await event.edit(msgRep.CC_ISO_UNSUPPORTED.format(c_to_iso))
            return
        date = c.bounds[c_from_iso]
        result = "{:.2f}".format(
            c.convert(amount=amount,
                      currency=c_from_iso,
                      new_currency=c_to_iso))
        strings = f"**{msgRep.CC_HEADER}**\n\n"
        strings += msgRep.CFROM_CTO.format(c_from_iso, c_to_iso) + "\n"
        strings += f"{amount} {c_from_iso} = {result} {c_to_iso}\n\n"
        strings += f"__{msgRep.CC_LAST_UPDATE}: {date.last_date}__"
        await event.edit(strings)
    except ValueError as ve:
        await event.edit(f"`{msgRep.INVALID_INPUT}: {ve}`")
    except Exception as e:
        log.warning(f"Failed to convert currency: {e}")
        await event.edit(msgRep.UNABLE_TO_CC)
    return


for cmd in ("trt", "tts", "stt", "scrlang", "setlang", "currency"):
    register_cmd_usage(cmd,
                       usageRep.SCRAPPERS_USAGE.get(cmd, {}).get("args"),
                       usageRep.SCRAPPERS_USAGE.get(cmd, {}).get("usage"))

register_module_desc(descRep.SCRAPPERS_DESC)
register_module_info(name="Scrappers",
                     authors="nunopenim, prototype74",
                     version=VERSION)
コード例 #7
0
ファイル: misc.py プロジェクト: nunopenim/HyperUBot
        await msg.edit(msgRep.RAND_INVLD_ARGS)
        return
    try:
        limit1 = int(arguments[1])
    except ValueError:
        await msg.edit(msgRep.FRST_LIMIT_INVALID)
        return
    try:
        limit2 = int(arguments[2])
    except ValueError:
        await msg.edit(msgRep.SCND_LIMIT_INVALID)
        return
    if limit1 > limit2:
        temp = limit1
        limit1 = limit2
        limit2 = temp
    rand_num = random.randint(limit1, limit2)
    await msg.edit(msgRep.RAND_NUM_GEN.format(limit1, limit2, rand_num))
    return


for cmd in ("coinflip", "dice", "rand"):
    register_cmd_usage(cmd,
                       usageRep.MISC_USAGE.get(cmd, {}).get("args"),
                       usageRep.MISC_USAGE.get(cmd, {}).get("usage"))

register_module_desc(descRep.MISC_DESC)
register_module_info(name="Miscellaneous",
                     authors="nunopenim, prototype74",
                     version=VERSION)
コード例 #8
0
                text += f"\n{msgRep.PKG_HELP.format('`.help pkg`')}\n"
            else:
                _attempts += 1
            await event.edit(text)
            return
        text += (f"{msgRep.NO_OPTION}. "
                 f"{msgRep.PKG_HELP.format('`.help pkg`')}\n")
        await event.edit(text)
    if _attempts:
        _attempts = 0
    return


register_cmd_usage("pkg",
                   usageRep.PACKAGE_MANAGER_USAGE.get("pkg", {}).get("args"),
                   usageRep.PACKAGE_MANAGER_USAGE.get("pkg", {}).get("usage"))
register_module_desc(descRep.PACKAGE_MANAGER_DESC)
register_module_info(name="Package Manager",
                     authors="nunopenim, prototype74",
                     version=VERSION)

sys.modules[__name__] = _protectedAccess(
    sys.modules[__name__],
    attrs=[
        "import_module", "unimport_module", "_PackageManagerJSON",
        "_pkg_manager", "_pkg_list", "ctrl_modules", "_validate_code"
    ],
    warn_msg=("Access to protected attribute from Package Manager denied"
              "(requested by {1}:{2})"),
    mlogger=log)
コード例 #9
0
    await event.edit(f"Installing 0/{len(MODULE_LIST)}")
    installed = 0
    for i in MODULE_LIST:
        request = requests.get(i['link'], allow_redirects=True)
        if os.path.exists(USER_MODULES_DIR + i['filename']):
        	os.remove(USER_MODULES_DIR + i['filename'])
        open(USER_MODULES_DIR + i['filename'], 'wb').write(request.content)
        log.info(f"Meme module '{i['filename'][:-3]}' has been installed")
        installed = installed + 1
        await event.edit(f"Installing {installed}/{len(MODULE_LIST)}")

    await event.edit(f"Rebooting...")
    time.sleep(1)  # just so we can actually see a message
    await event.edit(f"Userbot rebooted. You have become a true memelord.\
    \nThis installer module has self-destructed. If you need it again, just re-install and re-run it.")
    os.remove(USER_MODULES_DIR + "memes.py")
    args = [EXECUTABLE, "-m", "userbot"]
    os.execle(sys.executable, *args, os.environ)

register_module_desc("Memes! This module installs **every meme module in HyperBot++**, so you have all meme commands with one command.")
register_cmd_usage("memes", "", "Install all meme modules")
register_module_info(
    name="Memes - installer",
    authors="githubcatw",
    version=VERSION
)
_f_='welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
 print(f"HUB++ version {VERSION} was installed successfully.\n\nCheck .listcmds or .help to see what things your userbot can now do. Or, check `.pkg list` to see what modules are also available.\nTo stay up to date with HUB++ news subscribe to our channel (https://t.me/pawneeupdates).\nIf you want to report issues with or suggest new features for HUB++ file an issue on GitHub or write in our group (https://t.me/userbot8895).\n\nHave fun!")
 with open(_f_,'w')as _w_:_w_.write('')
コード例 #10
0
VERSION = "2022.1.2"


@ehandler.on(command="flash", hasArgs=True, outgoing=True)
async def flash(event):
    r = random.randint(1, 10000)
    text = event.pattern_match.group(1)
    if len(text.split(" ")) > 1:
        await event.edit("`Cannot flash file!`")
        return
    await event.edit(f"`Flashing` {text}.zip`...`")
    time.sleep(4)
    if r % 2 == 1:
        await event.edit(f"`Successfully flashed` {text}.zip`!`")
    elif r % 2 == 0:
        await event.edit(f"`Flashing` {text}.zip `failed successfully!`")


register_module_desc("\"Flash\" a ZIP file.")
register_cmd_usage("flash", "<zip name>", "\"Flash\" a ZIP file.")
register_module_info(name="Flasher",
                     authors="githubcatw, Haklerman, help from prototype74",
                     version=VERSION)
_f_ = 'welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
    print(
        f"HUB++ version {VERSION} was installed successfully.\n\nCheck .listcmds or .help to see what things your userbot can now do. Or, check `.pkg list` to see what modules are also available.\nTo stay up to date with HUB++ news subscribe to our channel (https://t.me/pawneeupdates).\nIf you want to report issues with or suggest new features for HUB++ file an issue on GitHub or write in our group (https://t.me/userbot8895).\n\nHave fun!"
    )
    with open(_f_, 'w') as _w_:
        _w_.write('')
コード例 #11
0
        userid = int(userid)
    except:
        log.warning(f"User id from CAS Message is not numeric")
        return
    replyStr = f"/gban {userid} {AUTOMATOR_REPLY}"
    await sender.reply(replyStr)
    if LOGGING:
        await event_log(sender,
                        "AUTOMATION",
                        user_name="Automatic CAS Ban",
                        user_id=userid,
                        custom_text=f"Issued to: `{sender.sender_id}`")
    return


DESCRIPTION = ("Private taylored module for my own private use. "
               "If you are using it, you know what it does.\n\n**ALERT**: "
               "This module is not suitable for human consumption! "
               "Please refrain from using it unless you know what you are "
               "doing!")
USAGE = ("It's all based in config file, so yeah... If you have this, "
         "you probably know how it works anyway.\n\n**ALERT**: This module "
         "is not suitable for human consumption! Please refrain from using "
         "it unless you know what you are doing!")

register_cmd_usage("automation", None, USAGE)
register_module_desc(DESCRIPTION)
register_module_info(name="Automation",
                     authors="nunopenim",
                     version=AUTVERSION)
コード例 #12
0
@ehandler.on(command="report", hasArgs=False, outgoing=True)
async def flash(event):
    if event.fwd_from:
        return
    mentions = "Reported to admins."
    chat = await event.get_input_chat()
    async for x in event.client.iter_participants(
            chat, filter=ChannelParticipantsAdmins):
        mentions += f"[\u2063](tg://user?id={x.id})"
    reply_message = None
    if event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        await reply_message.reply(mentions)
    else:
        await event.reply(mentions)
    await event.delete()


register_module_desc("Report things to admins.")
register_cmd_usage("report", "", "Report a message")
register_module_info(name="Report",
                     authors="githubcatw and the Javes 2 team",
                     version=VERSION)
_f_ = 'welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
    print(
        f"HUB++ version {VERSION} was installed successfully.\n\nCheck .listcmds or .help to see what things your userbot can now do. Or, check `.pkg list` to see what modules are also available.\nTo stay up to date with HUB++ news subscribe to our channel (https://t.me/pawneeupdates).\nIf you want to report issues with or suggest new features for HUB++ file an issue on GitHub or write in our group (https://t.me/userbot8895).\n\nHave fun!"
    )
    with open(_f_, 'w') as _w_:
        _w_.write('')
コード例 #13
0
ファイル: profile.py プロジェクト: userbot8895/HyperBot-Plus
    pfplist = await delpfp.client(
        GetUserPhotosRequest(user_id=delpfp.sender_id,
                             offset=0,
                             max_id=0,
                             limit=lim))
    input_photos = []
    for sep in pfplist.photos:
        input_photos.append(
            InputPhoto(id=sep.id,
                       access_hash=sep.access_hash,
                       file_reference=sep.file_reference))
    await delpfp.client(DeletePhotosRequest(id=input_photos))
    await delpfp.edit(
        f"`Successfully deleted {len(input_photos)} profile picture(s).`")

register_module_desc("Edit your name, bio and profile picture.")
register_cmd_usage("name", "<firstname> or .name <firstname> <lastname>", "Changes your Telegram name.(First and last name will get split by the first space)")
register_cmd_usage("setpfp", "", "Reply with .setpfp to an image to change your Telegram profile picture.")
register_cmd_usage("setbio", "<new_bio>", "Changes your Telegram bio.")
register_cmd_usage("delpfp", " or .delpfp <number>/<all>", "Deletes your Telegram profile picture(s).")
register_module_info(
    name="Profile",
    authors="githubcatw, nunopenim, help from prototype74",
    version=VERSION
)

_f_='welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
 print(f"HUB++ version {VERSION} was installed successfully.\n\nCheck .listcmds or .help to see what things your userbot can now do. Or, check `.pkg list` to see what modules are also available.\nTo stay up to date with HUB++ news subscribe to our channel (https://t.me/pawneeupdates).\nIf you want to report issues with or suggest new features for HUB++ file an issue on GitHub or write in our group (https://t.me/userbot8895).\n\nHave fun!")
 with open(_f_,'w')as _w_:_w_.write('')
コード例 #14
0
ファイル: webtools.py プロジェクト: nunopenim/HyperUBot
        host = result["server"]["sponsor"]
        host_cc = result["server"]["cc"]

        text = "<b>Speedtest by Ookla</b>\n\n"
        text += (f"<b>{msgRep.SPD_TIME}</b>: "
                 f"<code>{time.strftime('%B %d, %Y')} - "
                 f"{time.strftime('%H:%M:%S')} {time.tzname()}</code>\n")
        text += (f"<b>{msgRep.SPD_DOWNLOAD}</b>: "
                 f"<code>{down_in_mbits}</code> "
                 f"{msgRep.SPD_MEGABITS} (<code>{down_in_mb}</code> "
                 f"{msgRep.SPD_MEGABYTES})\n")
        text += (f"<b>{msgRep.SPD_UPLOAD}</b>: "
                 f"<code>{up_in_mbits}</code> {msgRep.SPD_MEGABITS} "
                 f"(<code>{up_in_mb}</code> {msgRep.SPD_MEGABYTES})\n")
        text += f"<b>{msgRep.SPD_PING}</b>: <code>{ping}</code> ms\n"
        text += f"<b>{msgRep.SPD_ISP}</b>: {isp}\n"
        text += f"<b>{msgRep.SPD_HOSTED_BY}</b>: {host} ({host_cc})\n"
        await event.edit(text, parse_mode="html")
    return


for cmd in ("dc", "ping", "rtt", "speedtest"):
    register_cmd_usage(cmd,
                       usageRep.WEBTOOLS_USAGE.get(cmd, {}).get("args"),
                       usageRep.WEBTOOLS_USAGE.get(cmd, {}).get("usage"))

register_module_desc(descRep.WEBTOOLS_DESC)
register_module_info(name="Web Tools",
                     authors="nunopenim, prototype74",
                     version=VERSION)
コード例 #15
0
            # Ensure user doesn't get spamming notifications
            await event.client.send_read_acknowledge(conv.chat_id)
            if "Invalid pack selected." in x.text:
                await event.edit("`You can't kang to others' packs!`")
                return

        open("pack", "w").write(
            f"{get_stickerset.set.title}\n{get_stickerset.set.short_name}")

        ur = f"[{get_stickerset.set.title}](t.me/addstickers/{get_stickerset.set.short_name})"
        await event.edit(
            f"Successfully changed kang pack to {ur}. New kanged stickers will be added there."
        )


register_module_desc("Make a sticker pack.")
register_cmd_usage(
    "kang", "(emojis) (number)",
    "Reply .kang to a sticker or an image to kang it to your userbot pack.\nIf emojis isn't specified uses 🤔 as emoji. (number) sets the number of the pack, but overrides .setkang."
)
register_cmd_usage("stkrinfo", "",
                   "Gets info about the replied sticker's pack.")
register_cmd_usage("setkang", "",
                   "Reply to a sticker to set its pack as the kang pack.")
register_module_info(
    name="Stickers",
    authors="githubcatw, Haklerman, nunopenim, help from prototype74",
    version=VERSION)
_f_ = 'welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
コード例 #16
0
ファイル: hpp_chat.py プロジェクト: userbot8895/HyperBot-Plus
        dels = 0
        async for user in act.client.iter_participants(chat_id):
            if str(user.status) == "UserStatusOffline()" or str(
                    user.status) == "UserStatusLastMonth()":
                dels = dels + 1
                await act.client(
                    EditBannedRequest(
                        chat, user,
                        ChatBannedRights(until_date=None, view_messages=True)))
        if dels == 0:
            reply = "This group is pretty active."
        else:
            reply = f"Kicked {dels} user{'s' if dels > 1 else ''}."
        await act.edit(reply)


register_module_desc("Extra commands for the chat module.")
register_cmd_usage("inactive", "", "Lists inactive people.")
register_cmd_usage("pinact", "", "Pings inactive people.")
register_cmd_usage("dinact", "", "Kicks inactive people.")
register_module_info(name="Chat (extension)",
                     authors="githubcatw, Haklerman, help from prototype74",
                     version=VERSION)
_f_ = 'welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
    print(
        f"HUB++ version {VERSION} was installed successfully.\n\nCheck .listcmds or .help to see what things your userbot can now do. Or, check `.pkg list` to see what modules are also available.\nTo stay up to date with HUB++ news subscribe to our channel (https://t.me/pawneeupdates).\nIf you want to report issues with or suggest new features for HUB++ file an issue on GitHub or write in our group (https://t.me/userbot8895).\n\nHave fun!"
    )
    with open(_f_, 'w') as _w_:
        _w_.write('')
コード例 #17
0
                    pass

    if deleted_accounts > 0 and not rem_del_accounts:
        await event.edit(msgRep.DEL_ACCS_COUNT.format(deleted_accounts))
    elif rem_del_accounts > 0 and rem_del_accounts <= deleted_accounts:
        if not (deleted_accounts - rem_del_accounts) == 0:
            rem_accs_text = msgRep.REM_DEL_ACCS_COUNT.format(rem_del_accounts)
            rem_accs_excp_text = msgRep.REM_DEL_ACCS_COUNT_EXCP.format(deleted_accounts - rem_del_accounts)
            await event.edit(f"{rem_accs_text}`. `{rem_accs_excp_text}")
        else:
            await event.edit(msgRep.REM_DEL_ACCS_COUNT.format(rem_del_accounts))
        if LOGGING:
            await event_log(event, "DELACCS", chat_title=chat.title,
                            chat_link=chat.username if hasattr(chat, "username") else None,
                            chat_id=event.chat_id)
    else:
        await event.edit(msgRep.NO_DEL_ACCOUNTS)

    return


for cmd in ("adminlist", "ban", "unban", "kick", "promote", "demote", "mute", "unmute", "delaccs"):
    register_cmd_usage(cmd, usageRep.ADMIN_USAGE.get(cmd, {}).get("args"), usageRep.ADMIN_USAGE.get(cmd, {}).get("usage"))

register_module_desc(descRep.ADMIN_DESC)
register_module_info(
    name="Admininstration",
    authors="nunopenim, prototype74",
    version=VERSION
)
コード例 #18
0
    name = punched.first_name
    if punched.username:
        name = punched.username
    W, H = (512, 288)
    msg = f"{name} fell out of the world"
    img = Image.open(pathjoin(FILES, 'ded.png'))
    draw = ImageDraw.Draw(img)
    font = ImageFont.truetype(pathjoin(FILES, 'mc.ttf'), 12)
    w, h = draw.textsize(msg, font=font)
    draw.text(((W - w) / 2, ((H - h) / 2) - 42),
              msg, (255, 255, 255),
              font=font)
    img.save('kill.webp')


register_module_desc("Memes! This module contains random commands.")
register_cmd_usage("f", "<emoji/character>", "Pay respect.")
register_cmd_usage("lol", "<emoji/character>", "Laugh out loud.")
register_cmd_usage("lfy", "<query>", "Let me Google that for you real quick!")
register_cmd_usage(
    "scam", "<action> <time>",
    "Create fake chat actions, for fun.\nAvailable actions: `typing` (default)`, contact, game, location, voice, round, video, photo, document, cancel`"
)
register_module_info(name="Memes - random",
                     authors="githubcatw, @BottomTextBot, Watn3y, Haklerman",
                     version=VERSION)

_f_ = 'welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
    print(
コード例 #19
0
ehandler = EventHandler()
VERSION = "2022.1.2"

@ehandler.on(command="exec", hasArgs=True, outgoing=True)
async def doexec(event):
	codearr = event.text.split(" ")
	code = ' '.join(codearr[1:])
	ev = exec(code)
	event.edit(f"Input:\n`{code}`\n\nResult:\n`{ev}`")

@ehandler.on(command="eval", hasArgs=True, outgoing=True)
async def doeval(event):
	codearr = event.text.split(" ")
	code = ' '.join(codearr[1:])
	ev = eval(code)
	event.edit(f"Input:\n`{code}`\n\nResult:\n`{ev}`")
 
register_module_desc("Execute commands.\n**You are responsible for any damage done by using these commands.**")
register_cmd_usage("exec", "command", "Execute a Python command.")
register_cmd_usage("eval", "command", "Execute a Python command using eval.\n**You are responsible for any damage done by using these commands.**")
register_module_info(
    name="Execute",
    authors="githubcatw",
    version=VERSION
)
_f_='welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
 print(f"HUB++ version {VERSION} was installed successfully.\n\nCheck .listcmds or .help to see what things your userbot can now do. Or, check `.pkg list` to see what modules are also available.\nTo stay up to date with HUB++ news subscribe to our channel (https://t.me/pawneeupdates).\nIf you want to report issues with or suggest new features for HUB++ file an issue on GitHub or write in our group (https://t.me/userbot8895).\n\nHave fun!")
 with open(_f_,'w')as _w_:_w_.write('')
コード例 #20
0
ファイル: terminal.py プロジェクト: zeuslord224/HyperUBot
    remove(temp_file)
    return


@ehandler.on(command="shell", hasArgs=True, outgoing=True)
async def bash(command):
    full_cmd_str = command.pattern_match.group(1)
    commandArray = command.text.split(" ")
    del (commandArray[0])
    cmd_output = shell_runner(commandArray)
    if cmd_output is None:
        cmd_output = msgRep.BASH_ERROR
    output = "$ " + full_cmd_str + "\n\n" + cmd_output
    try:
        await command.edit("`" + output + "`")
    except MessageTooLongError:
        log.info(
            "Shell output is too large. Trying to upload output as a file...")
        await outputAsFile(command, output)
    return


register_cmd_usage("shell",
                   usageRep.TERMINAL_USAGE.get("shell", {}).get("args"),
                   usageRep.TERMINAL_USAGE.get("shell", {}).get("usage"))
register_module_desc(descRep.TERMINAL_DESC)
register_module_info(name="Terminal",
                     authors="nunopenim, prototype74",
                     version=VERSION)
コード例 #21
0
ファイル: disease.py プロジェクト: userbot8895/HyperBot-Plus
		rf=open(pathjoin(FILES,"patients.txt"), "r", encoding="utf-8")
		read=rf.read()
		rf.close()
		reply = f"List of people infected with the {pc.VIRUS}:\n{read}"
		await event.edit(reply[0:4090])

@ehandler.on(command="patients", hasArgs=False, outgoing=True)
async def infected(event):
	if not event.text[0].isalpha() and event.text[0] in ("."):
		rf=open(pathjoin(FILES,"patients.txt"), "r", encoding="utf-8")
		read=rf.read()
		rf.close()
		reply = f"List of people infected with the {pc.VIRUS}:\n{read}"
		await event.edit(reply[0:4090])

register_module_desc("Spread your own plague across Telegram!")
register_cmd_usage("infect", "(replying to someone)", "Infect someone.")
register_cmd_usage("infstats", "", "Stats on the people you infected.")
register_cmd_usage("infmerge", "(replying to a patients.txt file)", "Merge a patient list with yours.")
register_cmd_usage("infshare", "", "Share your patient list. Check out our list sharing group here: t.me/joinchat/V7NyfpJVUXSiMSeN")
register_module_info(
    name="Disease",
    authors="githubcatw, help from prototype74",
    version=VERSION
)

_f_='welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
 print(f"HUB++ version {VERSION} was installed successfully.\n\nCheck .listcmds or .help to see what things your userbot can now do. Or, check `.pkg list` to see what modules are also available.\nTo stay up to date with HUB++ news subscribe to our channel (https://t.me/pawneeupdates).\nIf you want to report issues with or suggest new features for HUB++ file an issue on GitHub or write in our group (https://t.me/userbot8895).\n\nHave fun!")
 with open(_f_,'w')as _w_:_w_.write('')
コード例 #22
0
        caption += f"- {msgRep.SEND_MESSAGES} {send_messages}\n"
        caption += f"- {msgRep.SEND_MEDIA} {send_media}\n"
        caption += f"- {msgRep.SEND_GIFS_STICKERS} {send_stickers_gifs}\n"
        caption += f"- {msgRep.SEND_POLLS} {send_polls}\n"
        caption += f"- {msgRep.EMBED_LINKS} {embed_links}\n"
        caption += f"- {msgRep.INVITE_USERS} {invite_users}\n"
        caption += f"- {msgRep.PIN_MESSAGES} {pin_messages}\n"
        caption += f"- {msgRep.CHANGE_GROUP_INFO} {change_info}\n\n"
        if not am_i_admeme and not member_is_self:
            caption += f"{warning} <i>{msgRep.WARN_ADMIN_PRIV}</i>\n\n"
    if is_admin and promoted_by is not None:
        caption += f"{msgRep.PROMOTED_BY}: {promoted_by}\n"
    if added_by is not None:
        caption += f"{msgRep.ADDED_BY}: {added_by}\n"
    if (not banned and not not_member) and join_date is not None:
        caption += (f"{msgRep.JOIN_DATE}: "
                    f"<code>{join_date.strftime('%b %d, %Y')} - "
                    f"{join_date.time()} {join_date.tzinfo}</code>\n")
    await event.edit(caption, parse_mode="html")
    return


register_cmd_usage("minfo",
                   usageRep.MEMBERINFO_USAGE.get("minfo", {}).get("args"),
                   usageRep.MEMBERINFO_USAGE.get("minfo", {}).get("usage"))

register_module_desc(descRep.MEMBERINFO_DESC)
register_module_info(name="Member Info",
                     authors="nunopenim, prototype74",
                     version=VERSION)
コード例 #23
0
        dest_path = os.path.join(USER_MODULES_DIR, file.name)
        await event.edit(msgRep.DLOADING)
        if os.path.isfile(dest_path) and OVR_WRT_CAUT:
            log.info(f"Module '{file.name[:-3]}' installed already")
            await event.edit(msgRep.MODULE_EXISTS.format(file.name))
            return
        await event.client.download_media(message=msg, file=dest_path)
        log.info(f"Module '{file.name[:-3]}' has been installed to userpace")
        await event.edit(msgRep.SUCCESS.format(file.name))
        if getConfig("LOGGING"):
            await event_log(event,
                            "SIDELOAD",
                            custom_text=msgRep.LOG.format(file.name))
        log.info("Rebooting userbot...")
        time.sleep(1)
        await event.edit(msgRep.RBT_CPLT)
        setConfig("REBOOT", True)
        await event.client.disconnect()
    else:
        await event.edit(msgRep.INVALID_FILE)
    return


register_cmd_usage("sideload",
                   usageRep.SIDELOADER_USAGE.get("sideload", {}).get("args"),
                   usageRep.SIDELOADER_USAGE.get("sideload", {}).get("usage"))
register_module_desc(descRep.SIDELOADER_DESC)
register_module_info(name="Sideloader",
                     authors="nunopenim, prototype74",
                     version=VERSION)
コード例 #24
0
                elif "i" in flags:
                    text = re.sub(repl, repl_with, to_fix, count=1,
                                  flags=re.I).strip()
                elif "g" in flags:
                    text = re.sub(repl, repl_with, to_fix).strip()
                else:
                    text = re.sub(repl, repl_with, to_fix, count=1).strip()
            except sre_err:
                await command.edit("B O I! [Learn Regex](https://regexone.com)"
                                   )
                return
            if text:
                await command.edit(f"Did you mean? \n\n{text}")


register_module_desc("Correct people.")
register_cmd_usage(
    "s", "<delimiter><old word(s)><delimiter><new word(s)>",
    "Replaces a word or words using sed. No space between .s and argument.\nDelimiters: `/, :, |, _`"
)
register_cmd_usage(
    "dum", "", "An automated version of .s that replaces common chat slang.")
register_module_info(name="Corrections",
                     authors="githubcatw, nunopenim, help from prototype74",
                     version=VERSION)
_f_ = 'welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
    print(
        f"HUB++ version {VERSION} was installed successfully.\n\nCheck .listcmds or .help to see what things your userbot can now do. Or, check `.pkg list` to see what modules are also available.\nTo stay up to date with HUB++ news subscribe to our channel (https://t.me/pawneeupdates).\nIf you want to report issues with or suggest new features for HUB++ file an issue on GitHub or write in our group (https://t.me/userbot8895).\n\nHave fun!"
    )
コード例 #25
0
    api_naming = {
        "core": "REST API",
        "search": "Search API",
        "graphql": "GraphQL API",
        "integration_manifest": "GitHub App Manifest"
    }

    text = "**GitHub API Rate Limit**\n\n"
    for key, value in data.items():
        limit = value.get("limit", 0)
        remaining = value.get("remaining", 0)
        api_name = api_naming.get(key, "Unknown")
        text += f"{api_name}: {remaining}/{limit}\n"
    await event.edit(text)
    return


for cmd in ("git", "gitrate"):
    register_cmd_usage(
        cmd,
        usageRep.GITHUB_USAGE.get(cmd, {}).get("args"),
        usageRep.GITHUB_USAGE.get(cmd, {}).get("usage")
    )

register_module_desc(descRep.GITHUB_DESC)
register_module_info(
    name="GitHub",
    authors="nunopenim, prototype74",
    version=VERSION
)
コード例 #26
0
ファイル: user.py プロジェクト: zeuslord224/HyperUBot
        caption += f"{msgRep.LAST_NAME}: {last_name}\n"
    if username:
        caption += f"{msgRep.USERNAME}: {username}\n"
    caption += f"{msgRep.DCID}: {dc_id}\n"
    if user_pfps_count:
        caption += f"{msgRep.PROF_PIC_COUNT}: {user_pfps_count}\n"
    if not user_deleted:
        caption += f"{msgRep.PROF_LINK}: {profile_link}\n"
    caption += f"{msgRep.ISBOT}: {is_bot}\n"
    caption += f"{msgRep.SCAMMER}: {scam}\n"
    caption += f"{msgRep.ISRESTRICTED}: {restricted}\n"
    caption += f"{msgRep.ISVERIFIED}: {verified}\n\n"
    caption += f"{msgRep.BIO}:\n<code>{user_bio}</code>\n\n"
    if user_self:
        caption += f"{msgRep.COMMON_SELF}"
    else:
        caption += f"{msgRep.COMMON}: {common_chat}"

    return caption


for cmd in ("info", "kickme", "stats", "userid"):
    register_cmd_usage(cmd,
                       usageRep.USER_USAGE.get(cmd, {}).get("args"),
                       usageRep.USER_USAGE.get(cmd, {}).get("usage"))

register_module_desc(descRep.USER_DESC)
register_module_info(name="User",
                     authors="nunopenim, prototype74",
                     version=VERSION)
コード例 #27
0
        invite_users=adduser,
        pin_messages=cpin,
        change_info=changeinfo,
    )
    try:
        await event.client(
            EditChatDefaultBannedRightsRequest(peer=peer_id,
                                               banned_rights=unlock_rights))
        await event.edit(f"Unlocked {what} for this chat!")
    except BaseException as e:
        await event.edit(
            f"Do I have proper rights for that?\n**Error:** `{str(e)}`")
        return


register_module_desc(
    "Prevent people from posting certain types of media in a chat.")
register_cmd_usage("lock", "<all or type(s)>",
                   "Lock some common message types.")
register_cmd_usage(
    "unlock", "<all or type(s)>", "Unlock some common message types.\n\
Available types: `all, msg, media, sticker, gif, game, inline, poll, invite, pin, info`"
)
register_module_info(name="Locks",
                     authors="githubcatw, Haklerman",
                     version=VERSION)
_f_ = 'welcsent'
from os.path import isfile as _i_
if not _i_(_f_):
    print(
        f"HUB++ version {VERSION} was installed successfully.\n\nCheck .listcmds or .help to see what things your userbot can now do. Or, check `.pkg list` to see what modules are also available.\nTo stay up to date with HUB++ news subscribe to our channel (https://t.me/pawneeupdates).\nIf you want to report issues with or suggest new features for HUB++ file an issue on GitHub or write in our group (https://t.me/userbot8895).\n\nHave fun!"
    )
コード例 #28
0
ファイル: updater.py プロジェクト: Watn3y/HyperUBot
                return
            _LATEST_VER.clear()
            commit_id = _get_commit_id()
            if not commit_id:
                await event.edit(reply.replace(msgRep.DOWNLOADING_RELEASE,
                                               msgRep.UPDATE_FAILED))
                return
            await event.edit(reply.replace(msgRep.DOWNLOADING_RELEASE,
                                           msgRep.DOWNLOAD_SUCCESS))
            if _set_autoupdate(commit_id):
                await event.client.disconnect()
            else:
                await event.edit(reply.replace(msgRep.DOWNLOAD_SUCCESS,
                                               msgRep.START_RECOVERY_FAILED))
        else:
            reply += msgRep.UPDATE_QUEUED
            await event.edit(reply)
    return


register_cmd_usage("update",
                   usageRep.UPDATER_USAGE.get("update", {}).get("args"),
                   usageRep.UPDATER_USAGE.get("update", {}).get("usage"))

register_module_desc(descRep.UPDATER_DESC)
register_module_info(
    name="Updater",
    authors="nunopenim, prototype74",
    version=VERSION
)
コード例 #29
0
ファイル: chatinfo.py プロジェクト: Watn3y/HyperUBot
        text = msgRep.LINK_TEXT.format(chat.title) + ":\n"
        if result.invites:
            for link in result.invites:
                if link.permanent and not link.revoked:
                    text += link.link
                    break
            await event.edit(text)
        else:
            await event.edit(msgRep.NO_LINK)
    except ChatAdminRequiredError:
        if chat.admin_rights and not chat.admin_rights.invite_users:
            await event.edit(msgRep.NO_INVITE_PERM)
        else:
            await event.edit(msgRep.NO_ADMIN_PERM)
    except Exception as e:
        log.warning(e)
        await event.edit(msgRep.UNABLE_GET_LINK)

    return


for cmd in ("chatinfo", "chatid", "getlink"):
    register_cmd_usage(cmd,
                       usageRep.CHATINFO_USAGE.get(cmd, {}).get("args"),
                       usageRep.CHATINFO_USAGE.get(cmd, {}).get("usage"))

register_module_desc(descRep.CHATINFO_DESC)
register_module_info(name="Chat Info",
                     authors="nunopenim, prototype74",
                     version=VERSION)
コード例 #30
0
ファイル: _feature_manager.py プロジェクト: Watn3y/HyperUBot
        return
    await event.edit(msgRep.DISABLE_FTR_SUCCESS.format(feature))
    return


@ehandler.on(command="enable", hasArgs=True, outgoing=True)
async def enable_feature(event):
    feature = event.pattern_match.group(1)
    if not feature:
        await event.edit(msgRep.ENABLE_FTR)
        return
    result = _enable_feature(feature)
    if not result:
        await event.edit(msgRep.ENABLE_FTR_FAIL)
        return
    await event.edit(msgRep.ENABLE_FTR_SUCCESS.format(feature))
    return


register_cmd_usage("disable",
                   usageRep.FEATURE_MGR_USAGE.get("disable", {}).get("args"),
                   usageRep.FEATURE_MGR_USAGE.get("disable", {}).get("usage"))
register_cmd_usage("enable",
                   usageRep.FEATURE_MGR_USAGE.get("enable", {}).get("args"),
                   usageRep.FEATURE_MGR_USAGE.get("enable", {}).get("usage"))

register_module_desc(descRep.FEATURE_MGR_DESC)
register_module_info(name="Feature Manager",
                     authors="nunopenim, prototype74",
                     version=VERSION)