Ejemplo n.º 1
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('')
Ejemplo n.º 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)
Ejemplo n.º 3
0
            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
)
Ejemplo n.º 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('')
Ejemplo n.º 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)
Ejemplo n.º 6
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('')
Ejemplo n.º 7
0
        _attempts += 1
        return

    if sec_arg:
        modules_list = update_list()
        name_of_module = None
        module_to_load = MODULES_LISTED.get(sec_arg)
        for module_name, module in [modules[:-1] for modules in modules_list]:
            if module_to_load is module:
                name_of_module = module_name
                break
        try:
            if desc:
                await event.edit(module_desc(name_of_module, module_to_load))
            elif info:
                await event.edit(module_info(name_of_module, module_to_load))
            elif usage:
                await event.edit(module_usage(name_of_module, module_to_load))
        except IndexError:
            await event.edit(
                modules_listing(msgRep.MODULE_NOT_AVAILABLE.format(sec_arg)))
    if _attempts:
        _attempts = 0
    return


for cmd in ("lcmds", "mods"):
    register_cmd_usage(cmd,
                       usageRep.MODULES_UTILS_USAGE.get(cmd, {}).get("args"),
                       usageRep.MODULES_UTILS_USAGE.get(cmd, {}).get("usage"))
Ejemplo n.º 8
0
        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('')
Ejemplo n.º 9
0
    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(
        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!"
Ejemplo n.º 10
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('')
Ejemplo n.º 11
0
    if sec_arg:
        modules_list = update_list()
        global MODULES_LISTED
        name_of_module = None
        module_to_load = MODULES_LISTED.get(sec_arg)
        for module_name, module in [modules[:-1] for modules in modules_list]:
            if module_to_load is module:
                name_of_module = module_name
                break
        try:
            if desc:
                await event.edit(module_desc(name_of_module, module_to_load))
            elif info:
                await event.edit(module_info(name_of_module, module_to_load))
            elif usage:
                await event.edit(module_usage(name_of_module, module_to_load))
        except IndexError:
            await event.edit(
                modules_listing(msgRep.MODULE_NOT_AVAILABLE.format(sec_arg)))
    return


register_cmd_usage(
    "listcmds",
    usageRep.MODULES_UTILS_USAGE.get("listcmds", {}).get("args"),
    usageRep.MODULES_UTILS_USAGE.get("listcmds", {}).get("usage"))
register_cmd_usage(
    "modules",
    usageRep.MODULES_UTILS_USAGE.get("modules", {}).get("args"),
    usageRep.MODULES_UTILS_USAGE.get("modules", {}).get("usage"))
Ejemplo n.º 12
0
            if _attempts >= 2:
                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)
Ejemplo n.º 13
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)
Ejemplo n.º 14
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('')
Ejemplo n.º 15
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
)
Ejemplo n.º 16
0
    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)
Ejemplo n.º 17
0
        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)
Ejemplo n.º 18
0
    "Light travels faster than sound, which explains why you seemed bright until you speak.",
    "Your teeth are like stars, light years away and yellow.",
    "Your face is like a treasure, it needs to be buried very deep.",
    "Why don't you slip into something more comfortable, like a coma?",
    "I will never forget the first time we met, although I am trying.",
    "If you were a bit more intelligent, you would still be stupid.",
    "Not even your IQ test is positive.",
    "I heard you are very kind to animals, so please return that face to the gorilla.",
    "You got your head so far up your ass, you can chew food twice."]


@ehandler.on(command="hi", outgoing=True)
async def hello(event):
    await event.edit(random.choice(GREETINGS))
    return


@ehandler.on(command="insult", outgoing=True)
async def insult(event):
    await event.edit(random.choice(INSULTS))
    return

DESC = "The text replies module contains programmed sentences that are randomly chosen. "\
       "Check the usage to see what sentences are these."

register_cmd_usage("hi", None, "Greet people.")
register_cmd_usage("insult", None, "insults people.")

