Ejemplo n.º 1
0
async def fav_func(fav, answers):
    keyb = InlineKeyboard(row_width=1)
    if fav:
        text = '**My watchlist:**\n'
        for title in fav:
            text += f' - {title.data}\n'
        keyb.add(
            InlineKeyboardButton(
                text='Watched ✅', callback_data=f'remfav_{Owner}',
            ),
        )
        answers.append(
            InlineQueryResultArticle(
                title='Favourites',
                description='Anime',
                input_message_content=InputTextMessageContent(
                    text, parse_mode='markdown',
                ),
                reply_markup=keyb,
            ),
        )
    else:
        answers.append(
            InlineQueryResultArticle(
                title='Fabourites',
                description='Anime',
                input_message_content=InputTextMessageContent(
                    '**No favourites yet!**', parse_mode='markdown',
                ),
            ),
        )
Ejemplo n.º 2
0
async def get_myself(client, message):
    try:
        me = await app.get_me()
    except ConnectionError:
        await message.reply('Bot is currently turned off!')
        return
    text = '**Myself**\n'
    text += f' - **First name**: `{me.first_name}`\n'
    if me.last_name:
        text += f' - **Last name**: `{me.last_name}`\n'
    text += f' - **User ID**: `{me.id}`\n'
    if me.username:
        text += f' - **Username**: `@{me.username}`\n'
    text += f' - **Phone number**: `{me.phone_number}`\n'
    text += f' - **Nana Version**: `v{USERBOT_VERSION}`\n'
    text += f' - **Manager Version**: `v{ASSISTANT_VERSION}`'
    button = InlineKeyboard(row_width=1)
    button.add(
        InlineKeyboardButton('Hide phone number', callback_data='hide_number'),
    )
    if me.photo:
        getpp = await client.download_media(
            me.photo.big_file_id,
            file_name='nana/downloads/pfp.png',
        )
        await message.reply_photo(
            photo=getpp,
            caption=text,
            reply_markup=button,
        )
    else:
        await message.reply(text, reply_markup=button)
    if os.path.exists(getpp):
        os.remove(getpp)
Ejemplo n.º 3
0
async def deezer_func(answers, text):
    buttons_list = []
    results = await arq.deezer(text, 5)
    for i in results:
        buttons = InlineKeyboard(row_width=1)
        buttons.add(InlineKeyboardButton("Download | Play", url=results[i].url))
        buttons_list.append(buttons)
        duration = await time_convert(results[i].duration)
        caption = f"""
**Title:** {results[i].title}
**Artist:** {results[i].artist}
**Duration:** {duration}
**Source:** [Deezer]({results[i].source})"""
        description = f"{results[i].artist} | {duration}"
        try:
            answers.append(
                InlineQueryResultArticle(
                    title=results[i].title,
                    thumb_url=results[i].thumbnail,
                    description=description,
                    input_message_content=InputTextMessageContent(
                        caption, disable_web_page_preview=True
                    ),
                    reply_markup=buttons_list[i],
                )
            )
        except (KeyError, ValueError):
            pass
    return answers
Ejemplo n.º 4
0
async def pmpermit_func(answers):
    button = InlineKeyboard(row_width=2)
    button.add(
        InlineKeyboardButton(
            'Ask for Money',
            callback_data='engine_pm_block',
        ),
        InlineKeyboardButton(
            'Contact me',
            callback_data='engine_pm_nope',
        ),
        InlineKeyboardButton(
            'Report',
            callback_data='engine_pm_report',
        ),
        InlineKeyboardButton(
            'Passing by',
            callback_data='engine_pm_none',
        ),
    )
    random.shuffle(button)
    answers.append(
        InlineQueryResultArticle(
            title='Engine pm',
            description='Filter pm',
            input_message_content=InputTextMessageContent(
                welc_txt,
                parse_mode='markdown',
            ),
            reply_markup=button,
        ), )
