Ejemplo n.º 1
0
        objective = int(argums[1])
    except ValueError:
        await rolling.edit("`Invalid destination value!`")
        return
    possible_vals = [1, 2, 3, 4, 5, 6]
    if objective not in possible_vals:
        await rolling.edit("`Invalid destination value!`")
        return
    await rolling.delete()
    while True:
        newdice = await rolling.client.send_message(
            rolling.to_id, file=InputMediaDice("🎲"))
        rolled_val = newdice.media.value
        if rolled_val == objective:
            return
        else:
            await newdice.delete()
        time.sleep(0.25)

DESC = "This module allows you to launch a dice with any destination value you desire."\
       "\n**WARNING:** This module sends and deletes messages repeatedly, in order to get "\
       "the correct value you want. Use at your own risk as you could be flagged for spam!"

register_cmd_usage("fakedice", "<value>", "Launches a fake dice with the specified value.\n\n"\
                   "**WARNING:** This module sends and deletes messages repeatedly, "\
                   "in order to get the correct value you want. Use at your own risk as "\
                   "you could be flagged for spam!")

register_module_desc(DESC)
register_module_info(name="Fake Dice", authors="nunopenim", version=VERSION)
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
		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.º 5
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.º 6
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.º 7
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.º 8
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.º 9
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.º 10
0
        # 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_):
 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
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)
Ejemplo n.º 12
0
        await event.edit(msgRep.GIVEN_ENT_INVALID)
        return

    try:
        is_chat = True if isinstance(entity, (Chat, Channel)) else False
        if is_chat:
            await _getCASChat(event, entity)
        else:
            await _getCASUser(event, entity, entity_id)
    except ChatAdminRequiredError:
        await event.edit(msgRep.NO_ADMIN)
    except Exception as e:
        log.error(e)
        await event.edit(msgRep.CAS_CHECK_FAIL)
    return


register_cmd_usage(
    "casupdate",
    usageRep.CAS_INTERFACE_USAGE.get("casupdate", {}).get("args"),
    usageRep.CAS_INTERFACE_USAGE.get("casupdate", {}).get("usage"))
register_cmd_usage(
    "cascheck",
    usageRep.CAS_INTERFACE_USAGE.get("cascheck", {}).get("args"),
    usageRep.CAS_INTERFACE_USAGE.get("cascheck", {}).get("usage"))

register_module_desc(descRep.CAS_INTERFACE_DESC)
register_module_info(name="CAS Interface",
                     authors="nunopenim, prototype74",
                     version=VERSION)
Ejemplo n.º 13
0
    if len(arg) == 0:
        await message.edit('Provide some name to search for pack.')
        return
    text = requests.get(COMBOT_STICKERS_URL + arg).text
    soup = bs(text, 'lxml')
    results = soup.find_all("a", {'class': "sticker-pack__btn"})
    titles = soup.find_all("div", "sticker-pack__title")
    if not results:
        await message.edit('No results found!')
        return
    reply = "Stickers for {}:\n".format(arg)
    count = 1
    for result, title in zip(results, titles):
        link = result['href']
        reply += "\n{}. [{}]({})".format(count, title.get_text(), link)
        count += 1
    await message.delete()
    await message.respond(reply)
    return

DESC = "The sticker_search module allows you to search for sticker packs! "\
       "It is powered by Combot."

register_cmd_usage("stksearch", "<name>", "Searches in Combot's Telegram Sticker "\
                   "Catalogue for sticker packs that contain the specified name.")

register_module_desc(DESC)
register_module_info(name="Sticker Searcher",
                     authors="nunopenim",
                     version=VERSION)
Ejemplo n.º 14
0
                message = message.replace(f"{EMOJI_INSTALLING} {r}",f"{EMOJI_FAILURE} {r} "\
                                           "(package already installed)")
            else:
                message = message.replace(f"{EMOJI_INSTALLING} {r}",
                                          f"{EMOJI_SUCCESS} {r}")
                success = success + 1
        except subprocess.CalledProcessError:
            message = message.replace(f"{EMOJI_INSTALLING} {r}",
                                      f"{EMOJI_FAILURE} {r}")
        await event.edit(message.rstrip())
    message = message.replace("Installing ", f"Installed {success}/")
    if getConfig("LOGGING"):
        await event_log(event, "REQUIREMENT INSTALLER", custom_text="{} of {} python "\
                        "packages queued were installed successfully!".format(success, len(reqs)))
    await event.edit(message.rstrip())
    return

DESC = "This module allows you to install pip packages. Sometimes extra modules require "\
       "other pip packages that are not present in requirements.txt. If such happens, "\
       "the bot can be effectively bricked! It is your duty to read the README file avaliable "\
       "in the Repo of the module, in case it needs any module!"

register_cmd_usage(
    "req", "<package names>",
    "installs (or attempts to install) the specified pip package names.")

register_module_desc(DESC)
register_module_info(name="Requirements Installer",
                     authors="githubcatw, nunopenim",
                     version=VERSION)
Ejemplo n.º 15
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.º 16
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.º 17
0
        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!"
    )
    with open(_f_, 'w') as _w_:
        _w_.write('')
Ejemplo n.º 18
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)
Ejemplo n.º 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('')
Ejemplo n.º 20
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.º 21
0
        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)
Ejemplo n.º 22
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.º 23
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.º 24
0
    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!"
    )
    with open(_f_, 'w') as _w_:
        _w_.write('')
Ejemplo n.º 25
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.º 26
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.º 27
0
    )
    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
                                  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.º 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
    "(T⌓T)",
    "(༎ຶ⌑༎ຶ)",
    "(☍﹏⁰)。",
    "(ಥ_ʖಥ)",
    "(つд⊂)",
    "(≖͞_≖̥)",
    "(இ﹏இ`。)",
    "༼ಢ_ಢ༽",
    "༼ ༎ຶ ෴ ༎ຶ༽",
]

DOUBT = [
    "Doubt",
    "Are you sure?",
    "Sure about that?",
    "Really?",
]

register_module_desc(
    "Memes! Contains data for the other meme modules and can't be used.")
register_module_info(name="Memes - common data",
                     authors="githubcatw, @BottomTextBot, 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('')