register_module_desc(DESC)
register_module_info(name="Text Replies", authors="nunopenim", version=VERSION)
Ejemplo n.º 19
0
                               "System module! Reboot recommended!".format(modName))
        else:
            await command.edit("`Converting system module into user module...`"
                               )
            copyfile(os.path.join(MODULES_DIR, modName + ".py"),
                     os.path.join(USER_MODULES_DIR, modName + ".py"))
            os.remove(os.path.join(MODULES_DIR, modName + ".py"))
            time.sleep(1)
            if LOGGING:
                await event_log(command, "SUPERUSER", "The System module `{}` was successfully "\
                                "converted into a User module!".format(modName))
            await command.edit("The System module `{}` was successfully converted into a "\
                               "user module! Reboot recommended!".format(modName))
    else:
        await command.edit(
            "Invalid argument! Please make sure it is **disclaimer**, **remove** or **convert**"
        )
    return

DESC = "The Superuser module offers the possibility of more customization of the userbot. "\
       "Be careful however, as this can break your userbot. The updater will likely "\
       "break if you use this module!"

register_cmd_usage("sudo", "<disclaimer/remove <package_name>/convert <package_name>>",
                   "[disclaimer] Shows the warning message, and acknowledges the user has read it.\n"\
                   "[remove] Removes the specified package from the system.\n"\
                   "[convert] Converts a User Module in a System Module and vice-versa.")

register_module_desc(DESC)
register_module_info(name="SuperUser", authors="nunopenim", version=VERSION)
Ejemplo n.º 20
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)
Ejemplo n.º 21
0
		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('')
Ejemplo n.º 22
0
                                  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!"
    )
    with open(_f_, 'w') as _w_:
        _w_.write('')
Ejemplo n.º 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)
Ejemplo n.º 24
0
async def unformat(event):
    rply_msg = await event.get_reply_message()
    if rply_msg:
        text = rply_msg.raw_text
    else:
        await event.edit(
            "`Please use this command as a reply, so I have something to unformat!`"
        )
        return
    try:
        await event.edit(text)
    except MessageNotModifiedError:
        await event.edit("`Unspecifed error! Likely you are replying to an already `"\
                         "`non-formatted message by a Userbot, or to an userbot command.`")
    return

DESC = "The text_utils module offers utilities to edit text, such as convert a "\
       "message to upper case, lower case or unformat it!"

register_cmd_usage("upper", "<text/reply>",
                   "Converts the specified text to upper case.")
register_cmd_usage("lower", "<text/reply>",
                   "Decodes the given message from base64.")
register_cmd_usage("noformat", None, "Unformats the replied message "\
                   "(removes bold, italic, monospace, etc...).")

register_module_desc(DESC)
register_module_info(name="Text Utilities",
                     authors="nunopenim",
                     version=VERSION)
Ejemplo n.º 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
)
Ejemplo n.º 26
0
                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
)
Ejemplo n.º 27
0
        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!"
    )
    with open(_f_, 'w') as _w_:
        _w_.write('')
Ejemplo n.º 28
0
            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_):
    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!"
    )
Ejemplo n.º 29
0
        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)
Ejemplo n.º 30
0
ehandler = EventHandler()


@ehandler.on(command="python", hasArgs=True, outgoing=True)
async def python(command):
    commandArray = command.text.split(" ")
    del (commandArray[0])
    python_instruction = ""
    for word in commandArray:
        python_instruction += word + " "
    command_for_bash = [executable, " -c ", '"' + python_instruction + '"']
    cmd_output = shell_runner(command_for_bash)
    if cmd_output is None:
        cmd_output = "Error executing instruction! Most likely you used \" instead of '. This is a known issue."
    output = "**Python instruction:** `" + python_instruction + "`\n\n"
    output += "**Result: **\n`" + cmd_output + "`"
    await command.edit(output)
    return


DESCRIPTION = "This official add-on module is a Python interpreter. You can run small instructions."
register_cmd_usage("python", "<instruction(s)>", "Runs the specified python instruction.\n\n"\
                   "**Notice:** Please use ' as the string delimiters instead of \", or errors "\
                   "could happen with the command processor.")

register_module_desc(DESCRIPTION)
register_module_info(name="Python Interpreter",
                     authors="nunopenim, prototype74",
                     version=VERSION)