Ejemplo n.º 5
0
async def saavn_func(answers, text):
    buttons_list = []
    results = await arq.saavn(text)
    if not results.ok:
        answers.append(
            InlineQueryResultArticle(
                title="Error",
                description=results.result,
                input_message_content=InputTextMessageContent(results.result),
            ))
        return answers
    results = results.result
    for count, i in enumerate(results):
        buttons = InlineKeyboard(row_width=1)
        buttons.add(InlineKeyboardButton("Download | Play", url=i.media_url))
        buttons_list.append(buttons)
        duration = await time_convert(i.duration)
        caption = f"""
**Title:** {i.song}
**Album:** {i.album}
**Duration:** {duration}
**Release:** {i.year}
**Singers:** {i.singers}"""
        description = f"{i.album} | {duration} " + f"| {i.singers} ({i.year})"
        answers.append(
            InlineQueryResultArticle(
                title=i.song,
                input_message_content=InputTextMessageContent(
                    caption, disable_web_page_preview=True),
                description=description,
                thumb_url=i.image,
                reply_markup=buttons_list[count],
            ))
    return answers
Ejemplo n.º 6
0
async def speedtest_init(query):
    answers = []
    user_id = query.from_user.id
    if user_id not in SUDOERS:
        msg = "**ERROR**\n__THIS FEATURE IS ONLY FOR SUDO USERS__"
        answers.append(
            InlineQueryResultArticle(
                title="ERROR",
                description="THIS FEATURE IS ONLY FOR SUDO USERS",
                input_message_content=InputTextMessageContent(msg),
            )
        )
        return answers
    msg = "**Click The Button Below To Perform A Speedtest**"
    button = InlineKeyboard(row_width=1)
    button.add(
        InlineKeyboardButton(text="Test", callback_data="test_speedtest")
    )
    answers.append(
        InlineQueryResultArticle(
            title="Click Here",
            input_message_content=InputTextMessageContent(msg),
            reply_markup=button,
        )
    )
    return answers
Ejemplo n.º 7
0
async def inline_help_func(__HELP__):
    buttons = InlineKeyboard(row_width=4)
    buttons.add(
        *[
            (InlineKeyboardButton(text=i, switch_inline_query_current_chat=i))
            for i in keywords_list
        ]
    )
    answerss = [
        InlineQueryResultArticle(
            title="Inline Commands",
            description="Help Related To Inline Usage.",
            input_message_content=InputTextMessageContent(
                "Click A Button To Get Started."
            ),
            thumb_url="https://hamker.me/cy00x5x.png",
            reply_markup=buttons,
        ),
        InlineQueryResultArticle(
            title="Github Repo",
            description="Get Github Respository Of Bot.",
            input_message_content=InputTextMessageContent(
                "https://github.com/thehamkercat/WilliamButcherBot"
            ),
            thumb_url="https://hamker.me/gjc9fo3.png",
        ),
    ]
    answerss = await alive_function(answerss)
    return answerss
Ejemplo n.º 8
0
async def alive_function(answers):
    buttons = InlineKeyboard(row_width=1)
    bot_state = 'Dead' if not await app.get_me() else 'Alive'
    ubot_state = 'Dead' if not await app2.get_me() else 'Alive'
    buttons.add(InlineKeyboardButton('Stats', callback_data='stats_callback'))
    msg = f"""
**[William✨](https://github.com/thehamkercat/WilliamButcherBot):**
**MainBot:** `{bot_state}`
**UserBot:** `{ubot_state}`
**Python:** `{pyver.split()[0]}`
**Pyrogram:** `{pyrover}`
**MongoDB:** `{mongover}`
**Platform:** `{sys.platform}`
**Profiles:** [BOT](t.me/{BOT_USERNAME}) | [UBOT](t.me/{USERBOT_USERNAME})
"""
    answers.append(
        InlineQueryResultArticle(
            title='Alive',
            description="Check Bot's Stats",
            input_message_content=InputTextMessageContent(
                msg,
                disable_web_page_preview=True
            ),
            reply_markup=buttons,
        )
    )
    return answers
Ejemplo n.º 9
0
async def alive_func(answers):
    buttons = InlineKeyboard(row_width=1)
    try:
        me = await app.get_me()
    except ConnectionError:
        me = None
    nana_stats = 'stopped' if not me else 'alive'
    buttons.add(InlineKeyboardButton(
        '🏓',
        callback_data='alive_message',
    ), )
    answers.append(
        InlineQueryResultArticle(
            title='Alive',
            description='Nana Userbot',
            input_message_content=InputTextMessageContent(
                tld('alive_str').format(
                    nana_stats,
                    USERBOT_VERSION,
                    __version__,
                    python_version(),
                    DB_AVAILABLE,
                ),
                parse_mode='markdown',
                disable_web_page_preview=True,
            ),
            reply_markup=buttons,
        ), )
