Пример #1
0
async def _(event):
    if event.fwd_from:
        return
    animation_interval = 0.3
    animation_ttl = range(0, 16)
    input_str = event.pattern_match.group(1)
    if input_str == "repo":
        await event.edit(f"Checkout  my Repo [ @GITHUB]({REPOLINK}) ")
    elif input_str == "heroku":
        await event.edit(f"**Click** [here]({DEPLOYLINK}) **to goto the heroku deploy page.**")
    elif input_str == "packs":
        await event.edit(f"**Found the following sticker pack data:**\n{PACKS}")
    elif input_str == "guide":
        await event.edit(f"[ Follow this Guide ](https://authoritydmc.github.io/BEASTBOT-REBORN/)")
    else:
        pass
        
        
SYNTAX.update({
    "get": "\
**Requested Module --> get**\
\nDetailed usage of fuction(s):\
\n\n```.get repo```\
\nUsage: Prints github repoistory link defined in the env variable [REPO_LINK].\
\n\n```.get heroku```\
\nUsage: Prints the heroku deploy link defined in the env variable [DEPLOY_LINK].\
\n\n```.get packs```\
\nUsage: Prints the sticker pack data defined in the env variable [PACKS_CONTENT].\
"
})
Пример #2
0
        await results[0].click(event.chat_id,
                               reply_to=event.reply_to_msg_id,
                               hide_via=True)
        await event.delete()
    else:
        # await event.reply(help_string + "\n\n")
        await event.delete()
        await borg.send_message(event.chat_id,
                                help_string + "\n\n",
                                silent=True,
                                link_preview=False)


def get_size(bytes, suffix="B"):
    factor = 1024
    for unit in ["", "K", "M", "G", "T", "P"]:
        if bytes < factor:
            return f"{bytes:.2f}{unit}{suffix}"
        bytes /= factor


SYNTAX.update({
    "alive":
    "\
**Requested Module --> alive**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.alive```\
\nUsage: Returns BEASTBOT-REBORN's system stats, user's name (only if set).\
"
})
Пример #3
0
        return
    if Config.USER is not None:
        user = f"\n```User: {Config.USER}```"
    else:
        user = "******"
    uname = platform.uname()
    memory = psutil.virtual_memory()
    specs = f"```System: {uname.system}```\n```Release: {uname.release}```\n```Version: {uname.version}```\n```Processor: {uname.processor}```\n```Memory [RAM]: {get_size(memory.total)}```"
    help_string = f"`🔶🔶🔶🔶🔶🔶🔶🔶🔶🔶\n`**General Account Analysis:**\n```🔧Build: {BUILD}```\nUser: {str(user)}\n```By: @Mr_Tavish007```\n\n**⚙️System Specifications:**\n{specs}\n```🐍Python {sys.version}```\n```💾Telethon {__version__}```\n[🔶🔶🔶🔶🔶🔶🔶🔶🔶🔶](https://da.gd/EMw5)"
    await event.reply(help_string + "\n\n")
    await event.delete()


def get_size(bytes, suffix="B"):
    factor = 1024
    for unit in ["", "K", "M", "G", "T", "P"]:
        if bytes < factor:
            return f"{bytes:.2f}{unit}{suffix}"
        bytes /= factor


SYNTAX.update({
    "help":
    "\
**Requested Module --> help**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.help```\
\nUsage: Returns userbot's system stats, user's name (only if set).\
"
})
Пример #4
0
def progress(current, total):
    logger.info("Uploaded: {} of {}\nCompleted {}".format(
        current, total, (current / total) * 100))


def find_instance(items, class_or_tuple):
    for item in items:
        if isinstance(item, class_or_tuple):
            return item
    return None


def zipdir(path, ziph):
    # ziph is zipfile handle
    for root, dirs, files in os.walk(path):
        for file in files:
            ziph.write(os.path.join(root, file))
            os.remove(os.path.join(root, file))
            
            
            
