示例#1
0

async def updateme_requirements():
    reqs = str(requirements_path)
    try:
        process = await asyncio.create_subprocess_shell(
            ' '.join([sys.executable, "-m", "pip", "install", "-r", reqs]),
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE)
        await process.communicate()
        return process.returncode
    except Exception as e:
        return repr(e)


@borg.on(admin_cmd(pattern="updt ?(.*)"))
async def upstream(ups):
    "For .update command, check if the bot is up to date, update if specified"
    await ups.edit("** Checking for new updates 🧐🧐**")
    conf = ups.pattern_match.group(1)
    off_repo = UPSTREAM_REPO_URL
    force_updateme = False

    try:
        txt = "`Oops.. Updater cannot continue as "
        txt += "some problems occured`\n\n**LOGTRACE:**\n"
        repo = Repo()
    except NoSuchPathError as error:
        await ups.edit(f'{txt}\n`directory {error} is not found`')
        repo.__del__()
        return
示例#2
0
                    admin = chat.admin_rights
                    creator = chat.creator
                    if admin or creator:
                        try:
                            await client.edit_permissions(tele.chat_id,
                                                          guser.id,
                                                          view_messages=False)
                            await tele.reply(
                                f"**Gbanned User Joined!!!**\n"
                                f"**Victim Id**: [{guser.id}](tg://user?id={guser.id})\n"
                                f"**Action** : **Banned**")
                        except:
                            return


@borg.on(admin_cmd(pattern="gban(?: |$)(.*)"))
async def gspider(rk):
    lazy = rk
    sender = await lazy.get_sender()
    me = await lazy.client.get_me()
    if not sender.id == me.id:
        rkp = await lazy.reply("**GBANNING THE USER...**")
    else:
        rkp = await lazy.edit("**PROCESSING...**")
    me = await rk.client.get_me()
    await rkp.edit(f"**GBANNING THE USER!!!**")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    my_username = f"@{me.username}" if me.username else my_mention
    chat = await rk.get_chat()
    a = b = 0
    if rk.is_private:
示例#3
0
    with io.BytesIO(str.encode(the_real_message)) as out_file:
        out_file.name = "raw_message_data.txt"
        await event.edit(
            f"`{JAVES_NNAME}:  `i have sent decoded message data in my chat!")
        await event.client.send_file(
            BOTLOG_CHATID,
            out_file,
            force_document=True,
            allow_cache=False,
            reply_to=reply_to_id,
            caption="`Here's the decoded message data !!`")




@javes.on(admin_cmd(pattern=f"sysd$", allow_sudo=True))
async def sysdetails(sysd):
    """ For .sysd command, get system info using neofetch. """
    try:
        neo = "neofetch --stdout"
        fetch = await asyncrunapp(
            neo,
            stdout=asyncPIPE,
            stderr=asyncPIPE,
        )

        stdout, stderr = await fetch.communicate()
        result = str(stdout.decode().strip()) \
            + str(stderr.decode().strip())

        await sysd.reply("`" + result + "`")
async def get_user_from_id(user, event):
    if isinstance(user, str):
        user = int(user)
    try:
        user_obj = await event.bot.get_entity(user)
    except (TypeError, ValueError) as err:
        await event.edit(str(err))
        return None
    return user_obj
   
from userbot import bot, bot

                    
                   

@bot.on(admin_cmd(pattern=f"gban(?: |$)(.*)", allow_sudo=True))
@command(outgoing=True, pattern="^.gban(?: |$)(.*)")
async def gspider(rk): 
   lazy = rk ; sender = await lazy.get_sender() ; me = await lazy.bot.get_me()
   if not sender.id == me.id:
        rkp = await lazy.reply("`processing...`")
   else:
    	rkp = await lazy.edit("`processing...`")      
   me = await rk.bot.get_me() ; await rkp.edit(f"`{DEFAULTUSER}:` **Requesting  to gban user!**") ; my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id) ; my_username = f"@{me.username}" if me.username else my_mention ; chat = await rk.get_chat() ; a = b = 0
   if rk.is_private:       
   	user = rk.chat ; reason = rk.pattern_match.group(1) ; chat_title = 'PM'  
   else:
   	chat_title = rk.chat.title  
   try:       
    user, reason = await get_user_from_event(rk)  
   except:
示例#5
0
@javes05(outgoing=True, pattern="^\!javes$")
async def amireallyalive(alive):
    """ For .javes command, check if the bot is running.  """
    await alive.edit(""
                     f" **{ALIVE_S_MMSG}**\n"
                     f"---------------------------\n"
                     f"  >`{JAVES_NNAME}`: ** 2.5.1**\n"
                     f"  >`Telethon`: ** {version.__version__} **\n"
                     f"  >`Python` : ** {python_version()} **\n"
                     f"  >`User:` ** {DEFAULTUSER} **\n"
                     f"---------------------------\n"
                     f" **{ALIVE_E_MMSG}**")


@bot.on(admin_cmd(pattern=f"sudo$", allow_sudo=True))
async def iqless(e):
    await e.reply(""
                  f" **Hello Sir Iam Alive!**\n"
                  f"---------------------------\n"
                  f"  >`{JAVES_NNAME}`: ** 2.5.1**\n"
                  f"  >`Telethon`: ** {version.__version__} **\n"
                  f"  >`Python` : ** {python_version()} **\n"
                  f"  >`User:` ** Sudo **\n"
                  f"---------------------------")


requirements_path = path.join(
    path.dirname(path.dirname(path.dirname(__file__))), 'requirements.txt')

示例#6
0
        try:
            val = var.pattern_match.group(2).split()[0]
        except IndexError:
            return await var.edit(
                "`Please specify config vars you want to delete`")
        await asyncio.sleep(1.5)
        if val in heroku_var:
            await var.edit(
                f"**{val}**  `successfully deleted`\n Restarting......")
            del heroku_var[val]
        else:
            return await var.edit(f"**{val}**  `is not exists`")


@javes.on(
    admin_cmd(pattern=f"(set|get|del) var(?: |$)(.*)(?: |$)([\s\S]*)",
              allow_sudo=True))
async def variable(var):
    try:
        Heroku = heroku3.from_key(HEROKU_API_KEY)
        app = Heroku.app(HEROKU_APP_NAME)
    except:
        return await var.reply(
            " `Please make sure your Heroku API Key, Your App name are configured correctly in the heroku var` please check https://telegra.ph/RkPavi-06-09-6"
        )
    if not FULL_SUDO:
        await var.reply(
            f"`{JAVES_NNAME}:` **Sorry , Normal Sudo cant acess this comand,  active advance sudo by set  FULL_SUDO as true in heroku var**"
        )
    else:
        """
        Manage most of ConfigVars setting, set new var, get current var,
示例#7
0
# created by @eve_enryu

from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError

from userbot import CMD_HELP, bot
from userbot.events import admin_cmd


@borg.on(admin_cmd(pattern="firmware(?: |$)(.*)"))
async def _(event):
    if event.fwd_from:
        return
    link = event.pattern_match.group(1)
    firmware = f"firmware"
    await event.edit("```Processing```")
    async with bot.conversation("@XiaomiGeeksBot") as conv:
        try:
            response = conv.wait_event(
                events.NewMessage(incoming=True, from_users=774181428)
            )
            await conv.send_message(f"/{firmware} {link}")
            response = await response
        except YouBlockedUserError:
            await event.reply("```Unblock @XiaomiGeeksBot plox```")
            return
        else:
            await event.delete()
            await bot.forward_messages(event.chat_id, response.message)
        await bot.send_read_acknowledge(conv.chat_id)
示例#8
0

async def updateme_requirements():
    reqs = str(requirements_path)
    try:
        process = await asyncio.create_subprocess_shell(
            ' '.join([sys.executable, "-m", "pip", "install", "-r", reqs]),
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE)
        await process.communicate()
        return process.returncode
    except Exception as e:
        return repr(e)


@telebot.on(admin_cmd(pattern="update ?(.*)"))
async def upstream(ups):
    "For .update command, check if the bot is up to date, update if specified"
    await ups.edit("`Searching for new updates, if any...`")
    conf = ups.pattern_match.group(1)
    off_repo = UPSTREAM_REPO_URL
    force_updateme = False

    try:
        txt = "`Oops.. Updater cannot continue as "
        txt += "some problems occured`\n\n**LOGTRACE:**\n"
        repo = Repo()
    except NoSuchPathError as error:
        await ups.edit(f'{txt}\n`directory {error} is not found`')
        repo.__del__()
        return