Ejemplo n.º 10
0
 async def capture(client, message, *args, **kwargs):
     try:
         return await func(client, message, *args, **kwargs)
     except Exception as err:
         exc_type, exc_obj, exc_tb = sys.exc_info()
         errors = traceback.format_exception(
             etype=exc_type,
             value=exc_obj,
             tb=exc_tb,
         )
         error_feedback = split_limits(
             '**ERROR** | `{}` | `{}`\n\n```{}```\n\n```{}```\n'.format(
                 0 if not message.from_user else message.from_user.id,
                 0 if not message.chat else message.chat.id,
                 message.text or message.caption,
                 ''.join(errors),
             ), )
         button = InlineKeyboard(row_width=1)
         button.add(
             InlineKeyboardButton(
                 '🐞 Report bugs',
                 callback_data='report_errors',
             ), )
         for x in error_feedback:
             await setbot.send_message(
                 Owner,
                 x,
                 reply_markup=button,
             )
         raise err
Ejemplo n.º 11
0
async def alive_function(answers):
    buttons = InlineKeyboard(row_width=2)
    bot_state = "Dead" if not await app.get_me() else "Alive"
    # ubot_state = 'Dead' if not await app2.get_me() else 'Alive'
    buttons.add(
        InlineKeyboardButton("Main Bot", url="https://t.me/Cutiepii_Robot"),
        InlineKeyboardButton("Go Inline!",
                             switch_inline_query_current_chat=""),
    )

    msg = f"""
**[Cutiepii 💜](https://github.com/Awesome-RJ/CutiepiiRobot):**
**MainBot:** `{bot_state}`
**UserBot:** `Alive`
**Python:** `3.9`
**Pyrogram:** `{pyrover}`
**MongoDB:** `{mongover}`
**Platform:** `{sys.platform}`
**Profiles:** [BOT](t.me/{BOT_USERNAME}) | [UBOT](t.me/Awesome_Cutiepii)
"""
    answers.append(
        InlineQueryResultArticle(
            title="Alive",
            description="Check Bot's Stats",
            thumb_url="https://telegra.ph/file/0d42f41c08e511b557ecc.png",
            input_message_content=InputTextMessageContent(
                msg, disable_web_page_preview=True),
            reply_markup=buttons,
        ))
    return answers
def start(app, message):
    utente_id = message.from_user.id

    link = app.get_chat(chatScommesse[0]).invite_link
    if link is None:
        link = app.export_chat_invite_link(chatScommesse[0])

    keyboard = InlineKeyboard(row_width=1)
    keyboard.add(InlineKeyboardButton("Entra nel gruppo 😃", url=link))

    if not is_utente(utente_id):
        try:
            utente_id_invito = str(message.command[1])[::-1]
            try:
                app.send_message(
                    utente_id_invito,
                    f"**{message.from_user.username}** si è appena registrato con il tuo codice di "
                    f"invito 🥳")
                setta_utente(message.from_user, utente_id_invito)
            except RPCError as e:
                print(str(e))
        except IndexError:
            pass

        app.send_message(
            message.chat.id,
            f"Benvenuto **{message.from_user.username}**!\nPer entrare nel gruppo premi qui sotto 👇🏻",
            reply_markup=keyboard)
    else:
        app.send_message(
            message.chat.id,
            "Sei già membro del gruppo!\nPer rientrare nel gruppo premi qui sotto 👇🏻",
            reply_markup=keyboard)