SYNTAX.update({
    "kang": "\
**Requested Module --> kang**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.kang <optional_emoji>```\
\nUsage: Adds sticker to your own sticker pack! [NAME = env variables ANIM_PACK_NAME, PACK_NAME]\
"
})
Пример #5
0
    async with borg.conversation(bot) as bot_conv:
        if True:
            response = await silently_send_message(bot_conv, "/start")
            if not response.text.startswith("Hey!"):
                await event.edit(f"{response.text}")
                return
            response = await silently_send_message(bot_conv,
                                                   f"/GetLatestOTA {model}")
            if response.text.startswith("There"):
                await event.edit(f"{response.text}")
                return
            await event.edit(response.text)


async def silently_send_message(conv, text):
    await conv.send_message(text)
    response = await conv.get_response()
    await conv.mark_read(message=response)
    return response


SYNTAX.update({
    "rmota":
    "\
**Requested Module --> rmota**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.rmota <device_model>```\
\nUsage: Returns latest update info for specified device.\nUses @Realme_3ProBot to get update information.\
"
})
Пример #6
0
        await event.edit("Error! Please try again later")


@borg.on(admin_cmd(pattern="unshorten (.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    if not input_str.startswith("http"):
        input_str = "http://" + input_str
    r = requests.get(input_str, allow_redirects=False)
    if str(r.status_code).startswith('3'):
        await event.edit("Input URL: {}\nReDirected URL: {}".format(
            input_str, r.headers["Location"]))
    else:
        await event.edit("Input URL {} returned status_code {}".format(
            input_str, r.status_code))


SYNTAX.update({
    "dagd":
    "\
**Requested Module --> dagd**\
\nDetailed usage of fuction(s):\
\n\n```.shorten <input_link>```\
\nUsage: Create a shortened da.gd link using <input_link>.\
\n\n```.unshorten <da.gd link>```\
\nUsage: Unshorten a da.gd link.\
"
})
Пример #7
0
    for a_user in approved_users:
        if a_user.reason:
            APPROVED_PMs += f"👉 [{a_user.chat_id}](tg://user?id={a_user.chat_id}) for {a_user.reason}\n"
        else:
            APPROVED_PMs += f"👉 [{a_user.chat_id}](tg://user?id={a_user.chat_id})\n"
    if len(APPROVED_PMs) > Config.MAX_MESSAGE_SIZE_LIMIT:
        with io.BytesIO(str.encode(APPROVED_PMs)) as out_file:
            out_file.name = "approved.pms.text"
            await borg.send_file(event.chat_id,
                                 out_file,
                                 force_document=True,
                                 allow_cache=False,
                                 caption="Current Approved PMs",
                                 reply_to=event)
            await event.delete()
    else:
        await event.edit(APPROVED_PMs)


SYNTAX.update({
    "pmpermit":
    "\
**Requested Module --> pmpermit**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.approve```\
\nUsage: Approve a user in PMs.\
\n\n```.block```\
\nUsage: Block a user from your PMs.\
"
})
Пример #8
0
    else:
        mentions = "Bots in {} channel: \n".format(input_str)
        try:
            chat = await borg.get_entity(input_str)
        except Exception as e:
            await event.edit(str(e))
            return None
    try:
        async for x in borg.iter_participants(chat,
                                              filter=ChannelParticipantsBots):
            if isinstance(x.participant, ChannelParticipantAdmin):
                mentions += "\n ⚜️ [{}](tg://user?id={}) `{}`".format(
                    x.first_name, x.id, x.id)
            else:
                mentions += "\n [{}](tg://user?id={}) `{}`".format(
                    x.first_name, x.id, x.id)
    except Exception as e:
        mentions += " " + str(e) + "\n"
    await event.edit(mentions)


SYNTAX.update({
    "bots":
    "\
**Requested Module --> bots**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.bots```\
\nUsage: Prints all the bots in the current chat.\
"
})
Пример #9
0
            user_id = "Unknown user"
            noformat_userid = "Unknown user"
        if noformat_userid in SUDO_USERS:
            await event.edit(
                "**Wait! WHAT?!\nDid you just try to insult my creator?!?!\nBYE!**"
            )
            sys.exit()
            # probably not needed but meh
            break
        else:
            await event.edit(insult)
            time.sleep(2)
            status = f"Insulted [{user_id}] with:\n\n{log_insults}"
            await log(status)


async def log(text):
    LOGGER = Config.PRIVATE_GROUP_BOT_API_ID
    await borg.send_message(LOGGER, text)


SYNTAX.update({
    "insult":
    "\
**Requested Module --> insult**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.insult <optional_number_of_insults>``` [optionally as a reply to target user][default = 5]\
\nUsage: Insults target user.\
"
})
Пример #10
0
    input_str = event.pattern_match.group(1)
    if input_str:
        input_str = input_str.lower()
    if r % 2 == 1:
        if input_str == "heads":
            await event.edit("**Heads**. \n You were correct.")
        elif input_str == "tails":
            await event.edit("**Heads**. \n Better luck next time!...")
        else:
            await event.edit("**Heads**.")
    elif r % 2 == 0:
        if input_str == "tails":
            await event.edit("**Tails**. \n You were correct.")
        elif input_str == "heads":
            await event.edit("**Tails**. \n Better luck next time!...")
        else:
            await event.edit("**Tails**.")
    else:
        await event.edit("¯\_(ツ)_/¯")


SYNTAX.update({
    "coinflip":
    "\
**Requested Module --> coinflip**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.coinflip <optional_choice>```\
\nUsage: Flips a virtual coin and prints the outcome, test your lcuk!\
"
})
Пример #11
0
    except Exception as e:
        if " not found" in str(e) or "'file'" in str(e):
            await log(str(e))
            return await event.delete()
        elif " depth exceeded" in str(e):
            file.remove(force=True)
            await log(str(e))
        else:
            await log(str(e))
            return await event.delete()

SYNTAX.update({
    "leech2drive": "\
**Requested Module --> leech2drive**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.l2d <magnet-link> (or as a reply to a magnet link)```\
\nUsage: Mirrors the torrent to gdrive.\
\n\n```.l2d setup```\
\nUsage: Get gdrive setup guide.\
"
})

SYNTAX.update({
    "leech": "\
**Requested Module --> leech**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.leech <magnet-link> (or as a reply to a magnet link)```\
\nUsage: Downloads the torrent to the local machine.\
"
})

SYNTAX.update({
Пример #12
0
from telethon.tl import functions, types
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST


MODULE_LIST.append("spam")


@borg.on(events.NewMessage(pattern=r"\.spam", outgoing=True))
async def spammer(e):
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        message = e.text
        if type(message[8]) == str:
            counter = int(message[6:8])
            spam_message = str(e.text[8:])
        else:
            counter = int(message[6:9])
            spam_message = str(e.text[9:])
    for spam in range(counter):
        await e.delete()
        await e.reply(spam_message)



SYNTAX.update({
    "spam": "\
**Requested Module --> spam**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.spam <number of msgs> <text>```\
\nUsage: Spam a specified message upto 999 times.\
"
})
Пример #13
0
                await message.edit("Please create the var `HEROKU_APP_NAME` as the key and the name of your bot in heroku as your value.")
                return
        else:
            await message.edit(NO_HEROKU_APP_CFGD)
    else:
        msg="""No `HEROKU_API_KEY` found in config
        \nGoto https://dashboard.heroku.com/account\nThere  after scrolling a bit you will see API key tab .. \nclick on **reveal** button you will see your **API key** \n**copy it**
        \nNow goto **Heroku>your app >Settings>Reveal Config vars**
        \nNow add `HEROKU_API_KEY` with copied API key"""
        await message.edit(msg)
        

def generate_change_log(git_repo, diff_marker):
    out_put_str = ""
    d_form = "%d/%m/%y"
    for repo_change in git_repo.iter_commits(diff_marker):
        out_put_str += f"•[{repo_change.committed_datetime.strftime(d_form)}]: {repo_change.summary} <{repo_change.author}>\n"
    return out_put_str

async def deploy_start(borg, message, refspec, remote):
    await message.edit(RESTARTING_APP)
    await message.edit("Updating and Deploying New Branch. Please wait for 5 minutes then use `.alive` to check if i'm working or not.")
    await remote.push(refspec=refspec)
    await borg.disconnect()
    os.execl(sys.executable, sys.executable, *sys.argv)

SYNTAX.update({"update":"""
\nUpdate your bot with the latest update on Official Repo.
\nBut first set HEROKU_API_KEY first .
\nIf you have more than one bot set HEROKU_APP_NAME too
"""})
Пример #14
0
    o = stdout.decode()
    if not o:
        o = "**Tip**: \n`Use .syntax bash to get help regarding this module.`"
    else:
        _o = o.split("\n")
        o = "`\n".join(_o)
    OUTPUT = f"**QUERY:**\n__Command:__\n`{cmd}` \n__PID:__\n`{process.pid}`\n\n**stderr:** \n`{e}`\n**Output:**\n{o}"
    if len(OUTPUT) > Config.MAX_MESSAGE_SIZE_LIMIT:
        with io.BytesIO(str.encode(OUTPUT)) as out_file:
            out_file.name = "exec.text"
            await borg.send_file(
                event.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption=cmd,
                reply_to=reply_to_id
            )
            await event.delete()
    await event.edit(OUTPUT)


SYNTAX.update({
    "bash": "\
**Requested Module --> bash**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.bash <code>```\
\nUsage: Evaluate bash code.\
"
})
Пример #15
0
        'ffmpeg',
        '-i',
        file,
        '-ss',
        str(
            int((0, metadata.get('duration').seconds)[metadata.has('duration')]
                / 2)),
        '-filter:v',
        'scale={}:-1'.format(width),
        '-vframes',
        '1',
        output,
    ],
                         stdout=subprocess.PIPE,
                         stderr=subprocess.DEVNULL)
    if not p.returncode and os.path.lexists(file):
        return output


SYNTAX.update({
    "upload":
    "\
**Requested Module --> upload**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.file <file_location>```\
\nUsage: Upload a file from your local machine.\
\n\n```.dir <dir_location>```\
\nUsage: Upload a directory from your local machine.\
"
})
Пример #16
0
from telethon import events
from datetime import datetime
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("ping")


@borg.on(admin_cmd("ping"))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    await event.edit("Pong!")
    end = datetime.now()
    ms = (end - start).microseconds / 1000
    await event.edit("Pong!\n{}".format(ms))


SYNTAX.update({
    "ping":
    "\
**Requested Module --> ping**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.ping```\
\nUsage: Check your internet connection's ping speed.\
"
})
Пример #17
0
    if len(final_output) > Config.MAX_MESSAGE_SIZE_LIMIT:
        with io.BytesIO(str.encode(final_output)) as out_file:
            out_file.name = "eval.text"
            await borg.send_file(event.chat_id,
                                 out_file,
                                 force_document=True,
                                 allow_cache=False,
                                 caption=cmd,
                                 reply_to=reply_to_id)
            await event.delete()
    else:
        await event.edit(final_output)


async def aexec(code, event):
    exec(f'async def __aexec(event): ' + ''.join(f'\n {l}'
                                                 for l in code.split('\n')))
    return await locals()['__aexec'](event)


SYNTAX.update({
    "python":
    "\
**Requested Module --> python**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.python <python_code>```\
\nUsage: Evaluate python code.\
"
})
Пример #18
0
                # re-generate session
                session = api_client.create_session()
                logger.info(session)
                session_id = session.id
                session_expires = session.expires
                logger.info(
                    add_s(user_id, chat_id, session_id, session_expires))
            # Try to think a thought.
            try:
                async with event.client.action(event.chat_id, "typing"):
                    await asyncio.sleep(1)
                    output = api_client.think_thought(session_id, query)
                    await event.reply(output)
            except cf.exception.CoffeeHouseError as e:
                logger.info(str(e))


SYNTAX.update({
    "lydia":
    "\
**Requested Module --> lydia**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.enableai (as a reply to target user)```\
\nUsage: Enables LydiaAI for the target user in the current chat.\
\n\n```.disableai (as a reply to target user)```\
\nUsage: Disables LydiaAI for the target user in the current chat.\
\n\n```.listai (as a reply to target user)```\
\nUsage: Lists all users on which LydiaAI is enabled.\
"
})
Пример #19
0
    for insulting in range(args):
        start = random.choice(starts)
        parts_ch = random.choice(parts)
        animal_ch=random.choice(animal)
        man_slang_ch = random.choice(man_slang)
        end = random.choice(ends)
        insult = start+","+animal_ch+" के "+parts_ch+"\n"+man_slang_ch+" "+end
        insults+="\n"+insult
        await event.edit(insult)
        time.sleep(1)
        log_insults += f"```{insult}```\n\n"
    #send message now
    await event.edit(insults)
    time.sleep(2)
    await borg.send_message(
            LOGGER,
            f"Insulted [{user_id}] with:\n\n{log_insults}"
       )
       
       
       
SYNTAX.update({
    "gali": "\
**Requested Module --> gali**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.gali <optional_number_of_insults>``` [optionally as a reply to target user][default = 1]\
\nUsage: टारगेट यूजर को गाली दे :>: .\
"
})
Пример #20
0
                downloaded_file_name,
                force_document=True,
                supports_streaming=False,
                allow_cache=False,
                reply_to=event.message.id,
                thumb=thumb,
                progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
                    progress(d, t, event, c_time, "trying to upload")
                )
            )
            end_two = datetime.now()
            os.remove(downloaded_file_name)
            ms_two = (end_two - end).seconds
            total_ms = int(ms_one) + int(ms_two)
            await event.edit(f"Uploaded renamed file ```{input_str}``` in {ms_two} seconds!")

        else:
            await event.edit("File {} not found.".format(input_str))
    else:
        await event.edit("Syntax // .rnupload file.name as reply to a Telegram media")


SYNTAX.update({
    "rename": "\
**Requested Module --> rename**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.rename <new_file_name>``` [as a reply to a target file]\
\nUsage: Renames the target file to <new_file_name>.\
"
})
Пример #21
0
MODULE_LIST.append("type")

@borg.on(events.NewMessage(pattern=r"\.type (.*)", outgoing=True))
async def _(event):
    if event.fwd_from:
        return
    # https://t.me/AnotherGroup/176551
    input_str = event.pattern_match.group(1)
    typing_symbol = "|"
    DELAY_BETWEEN_EDITS = 0.3
    previous_text = ""
    await event.edit(typing_symbol)
    await asyncio.sleep(DELAY_BETWEEN_EDITS)
    for character in input_str:
        previous_text = previous_text + "" + character
        typing_text = previous_text + "" + typing_symbol
        await event.edit(typing_text)
        await asyncio.sleep(DELAY_BETWEEN_EDITS)
        await event.edit(previous_text)
        await asyncio.sleep(DELAY_BETWEEN_EDITS)



SYNTAX.update({
    "type": "\
**Requested Module --> type**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.type <text_to_type>```\
\nUsage: Type text with a fancy typing animation.\
"
})
Пример #22
0
async def _(prg):
    if prg.fwd_from:
        return
    if not prg.text[0].isalpha():
        await prg.edit("**Purging all notes.**")
        await prg.edit(
            "**All notes have been purged successfully.**\n```This auto generated message will be deleted in a few seconds...```"
        )
        rm_all_notes(str(prg.chat_id))
        time.sleep(5)
        await prg.delete()
        if LOGGER:
            await borg.send_message(
                LOGGER,
                f"**Successfully purged all notes at** ```{prg.chat_id}```")