Ejemplo n.º 13
0
async def alive_function(answers):
    buttons = InlineKeyboard(row_width=2)
    bot_state = "Dead" if not await app.get_me() else "Alive"
    ubot_state = "Dead" if not await app2.get_me() else "Alive"
    buttons.add(
        InlineKeyboardButton("Stats", callback_data="stats_callback"),
        InlineKeyboardButton("Go Inline!",
                             switch_inline_query_current_chat=""),
    )

    msg = f"""
**[ReXoMa✨](https://t.me/RexomaBot):**
**MainBot:** `{bot_state}`
**UserBot:** `{ubot_state}`
**Python:** `{pyver.split()[0]}`
**Pyrogram:** `{pyrover}`
**MongoDB:** `{mongover}`
**Platform:** `{sys.platform}`
**Profiles:** [BOT](t.me/{BOT_USERNAME}) | [UBOT](t.me/{USERBOT_USERNAME})
"""
    answers.append(
        InlineQueryResultArticle(
            title="Alive",
            description="Check Bot's Stats",
            thumb_url="https://telegra.ph/file/76dc7a8a750513fd14699.jpg",
            input_message_content=InputTextMessageContent(
                msg, disable_web_page_preview=True),
            reply_markup=buttons,
        ))
    return answers
Ejemplo n.º 14
0
async def github_repo_func(answers, text):
    URL = f"https://api.github.com/repos/{text}"
    URL2 = f"https://api.github.com/repos/{text}/contributors"
    results = await asyncio.gather(fetch(URL), fetch(URL2))
    r = results[0]
    r1 = results[1]
    commits = 0
    for developer in r1:
        commits += developer['contributions']
    buttons = InlineKeyboard(row_width=1)
    buttons.add(
        InlineKeyboardButton('Open On Github',
                             url=f"https://github.com/{text}"))
    caption = f"""
**Info Of {r['full_name']}**
**Stars:** `{r['stargazers_count']}`
**Watchers:** `{r['watchers_count']}`
**Forks:** `{r['forks_count']}`
**Commits:** `{commits}`
**Is Fork:** `{r['fork']}`
**Language:** `{r['language']}`
**Contributors:** `{len(r1)}`
**License:** `{r['license']['name']}`
**Repo Owner:** [{r['owner']['login']}]({r['owner']['html_url']})
**Created On:** `{r['created_at']}`
**Homepage:** {r['homepage']}
**Description:** __{r['description']}__"""
    answers.append(
        InlineQueryResultArticle(title="Found Repo",
                                 description=text,
                                 reply_markup=buttons,
                                 input_message_content=InputTextMessageContent(
                                     caption, disable_web_page_preview=True)))
    return answers
Ejemplo n.º 15
0
async def paste_func(_, message):
    if not message.reply_to_message:
        return await message.reply_text("Reply To A Message With /paste")
    m = await message.reply_text("Pasting...")
    if message.reply_to_message.text:
        content = str(message.reply_to_message.text)
    elif message.reply_to_message.document:
        document = message.reply_to_message.document
        if document.file_size > 1048576:
            return await m.edit("You can only paste files smaller than 1MB.")
        if not pattern.search(document.mime_type):
            return await m.edit("Only text files can be pasted.")
        doc = await message.reply_to_message.download()
        async with aiofiles.open(doc, mode="r") as f:
            content = await f.read()
        os.remove(doc)
    link = await paste(content)
    preview = link + "/preview.png"
    button = InlineKeyboard(row_width=1)
    button.add(InlineKeyboardButton(text="Paste Link", url=link))

    if await isPreviewUp(preview):
        try:
            await message.reply_photo(photo=preview, quote=False, reply_markup=button)
            return await m.delete()
        except Exception:
            pass
    return await m.edit(link)
Ejemplo n.º 16
0
async def youtube_func(answers, text):
    results = await arq.youtube(text)
    if not results.ok:
        answers.append(
            InlineQueryResultArticle(
                title="Error",
                description=results.result,
                input_message_content=InputTextMessageContent(results.result),
            ))
        return answers
    results = results.result[0:48]
    for i in results:
        buttons = InlineKeyboard(row_width=1)
        video_url = f"https://youtube.com{i.url_suffix}"
        buttons.add(InlineKeyboardButton("Watch", url=video_url))
        caption = f"""
**Title:** {i.title}
**Views:** {i.views}
**Channel:** {i.channel}
**Duration:** {i.duration}
**Uploaded:** {i.publish_time}
**Description:** {i.long_desc}"""
        description = (
            f"{i.views} | {i.channel} | {i.duration} | {i.publish_time}")
        answers.append(
            InlineQueryResultArticle(
                title=i.title,
                thumb_url=i.thumbnails[0],
                description=description,
                input_message_content=InputTextMessageContent(
                    caption, disable_web_page_preview=True),
                reply_markup=buttons,
            ))
    return answers