SYNTAX.update({
    "notes":
    "\
```.get <notename>```\
\nUsage: Gets the note with name <notename>\
\n\n```.save <notename>``` (as a reply to message to save)\
\nUsage: Saves target message as a note with the name <notename>\
\n\n```.clear <notename>```\
\nUsage: Deletes the note with name <notename>.\
\n\n```.notes <notename>```\
\nUsage: Prints the list of notes saved in the current chat.\
"
})
Пример #23
0
                afk_since = f"`{int(hours)}h{int(minutes)}m` **ago**"
            elif minutes > 0:
                afk_since = f"`{int(minutes)}m{int(seconds)}s` **ago**"
            else:
                afk_since = f"`{int(seconds)}s` **ago**"
        msg = None
        message_to_reply = f"**My Master is AFK since** {afk_since} " + \
            f"**cuz {reason}**" \
            if reason \
            else f"**My Master is AFK since** {afk_since}"
        msg = await event.reply(message_to_reply)
        await asyncio.sleep(5)
        if event.chat_id in borg.storage.last_afk_message:  # pylint:disable=E0602
            await borg.storage.last_afk_message[event.chat_id].delete()  # pylint:disable=E0602
        borg.storage.last_afk_message[event.chat_id] = msg  # pylint:disable=E0602


async def log(text):
    LOGGER = Config.PRIVATE_GROUP_BOT_API_ID
    await borg.send_message(LOGGER, text)


SYNTAX.update({
    "afk":
    "\
**Requested Module --> afk**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.afk <optional_reason>```\
\nUsage: Changed afk mode to **true**.\
"
})
Пример #24
0
                ''.join(["░" for i in range(20 - math.floor(percentage / 5))]),
                round(percentage, 2))
            estimated_total_time = downloader.get_eta(human=True)
            try:
                current_message = f"trying to download\nURL: {url}\nFile Name: {file_name}\n{progress_str}\n{humanbytes(downloaded)} of {humanbytes(total_length)}\nETA: {estimated_total_time}"
                if current_message != display_message:
                    await mone.edit(current_message)
                    display_message = current_message
            except Exception as e:
                logger.info(str(e))
        end = datetime.now()
        ms = (end - start).seconds
        if downloader.isSuccessful():
            await mone.edit("Downloaded to `{}` in {} seconds.".format(downloaded_file_name, ms))
        else:
            await mone.edit("Incorrect URL\n {}".format(input_str))
    else:
        await mone.edit("Reply to a message to download to my local server.")


SYNTAX.update({
    "download": "\
**Requested Module --> download**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.localdl (as a reply to a telegram media file)```\
\nUsage: Downloads the target file to the temporary local download directory.\
\n\n```.directdl <direct_dl_link>```\
\nUsage: Attempts to download media from the provided link.\
"
})
Пример #25
0
import time
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("restart")