Ejemplo n.º 17
0
async def github_user_func(answers, text):
    URL = f"https://api.github.com/users/{text}"
    result = await fetch(URL)
    buttons = InlineKeyboard(row_width=1)
    buttons.add(
        InlineKeyboardButton(
            text="Open On Github", url=f"https://github.com/{text}"
        )
    )
    caption = f"""
**Info Of {result['name']}**
**Username:** `{text}`
**Bio:** `{result['bio']}`
**Profile Link:** [Here]({result['html_url']})
**Company:** `{result['company']}`
**Created On:** `{result['created_at']}`
**Repositories:** `{result['public_repos']}`
**Blog:** `{result['blog']}`
**Location:** `{result['location']}`
**Followers:** `{result['followers']}`
**Following:** `{result['following']}`"""
    answers.append(
        InlineQueryResultPhoto(
            photo_url=result["avatar_url"],
            caption=caption,
            reply_markup=buttons,
        )
    )
    return answers
Ejemplo n.º 18
0
async def image_func(answers, query):
    results = await arq.image(query)
    if not results.ok:
        answers.append(
            InlineQueryResultArticle(
                title="Error",
                description=results.result,
                input_message_content=InputTextMessageContent(results.result),
            )
        )
        return answers
    results = results.result[0:48]
    buttons = InlineKeyboard(row_width=2)
    buttons.add(
        InlineKeyboardButton(
            text="Search again", switch_inline_query_current_chat="image"
        ),
    )
    for i in results:
        answers.append(
            InlineQueryResultPhoto(
                title=i.title,
                photo_url=i.url,
                thumb_url=i.url,
                reply_markup=buttons,
            )
        )
    return answers
Ejemplo n.º 19
0
async def pmpermit_func(answers, user_id, victim):
    if user_id != USERBOT_ID:
        return
    caption = f"Hi, I'm {USERBOT_NAME}, What are you here for?, You'll be blocked if you send more than 5 messages."
    buttons = InlineKeyboard(row_width=2)
    buttons.add(
        InlineKeyboardButton(
            text="To Scam You", callback_data="pmpermit to_scam_you a"
        ),
        InlineKeyboardButton(
            text="For promotion", callback_data="pmpermit to_scam_you a"
        ),
        InlineKeyboardButton(
            text="Approve me", callback_data="pmpermit approve_me a"
        ),
        InlineKeyboardButton(
            text="Approve", callback_data=f"pmpermit approve {victim}"
        ),
    )
    answers.append(
        InlineQueryResultArticle(
            title="do_not_click_here",
            reply_markup=buttons,
            input_message_content=InputTextMessageContent(caption),
        )
    )
    return answers
Ejemplo n.º 20
0
async def afk_mentioned(_, message):
    if not DB_AVAILABLE:
        return
    global MENTIONED
    get = get_afk()
    if get and get['afk']:
        if '-' in str(message.chat.id):
            cid = str(message.chat.id)[4:]
        else:
            cid = str(message.chat.id)

        if cid in list(AFK_RESTIRECT, ) and int(AFK_RESTIRECT[cid], ) >= int(
                time.time()):
            return
        AFK_RESTIRECT[cid] = int(time.time()) + DELAY_TIME
        if get['reason']:
            await edit_or_reply(
                message,
                text='Sorry, {} is AFK!\nReason: {}'.format(
                    mention_markdown(Owner, OwnerName),
                    get['reason'],
                ),
            )
        else:
            await edit_or_reply(
                message,
                text='Sorry, {} is AFK!'.format(
                    mention_markdown(Owner, OwnerName), ),
            )

        _, message_type = get_message_type(message)
        if message_type == Types.TEXT:
            text = message.text or message.caption
        else:
            text = message_type.name

        MENTIONED.append(
            {
                'user': message.from_user.first_name,
                'user_id': message.from_user.id,
                'chat': message.chat.title,
                'chat_id': cid,
                'text': text,
                'message_id': message.message_id,
            }, )
        button = InlineKeyboard(row_width=1)
        button.add(InlineKeyboardButton('🔗', url=message.link))
        await setbot.send_message(
            Owner,
            '{} mentioned you in {}\n\n{}\n\nTotal mentions: `{}`'.format(
                mention_markdown(
                    message.from_user.id,
                    message.from_user.first_name,
                ),
                message.chat.title,
                text[:3500],
                len(MENTIONED),
            ),
            reply_markup=button,
        )