@borg.on(admin_cmd("restart"))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("Restarting...\n█████░░░")
    time.sleep(1)
    await event.edit("Restarting...\n████████")
    time.sleep(1)
    await event.edit("Restart Complete!\nSend .alive or .ping to check if i am online.")
    await borg.disconnect()
    # https://archive.is/im3rt
    os.execl(sys.executable, sys.executable, *sys.argv)
    # You probably don't need it but whatever
    quit()


SYNTAX.update({
    "restart": "\
**Requested Module --> restart**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.restart```\
\nUsage: Restart your userbot.\
"
})
Пример #26
0
    metadata = extractMetadata(createParser(file))
    p = subprocess.Popen([
        'ffmpeg',
        '-i',
        file,
        '-ss',
        str(
            int((0, metadata.get('duration').seconds)[metadata.has('duration')]
                / 2)),
        '-filter:v',
        'scale={}:-1'.format(width),
        '-vframes',
        '1',
        output,
    ],
                         stdout=subprocess.PIPE,
                         stderr=subprocess.DEVNULL)
    if not p.returncode and os.path.lexists(file):
        return output


SYNTAX.update({
    "share":
    "\
**Requested Module --> share**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.share <module_name>```\
\nUsage: Share a specified module.\
"
})
Пример #27
0
        mentions += "\n"
        async for x in borg.iter_participants(
                chat, filter=ChannelParticipantsAdmins):
            if not x.deleted:
                if isinstance(x.participant, ChannelParticipantAdmin):
                    mentions += "\n ⚜️ [{}](tg://user?id={}) `{}`".format(
                        x.first_name, x.id, x.id)
            else:
                mentions += "\n `{}`".format(x.id)
    except Exception as e:
        mentions += " " + str(e) + "\n"
    if should_mention_admins:
        if reply_message:
            await reply_message.reply(mentions)
        else:
            await event.reply(mentions)
        await event.delete()
    else:
        await event.edit(mentions)