Ejemplo n.º 21
0
async def pokedexinfo(answers, pokemon):
    Pokemon = f"https://some-random-api.ml/pokedex?pokemon={pokemon}"
    result = await fetch(Pokemon)
    buttons = InlineKeyboard(row_width=1)
    buttons.add(
        InlineKeyboardButton("Pokedex",
                             switch_inline_query_current_chat="pokedex"))
    caption = f"""
**Pokemon:** `{result['name']}`
**Pokedex:** `{result['id']}`
**Type:** `{result['type']}`
**Abilities:** `{result['abilities']}`
**Height:** `{result['height']}`
**Weight:** `{result['weight']}`
**Gender:** `{result['gender']}`
**Stats:** `{result['stats']}`
**Description:** `{result['description']}`"""
    answers.append(
        InlineQueryResultPhoto(
            photo_url=f"https://img.pokemondb.net/artwork/large/{pokemon}.jpg",
            title=result["name"],
            description=result["description"],
            caption=caption,
            reply_markup=buttons,
        ))
    return answers
Ejemplo n.º 22
0
async def send_welcome_message(callback_query, pending_user_id):
    try:
        raw_text = await get_welcome(callback_query.message.chat.id)
    except TypeError:
        return
    raw_text = raw_text.strip().replace("`", "")
    if not raw_text:
        return
    text = raw_text.split("~")[0].strip()
    buttons_text_list = raw_text.split("~")[1].strip().splitlines()
    if "{chat}" in text:
        text = text.replace("{chat}", callback_query.message.chat.title)
    if "{name}" in text:
        text = text.replace("{name}", (await
                                       app.get_users(pending_user_id)).mention)
    buttons = InlineKeyboard(row_width=2)
    list_of_buttons = []
    for button_string in buttons_text_list:
        button_string = button_string.strip().split("=")[1].strip()
        button_string = button_string.replace("[", "").strip()
        button_string = button_string.replace("]", "").strip()
        button_string = button_string.split(",")
        button_text = button_string[0].strip()
        button_url = button_string[1].strip()
        list_of_buttons.append(
            InlineKeyboardButton(text=button_text, url=button_url))
    buttons.add(*list_of_buttons)
    await app.send_message(
        callback_query.message.chat.id,
        text=text,
        reply_markup=buttons,
        disable_web_page_preview=True,
    )
Ejemplo n.º 23
0
async def alive_function(answers):
    buttons = InlineKeyboard(row_width=2)
    bot_state = "Dead" if not await app.get_me() else "Alive"
    ubot_state = "Dead" if not await app2.get_me() else "Alive"
    buttons.add(
        InlineKeyboardButton("Stats", callback_data="stats_callback"),
        InlineKeyboardButton("Go Inline!",
                             switch_inline_query_current_chat=""),
    )

    msg = f"""
**[William✨](https://github.com/thehamkercat/WilliamButcherBot):**
**MainBot:** `{bot_state}`
**UserBot:** `{ubot_state}`
**Python:** `{pyver.split()[0]}`
**Pyrogram:** `{pyrover}`
**MongoDB:** `{mongover}`
**Platform:** `{sys.platform}`
**Profiles:** [BOT](t.me/{BOT_USERNAME}) | [UBOT](t.me/{USERBOT_USERNAME})
"""
    answers.append(
        InlineQueryResultArticle(
            title="Alive",
            description="Check Bot's Stats",
            thumb_url=
            "https://static2.aniimg.com/upload/20170515/414/c/d/7/cd7EEF.jpg",
            input_message_content=InputTextMessageContent(
                msg, disable_web_page_preview=True),
            reply_markup=buttons,
        ))
    return answers
Ejemplo n.º 24
0
async def youtube_func(answers, text):
    results = await arq.youtube(text)
    limit = 0
    for i in results:
        if limit > 48:
            break
        limit += 1
        buttons = InlineKeyboard(row_width=1)
        video_url = f"https://youtube.com{results[i].url_suffix}"
        buttons.add(InlineKeyboardButton('Watch', url=video_url))
        caption = f"""
**Title:** {results[i].title}
**Views:** {results[i].views}
**Channel:** {results[i].channel}
**Duration:** {results[i].duration}
**Uploaded:** {results[i].publish_time}
**Description:** {results[i].long_desc}"""
        description = f"{results[i].views} | {results[i].channel} | " \
            + f"{results[i].duration} | {results[i].publish_time}"
        try:
            answers.append(
                InlineQueryResultArticle(
                    title=results[i].title,
                    thumb_url=results[i].thumbnails[0],
                    description=description,
                    input_message_content=InputTextMessageContent(
                        caption, disable_web_page_preview=True),
                    reply_markup=buttons))
        except (KeyError, ValueError):
            pass
    return answers
Ejemplo n.º 25
0
async def deezer_func(answers, text):
    buttons_list = []
    results = await arq.deezer(text, 5)
    if not results.ok:
        answers.append(
            InlineQueryResultArticle(
                title="Error",
                description=results.result,
                input_message_content=InputTextMessageContent(results.result),
            ))
        return answers
    results = results.result
    for count, i in enumerate(results):
        buttons = InlineKeyboard(row_width=1)
        buttons.add(InlineKeyboardButton("Download | Play", url=i.url))
        buttons_list.append(buttons)
        duration = await time_convert(i.duration)
        caption = f"""
**Title:** {i.title}
**Artist:** {i.artist}
**Duration:** {duration}
**Source:** [Deezer]({i.source})"""
        description = f"{i.artist} | {duration}"
        answers.append(
            InlineQueryResultArticle(
                title=i.title,
                thumb_url=i.thumbnail,
                description=description,
                input_message_content=InputTextMessageContent(
                    caption, disable_web_page_preview=True),
                reply_markup=buttons_list[count],
            ))
    return answers
Ejemplo n.º 26
0
async def eval_func(answers, text, user_id):
    if user_id not in SUDOERS:
        msg = "**ERROR**\n__THIS FEATURE IS ONLY FOR SUDO USERS__"
        answers.append(
            InlineQueryResultArticle(
                title="ERROR",
                description="THIS FEATURE IS ONLY FOR SUDO USERS",
                input_message_content=InputTextMessageContent(msg)))
        return answers
    if str(text)[-1] != ":":
        msg = "**ERROR**\n__Put A ':' After The Code To Execute It__"
        answers.append(
            InlineQueryResultArticle(
                title="ERROR",
                description="Put A ':' After The Code To Execute It",
                input_message_content=InputTextMessageContent(msg)))

        return answers
    text = text[0:-1]
    result = await eval_executer_func(text)
    res = result[0]
    output = result[1]
    time_taken = result[2]
    msg = f"{res}"
    button = InlineKeyboard(row_width=1)
    button.add(
        InlineKeyboardButton(text=f"{time_taken} Seconds",
                             callback_data="ok_lol"))
    answers.append(
        InlineQueryResultArticle(
            title=f"Took {time_taken} Seconds.",
            description=output,
            reply_markup=button,
            input_message_content=InputTextMessageContent(msg)))
    return answers
Ejemplo n.º 27
0
async def saavn_func(answers, text):
    buttons_list = []
    results = await arq.saavn(text)
    for i in results:
        buttons = InlineKeyboard(row_width=1)
        buttons.add(InlineKeyboardButton("Download | Play", url=results[i].media_url))
        buttons_list.append(buttons)
        duration = await time_convert(results[i].duration)
        caption = f"""
**Title:** {results[i].song}
**Album:** {results[i].album}
**Duration:** {duration}
**Release:** {results[i].year}
**Singers:** {results[i].singers}"""
        description = (
            f"{results[i].album} | {duration} "
            + f"| {results[i].singers} ({results[i].year})"
        )
        try:
            answers.append(
                InlineQueryResultArticle(
                    title=results[i].song,
                    input_message_content=InputTextMessageContent(
                        caption, disable_web_page_preview=True
                    ),
                    description=description,
                    thumb_url=results[i].image,
                    reply_markup=buttons_list[i],
                )
            )
        except (KeyError, ValueError):
            pass
    return answers