SYNTAX.update({
    "report":
    "\
**Requested Module --> report**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.report``` [as a reply to a target message]\
\nUsage: Report the target message to the admins.\
"
})
Пример #28
0
        else:
            OUTPUT = f"**QUERY:**\n__Command:__\n`{cmd}` \n__PID:__\n`{process.pid}`\n**OUTPUT**\n`{o}`"
    else:
        if not "No Error" in e:
            OUTPUT = f"\n**stderror**\n{e}\n **OUTPUT**\n `{o}`"
        else:
            OUTPUT = f"**OUTPUT**\n`{o}`"
    if len(OUTPUT) > Config.MAX_MESSAGE_SIZE_LIMIT:
        with io.BytesIO(str.encode(OUTPUT)) as out_file:
            out_file.name = "exec.text"
            await borg.send_file(event.chat_id,
                                 out_file,
                                 force_document=True,
                                 allow_cache=False,
                                 caption=cmd,
                                 reply_to=reply_to_id)
            await event.delete()
    await event.edit(OUTPUT)


SYNTAX.update({
    "bash":
    "\
**Requested Module --> bash**\
\n\n**Detailed usage of fuction(s):**\
\n\nreply to any command with ```.bash [f]( f is optional)``\
\nUsage: Evaluate bash code.\
\nf is optional ,if supplied show full result\
"
})
Пример #29
0
        try:
            await borg(EditBannedRequest(event.chat_id, to_ban_id, rights))
        except (Exception) as exc:
            await event.edit(str(exc))
        try:
            await borg(EditBannedRequest(event.chat_id, to_ban_id, rights2))
        except (Exception) as exc:
            await event.edit(str(exc))
        else:
            await event.edit(f"```{to_ban_id}``` has been yeeted!")

SYNTAX.update({
    "admin": "\
**Requested Module --> admin**\
\n\n**Detailed usage of fuction(s)**:\
\n\n```.ban <userid>``` (or as a reply to a message of targer user)\
\nUsage: bans target user.\
\n\n```.unban <userid>``` (or as a reply to a message of targer user)\
\nUsage: unbans target user.\
\n\n```.mute <userid>``` (or as a reply to a message of targer user)\
\nUsage: mutes target user.\
\n\n```.unmute <userid>``` (or as a reply to a message of targer user)\
\nUsage: unmutes target user.\
\n\n```.promote <optional_rank>``` (must be a reply to a message of targer user)\
\nUsage: promotes target user.\
\n\n```.demote <userid>``` (or as a reply to a message of targer user)\
\nUsage: demotes target user.\
\n\n```.kick <userid>``` (or as a reply to a message of targer user)\
\nUsage: kicks target user.\
"
})
Пример #30
0
        return
    if text and count != None:
        await event.delete()
        for spam in range(int(count)):
            await event.reply(text)
        msg = await event.reply(
            f"Task complete, spammed input text {count} times!")
        sleep(5)
        await msg.delete()
        status = f"SPAMMED\n```{text}```\n in ```{chat}``` ```{count}``` times."
        await log(status)
    else:
        await event.edit("Unexpected Error! Aborting..")
        return


async def log(text):
    LOGGER = Config.PRIVATE_GROUP_BOT_API_ID
    await borg.send_message(LOGGER, text)


SYNTAX.update({
    "spam":
    "\
**Requested Module --> spam**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.spam <number of msgs> <text>```\
\nUsage: Spam a specified message upto the TG API limit (probably non existent but meh).\
"
})