Ejemplo n.º 28
0
async def get_button_settings():
    me = await is_userbot_run()
    toggle = (tld('settings_userbot_stopbutton')
              if me else tld('settings_userbot_startbutton'))
    list_button = InlineKeyboard(row_width=2)
    list_button.add(
        InlineKeyboardButton(toggle, callback_data='toggle_startbot'),
        InlineKeyboardButton(
            tld('settings_userbot_restartbutton'),
            callback_data='restart_bot',
        ),
        InlineKeyboardButton(
            tld('settings_setstickerbutton'),
            callback_data='setsticker',
        ),
        InlineKeyboardButton(
            tld('language_btn'),
            callback_data='set_lang_',
        ),
        InlineKeyboardButton(
            'Select Branch',
            callback_data='change_branches',
        ),
    )
    return list_button
Ejemplo n.º 29
0
async def alive_function(answers):
    buttons = InlineKeyboard(row_width=2)
    bot_state = "Dead" if not await app.get_me() else "Alive"
    # ubot_state = 'Dead' if not await app2.get_me() else 'Alive'
    buttons.add(
        InlineKeyboardButton("Main Bot", url="https://t.me/RaVaN_manager_bot"),
        InlineKeyboardButton("Go Inline!", switch_inline_query_current_chat=""),
    )

    msg = f"""
**[𝐑𝐀𝐕𝐀𝐍✨](https://github.com/itznik):**
**MainBot:** `{bot_state}`
**UserBot:** `Alive`
**Python:** `3.9`
**Pyrogram:** `{pyrover}`
**MongoDB:** `{mongover}`
**Platform:** `{sys.platform}`
**Profiles:** [BOT](t.me/{BOT_USERNAME}) | [UBOT](t.me/itznik_x)
"""
    answers.append(
        InlineQueryResultArticle(
            title="Alive",
            description="Check Bot's Stats",
            thumb_url="https://telegra.ph/file/debc179305d2e1f140636.jpg",
            input_message_content=InputTextMessageContent(
                msg, disable_web_page_preview=True
            ),
            reply_markup=buttons,
        )
    )
    return answers
Ejemplo n.º 30
0
async def theme_button(_, query):
    keyboard = InlineKeyboard(row_width=4)
    keyboard.add(
        InlineKeyboardButton("Red", "color_#FF0000"),
        InlineKeyboardButton("Orange", "color_#FF5733"),
        InlineKeyboardButton("Yellow", "color_#FFFF00"),
        InlineKeyboardButton("Green", "color_#008000"),
        InlineKeyboardButton("Blue", "color_#0000FF"),
        InlineKeyboardButton("Purple", "color_#800080"),
        InlineKeyboardButton("Brown", "color_#A52A2A"),
        InlineKeyboardButton("Magenta", "color_#FF00FF"),
        InlineKeyboardButton("Tan", "color_#D2B48C"),
        InlineKeyboardButton("Cyan", "color_#00FFFF"),
        InlineKeyboardButton("Olive", "color_#808000"),
        InlineKeyboardButton("Maroon", "color_#800000"),
        InlineKeyboardButton("Aquamarine", "color_#00FFFF"),
        InlineKeyboardButton("Turquoise", "color_#30D5C8"),
        InlineKeyboardButton("Lime", "color_#00FF00"),
        InlineKeyboardButton("Teal", "color_#008080"),
        InlineKeyboardButton("Indigo", "color_#4B0082"),
        InlineKeyboardButton("Violet", "color_#EE82EE"),
        InlineKeyboardButton("Pink", "color_#FFC0CB"),
        InlineKeyboardButton("Black", "color_#000000"),
        InlineKeyboardButton("White", "color_#FFFFFF"),
        InlineKeyboardButton("Gray", "color_#808080"),
    )
    caches[str(query.from_user.id) + "theme"] = query.data.split("_")[1]
    print(caches)

    await query.message.edit("Choose a color:", reply_markup=keyboard)