Exemplo n.º 1
0
async def github_repo_func(answers, text):
    text = text.replace("https://github.com/", "")
    text = text.replace("http://github.com/", "")
    if text[-1] == "/":
        text = text[0:-1]
    URL = f"https://api.github.com/repos/{text}"
    URL2 = f"https://api.github.com/repos/{text}/contributors"
    results = await asyncio.gather(get(URL), get(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'] if r['license'] else None}`
**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
Exemplo n.º 2
0
async def on_inline_query(_, query: InlineQuery):
    to_search = query.query

    profile_list = search(to_search)

    inline_query_results = []

    language = get_language(query.from_user.id)

    if profile_list != "nothing_found":
        if len(profile_list) > 30:
            profile_list = profile_list[:30]

        for profile in profile_list:
            id = str(uuid4())
            title = profile.username
            if profile.is_verified:
                title += f" {emoji.CHECK_MARK_BUTTON}"

            new_result = InlineQueryResultArticle(
                title=title,
                id=id,
                thumb_url=profile.profile_pic,
                description=profile.full_name or None,
                input_message_content=InputTextMessageContent(
                    message_text=get_message(language, "loading")),
                reply_markup=InlineKeyboardMarkup([[
                    InlineKeyboardButton(
                        get_message(language, "loading"),
                        url=f"https://www.instagram.com/{profile.username}")
                ]]))

            CACHE[id] = [profile.username, language]

            inline_query_results.append(new_result)

    else:
        inline_query_results.append(profiles_not_found(language))

    await query.answer(inline_query_results, cache_time=0)
Exemplo n.º 3
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
Exemplo n.º 4
0
async def task_inline_func(user_id):
    if user_id not in SUDOERS:
        return

    tasks = all_tasks()
    text = await _get_tasks_text()
    keyb = None

    if tasks:
        keyb = ikb(
            {i: f"cancel_task_{i}"
             for i in list(tasks.keys())},
            row_width=4,
        )

    return [
        InlineQueryResultArticle(
            title="Tasks",
            reply_markup=keyb,
            input_message_content=InputTextMessageContent(text, ),
        )
    ]
Exemplo n.º 5
0
async def music_inline_func(answers, query):
    chat_id = -1001445180719
    group_invite = "https://t.me/joinchat/vSDE2DuGK4Y4Nzll"
    try:
        messages = [m async for m in app2.search_messages(chat_id, query, filter="audio", limit=199)]
    except Exception as e:
        print(e)
        msg = f"You Need To Join Here With Your Bot And Userbot To Get Cached Music.\n{group_invite}"
        answers.append(
            InlineQueryResultArticle(
                title="ERROR",
                description="Click Here To Know More.",
                input_message_content=InputTextMessageContent(
                    msg,
                    disable_web_page_preview=True
                )
            )
        )
        return answers
    messages_ids_and_duration = []
    for f_ in messages:
        messages_ids_and_duration.append(
            {"message_id": f_.message_id,
                "duration": f_.audio.duration if f_.audio.duration else 0}
        )
    messages = list(
        {v["duration"]: v for v in messages_ids_and_duration}.values())
    messages_ids = []
    for ff_ in messages:
        messages_ids.append(ff_['message_id'])
    messages = await app.get_messages(chat_id, messages_ids[0:48])
    for message_ in messages:
        answers.append(
            InlineQueryResultCachedDocument(
                file_id=message_.audio.file_id,
                title=message_.audio.title
            )
        )
    return answers
Exemplo n.º 6
0
async def yt_music_func(answers, url, 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
    title, performer, duration, audio, thumbnail = await download_youtube_audio(
        url)
    m = await app.send_audio(MESSAGE_DUMP_CHAT,
                             audio_file,
                             title=title,
                             duration=duration,
                             performer=performer,
                             thumb=thumbnail)
    os.remove(audio)
    os.remove(thumbnail)
    answers.append(
        InlineQueryResultCachedDocument(title=title, file_id=m.audio.file_id))
    return answers
Exemplo n.º 7
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
Exemplo n.º 8
0
async def nsfw_scan_func(answers, url: str):
    t1 = time()
    data = (await arq.nsfw_scan(url)).data
    t2 = time()
    tt = round(t2-t1, 4)
    content = f"""
**Scanned [Image]({url}) In {tt} Seconds.**

**Drawings:** `{data.drawings} %`
**Neutral:** `{data.neutral} %`
**Hentai:** `{data.hentai} %`
**P**n:** `{data.p**n} %`
**Sexy:** `{data.sexy} %`
    """
    answers.append(
        InlineQueryResultArticle(
            title="Scanned",
            description=f"Took {tt} Seconds.",
            input_message_content=InputTextMessageContent(content)
        )
    )
    return answers
Exemplo n.º 9
0
async def google_search_func(answers, text):
    gresults = await GoogleSearch().async_search(text)
    limit = 0
    for i in gresults:
        if limit > 48:
            break
        limit += 1

        try:
            msg = f"""
[{i['titles']}]({i['links']})
{i['descriptions']}"""

            answers.append(
                InlineQueryResultArticle(
                    title=i['titles'],
                    description=i['descriptions'],
                    input_message_content=InputTextMessageContent(
                        msg, disable_web_page_preview=True)))
        except KeyError:
            pass
    return answers
Exemplo n.º 10
0
async def translateinline(bot: Client, query: InlineQuery) -> None:
    try:
        to_translate = query.query.lower().split(None, 1)[1]
        language = await tr.detect(query.query.lower().split(None, 1)[1])
        tolanguage = query.query.lower().split()[0]
        translation = await tr(
            to_translate,
            sourcelang=language,
            targetlang=tolanguage
        )
        trmsgtext = f"{translation.text}"
        await query.answer(
            [
                InlineQueryResultArticle(
                    title=constants.inline_text_string_one.format(language, tolanguage),
                    description=f"{translation.text}",
                    input_message_content=InputTextMessageContent(trmsgtext)
                )
            ]
        )
    except IndexError:
        return
Exemplo n.º 11
0
async def shortify(url):
    if "." not in url:
        return
    header = {
        "Authorization": "Bearer ad39983fa42d0b19e4534f33671629a4940298dc",
        'Content-Type': 'application/json'
    }
    payload = {"long_url": f"{url}"}
    payload = json.dumps(payload)
    async with aiohttp.ClientSession() as session:
        async with session.post("https://api-ssl.bitly.com/v4/shorten",
                                headers=header,
                                data=payload) as resp:
            data = await resp.json()
    msg = data['link']
    a = []
    b = InlineQueryResultArticle(title="Link Shortened!",
                                 description=data['link'],
                                 input_message_content=InputTextMessageContent(
                                     msg, disable_web_page_preview=True))
    a.append(b)
    return a
Exemplo n.º 12
0
async def speedtest_func(answers):
    buttons = InlineKeyboard(row_width=2)
    buttons.add(
        InlineKeyboardButton(
            tld('speed_test_button_image'),
            callback_data='speedtest_image',
        ),
        InlineKeyboardButton(
            tld('speed_test_button_text'),
            callback_data='speedtest_text',
        ),
    )
    answers.append(
        InlineQueryResultArticle(
            title='Speed Test',
            description='test your speed',
            input_message_content=InputTextMessageContent(
                tld('speed_test_trigger'),
                parse_mode='markdown',
            ),
            reply_markup=buttons,
        ), )
Exemplo n.º 13
0
async def carbon_inline_func(answers, link):
    link = link.split("/")
    if link[3] == "c":
        chat, message_id = int("-100" + link[4]), int(link[5])
    else:
        chat, message_id = link[3], link[4]
    m = await app.get_messages(chat, message_ids=int(message_id))
    if not m.text and not m.document:
        m = await app2.get_messages(chat, message_ids=int(message_id))
    if m.text:
        content = m.text
    else:
        if m.document.file_size > 1048576:
            answers.append(
                InlineQueryResultArticle(
                    title="DOCUMENT TOO BIG",
                    description="Maximum supported size is 1MB",
                    input_message_content=InputTextMessageContent(
                        "DOCUMENT TOO BIG"),
                ))
            return answers
        doc = await m.download()
        async with aiofiles.open(doc, mode="r") as f:
            content = await f.read()
        os.remove(doc)
    image = await make_carbon(content)
    link = await paste(content)
    # To Pre-cache the media
    carbon = await app.send_document(MESSAGE_DUMP_CHAT, image)
    os.remove(image)
    buttons = InlineKeyboard(row_width=1)
    buttons.add(InlineKeyboardButton(text="Paste Link", url=link))
    answers.append(
        InlineQueryResultCachedDocument(
            file_id=carbon.document.file_id,
            title="Carbon",
            reply_markup=buttons,
        ))
    return answers
Exemplo n.º 14
0
async def pastebin_func(answers, link):
    link = link.split("/")
    if link[3] == "c":
        chat, message_id = int("-100" + link[4]), int(link[5])
    else:
        chat, message_id = link[3], link[4]
    m = await app.get_messages(chat, message_ids=int(message_id))
    if not m.text and not m.document:
        m = await app2.get_messages(chat, message_ids=int(message_id))
    if m.text:
        content = m.text
    else:
        if m.document.file_size > 1048576:
            answers.append(
                InlineQueryResultArticle(
                    title="DOCUMENT TOO BIG",
                    description="Maximum supported size is 1MB",
                    input_message_content=InputTextMessageContent(
                        "DOCUMENT TOO BIG"
                    ),
                )
            )
            return answers
        doc = await m.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"
    if not await isPreviewUp(preview):
        return []
    await app.send_photo(MESSAGE_DUMP_CHAT, preview)  # To Pre-cache the media
    buttons = InlineKeyboard(row_width=1)
    buttons.add(InlineKeyboardButton(text="Paste Link", url=link))
    answers.append(
        InlineQueryResultPhoto(photo_url=preview, reply_markup=buttons)
    )
    return answers
Exemplo n.º 15
0
async def inline(client: Client, query: InlineQuery):
    answers = []
    search_query = query.query.lower().strip().rstrip()

    if search_query == "":
        await client.answer_inline_query(
            query.id,
            results=answers,
            switch_pm_text="Bir YouTube video adı yazın...",
            switch_pm_parameter="help",
            cache_time=0,
        )
    else:
        search = VideosSearch(search_query, limit=50)

        for result in search.result()["result"]:
            answers.append(
                InlineQueryResultArticle(
                    title=result["title"],
                    description="{}, {} views.".format(
                        result["duration"], result["viewCount"]["short"]
                    ),
                    input_message_content=InputTextMessageContent(
                        "https://www.youtube.com/watch?v={}".format(result["id"])
                    ),
                    thumb_url=result["thumbnails"][0]["url"],
                )
            )

        try:
            await query.answer(results=answers, cache_time=0)
        except errors.QueryIdInvalid:
            await query.answer(
                results=answers,
                cache_time=0,
                switch_pm_text="Hata: Arama zaman aşımına uğradı...",
                switch_pm_parameter="",
            )
Exemplo n.º 16
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
Exemplo n.º 17
0
 async def pmpermit_inline_query_handler(_, query: InlineQuery):
     results = []
     owner = await userge.get_me()
     pm_inline_msg = await SAVED_SETTINGS.find_one(
         {'_id': 'CUSTOM_INLINE_PM_MESSAGE'})
     if pm_inline_msg:
         text = pm_inline_msg.get('data')
     else:
         text = f"Hello, welcome to **{owner.first_name}** Dm.\n\nWhat you want to do ?"
     buttons = [[
         InlineKeyboardButton("Contact Me", callback_data="pm_contact"),
         InlineKeyboardButton("Spam here", callback_data="pm_spam")
     ]]
     results.append(
         InlineQueryResultArticle(
             id=uuid4(),
             title="Pm Permit",
             input_message_content=InputTextMessageContent(text),
             description="Inline Pm Permit Handler",
             thumb_url="https://imgur.com/download/Inyeb1S",
             reply_markup=InlineKeyboardMarkup(buttons)))
     await query.answer(results=results, cache_time=60)
     query.stop_propagation()
Exemplo n.º 18
0
async def urban_func(answers, text):
    results = await arq.urbandict(text)
    limit = 0
    for i in results:
        if limit > 48:
            break
        limit += 1
        try:
            msg = f"""
**Query:** {text}

**Definition:** __{results[i].definition}__

**Example:** __{results[i].example}__"""

            answers.append(
                InlineQueryResultArticle(
                    title=results[i].word,
                    description=results[i].definition,
                    input_message_content=InputTextMessageContent(msg)))
        except KeyError:
            pass
    return answers
Exemplo n.º 19
0
def user_eazy(bunch):
    result = []
    for one in bunch:
        user = one._json
        link = f"https://twitter.com/{user['screen_name']}"
        text = simstuff(user, link)
        udt = "Follow"
        if user["following"]:
            udt = "UnFollow"
        reply_markup = InlineKeyboardMarkup([[
            InlineKeyboardButton(text="View", url=link),
            InlineKeyboardButton(text=udt, callback_data=f"fuflow{user['id']}")
        ], [InlineKeyboardButton(text="Help Menu", callback_data="openmenu")]])
        result.append(
            InlineQueryResultArticle(
                title=user["name"],
                description=user["screen_name"],
                url=link,
                thumb_url=user["profile_image_url"],
                reply_markup=reply_markup,
                input_message_content=InputTextMessageContent(
                    text, disable_web_page_preview=True)))
    return result[:50]
Exemplo n.º 20
0
async def inline_help_func(__HELP__):
    buttons = InlineKeyboard(row_width=2)
    buttons.add(
        InlineKeyboardButton(
            'Get More Help.',
            url=f"t.me/{BOT_USERNAME}?start=start"
        ),
        InlineKeyboardButton(
            "Go Inline!",
            switch_inline_query_current_chat=""
        )
    )
    answerss = [
        InlineQueryResultArticle(
            title="Inline Commands",
            description="Help Related To Inline Usage.",
            input_message_content=InputTextMessageContent(__HELP__),
            thumb_url="https://hamker.me/cy00x5x.png",
            reply_markup=buttons
        )
    ]
    answerss = await alive_function(answerss)
    return answerss
Exemplo n.º 21
0
async def inline_help_func(__HELP__):
    buttons = InlineKeyboard(row_width=3)
    keywords_list = [
        "alive", "ping", "tr", "ud", "google", "bitly",
        "wall", "yt", "torrent", "lyrics", "wiki",
        "speedtest", "music", "saavn", "deezer",
        "gh_repo", "gh_user", "search", "pastebin",
        "nsfw_scan", "ytmusic", "carbon", "info"
    ]
    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
        )
    ]
    answerss = await alive_function(answerss)
    return answerss
Exemplo n.º 22
0
async def wall_func(answers, text):
    results = await arq.wall(text)
    if not results.ok:
        answers.append(
            InlineQueryResultArticle(
                title="Error",
                description=results.result,
                input_message_content=InputTextMessageContent(results.result),
            ))
        return answers
    limit = 0
    results = results.result
    for i in results:
        if limit > 48:
            break
        limit += 1
        answers.append(
            InlineQueryResultPhoto(
                photo_url=i.url_image,
                thumb_url=i.url_thumb,
                caption=f"[Source]({i.url_image})",
            ))
    return answers
Exemplo n.º 23
0
async def yt_music_func(answers, url):
    if "http" not in url:
        url = (await arq.youtube(url)).result[0]
        url = f"https://youtube.com{url.url_suffix}"
    loop = asyncio.get_running_loop()
    music = await loop.run_in_executor(None, download_youtube_audio, url)
    if not music:
        msg = "**ERROR**\n__MUSIC TOO LONG__"
        answers.append(
            InlineQueryResultArticle(
                title="ERROR",
                description="MUSIC TOO LONG",
                input_message_content=InputTextMessageContent(msg),
            )
        )
        return answers
    (
        title,
        performer,
        duration,
        audio,
        thumbnail,
    ) = music
    m = await app.send_audio(
        MESSAGE_DUMP_CHAT,
        audio,
        title=title,
        duration=duration,
        performer=performer,
        thumb=thumbnail,
    )
    os.remove(audio)
    os.remove(thumbnail)
    answers.append(
        InlineQueryResultCachedDocument(title=title, file_id=m.audio.file_id)
    )
    return answers
Exemplo n.º 24
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
Exemplo n.º 25
0
async def torrent_func(answers, text):
    results = await arq.torrent(text)
    limit = 0
    for i in results:
        if limit > 48:
            break
        title = results[i].name
        size = results[i].size
        seeds = results[i].seeds
        leechs = results[i].leechs
        upload_date = results[i].uploaded + " Ago"
        magnet = results[i].magnet
        caption = f"""
**Title:** __{title}__
**Size:** __{size}__
**Seeds:** __{seeds}__
**Leechs:** __{leechs}__
**Uploaded:** __{upload_date}__
**Magnet:** __{magnet}__"""

        description = f"{size} | {upload_date} | Seeds: {seeds}"
        try:
            answers.append(
                InlineQueryResultArticle(
                    title=title,
                    description=description,
                    input_message_content=InputTextMessageContent(
                        caption,
                        disable_web_page_preview=True
                    )
                )
            )
            limit += 1
        except (KeyError, ValueError):
            pass
    return answers
Exemplo n.º 26
0
    "**__List of Queries__**\n"
    "`Decorators`\n"
    "`Deployment`\n"
    "`Vars`\n"
    "`Modes`\n"
    "`Example`\n"
    "`Faqs`\n"
    "`Errors`")

USERGE = [
    InlineQueryResultArticle(
        title="About UserGe",
        input_message_content=InputTextMessageContent(
            "**👑 bots**\n\n"
            "**[Create your own bot](https://github.com/rohithollabr/Userge-Assistant) **"
            "**is a Powerful , Pluggable Telegram UserBot written in **"
            "**[Python](https://www.python.org/) using **"
            "**[Pyrogram](https://github.com/pyrogram).**",
            disable_web_page_preview=True),
        reply_markup=InlineKeyboardMarkup(
            [[
                InlineKeyboardButton("👥 My Group",
                                     url="https://t.me/rohithollabr1")
            ],
             [
                 InlineKeyboardButton("🗂 GitHub",
                                      url="https://github.com/rohithollabr"),
                 InlineKeyboardButton("📂 Docs", url=f"{userge_wiki}")
             ]]),
        description="UserGe is a Powerful , Pluggable Telegram UserBot.",
        thumb_url=USERGE_THUMB),
Exemplo n.º 27
0
async def owo(client, inline_query):
    string_given = inline_query.query.lower()
    if "modapk" in inline_query.query.lower():
        if not " " in inline_query.query.lower():
            return
        string_given = inline_query.query.lower()
        sgname = string_given.split(" ", maxsplit=1)[1]
        print(sgname)
        PabloEscobar = (
            f"https://an1.com/tags/MOD/?story={sgname}&do=search&subaction=search"
        )
        r = requests.get(PabloEscobar)
        results = []
        soup = BeautifulSoup(r.content, "html5lib")
        mydivs = soup.find_all("div", {"class": "search-results"})
        Pop = soup.find_all("div", {"class": "title"})
        cnte = len(mydivs)
        for cnt in range(cnte):
            sucker = mydivs[cnt]
            pH9 = sucker.find("a").contents[0]
            file_name = pH9
            pH = sucker.findAll("img")
            imme = pH[0]["src"]
            Pablo = Pop[0].a["href"]
            ro = requests.get(Pablo)
            soupe = BeautifulSoup(ro.content, "html5lib")
            myopo = soupe.find_all("div", {"class": "item"})
            capt = f"**{file_name}** \n** {myopo[0].text}**\n**{myopo[1].text}**\n**{myopo[2].text}**\n**{myopo[3].text}**"
            mydis0 = soupe.find_all("a", {"class": "get-product"})
            Lol9 = mydis0[0]
            lemk = "https://an1.com" + Lol9["href"]

            results.append(
                InlineQueryResultPhoto(
                    photo_url=imme,
                    title=file_name,
                    caption=capt,
                    reply_markup=InlineKeyboardMarkup(
                        [
                            [
                                InlineKeyboardButton(
                                    text="<<! Download Link!>>",
                                    callback_data=f"apk_{lemk}",
                                ),
                            ]
                        ]
                    ),
                )
            )
        await client.answer_inline_query(inline_query.id, cache_time=0, results=results)
    elif "not4u" in string_given:
        if not ";" in string_given:
            return
        ok = string_given.split(" ", maxsplit=1)[1]
        user, msg = ok.split(";")
        fu = int(user) if user.isdigit() else user
        try:
            ui = await Friday.get_users(fu)
        except BaseException as e:
            logging.error(str(e))
            return
        owo = (
            f"@{ui.username}"
            if ui.username
            else f"[{ui.first_name}](tg://user?id={ui.id})"
        )
        chars = string.hexdigits
        randomc = "".join(choice(chars) for _ in range(4))
        stark_data = {"secret_code": randomc, "id": ui.id, "msg": msg}
        db_s.insert(stark_data)
        texts = f"Everyone Except {owo} Can Read This Message. \nClick Below To Check Message! \n**Note :** `Only He/She Can't Open It!`"
        ok_s = [
            (
                InlineQueryResultArticle(
                    title="OwO! Not For You",
                    reply_markup=InlineKeyboardMarkup(
                        [
                            [
                                InlineKeyboardButton(
                                    text="Show Message !", callback_data=f"nu_{randomc}"
                                )
                            ]
                        ]
                    ),
                    input_message_content=InputTextMessageContent(texts),
                )
            )
        ]
        await client.answer_inline_query(inline_query.id, cache_time=0, results=ok_s)
    elif "whisper" in string_given:
        if not ";" in string_given:
            return
        ok = string_given.split(" ", maxsplit=1)[1]
        user, msg = ok.split(";")
        fu = int(user) if user.isdigit() else user
        try:
            ui = await Friday.get_users(fu)
        except BaseException as e:
            logging.error(str(e))
            return
        owo = (
            f"@{ui.username}"
            if ui.username
            else f"[{ui.first_name}](tg://user?id={ui.id})"
        )
        chars = string.hexdigits
        randomc = "".join(choice(chars) for _ in range(4))
        stark_data = {"secret_code": randomc, "id": ui.id, "msg": msg}
        db_m.insert(stark_data)
        texts = f"A Whisper Has Been Sent For {owo} . \nClick Below To Check Message! \n**Note :** `Only He/She Can Open It!`"
        ok_s = [
            (
                InlineQueryResultArticle(
                    title="Ssh! This is A Secret Message",
                    reply_markup=InlineKeyboardMarkup(
                        [
                            [
                                InlineKeyboardButton(
                                    text="Show Message !", callback_data=f"sc_{randomc}"
                                )
                            ]
                        ]
                    ),
                    input_message_content=InputTextMessageContent(texts),
                )
            )
        ]
        await client.answer_inline_query(inline_query.id, cache_time=0, results=ok_s)
    elif "help" in string_given:
        bttn = [
            [
                InlineKeyboardButton(
                    text="Main Command Help", callback_data=f"make_basic_button_True"
                )
            ]
        ]
        if Config.LOAD_UNOFFICIAL_PLUGINS:
            bttn = [
                [
                    InlineKeyboardButton(
                        text="Xtra Command Help",
                        callback_data=f"make_basic_button_False",
                    )
                ],
                [
                    InlineKeyboardButton(
                        text="Main Command Help",
                        callback_data=f"make_basic_button_True",
                    )
                ],
            ]
        nice_text = f"**FridayUserBot Commands** \n**Friday Version :** __{friday_version}__ \n**PyroGram Version :** __{__version__}__ \n**Total Plugins Loaded :** __{len(CMD_LIST)}__"
        await client.answer_inline_query(
            inline_query.id,
            cache_time=0,
            results=[
                (
                    InlineQueryResultArticle(
                        title="Help Article!",
                        reply_markup=InlineKeyboardMarkup(bttn),
                        input_message_content=InputTextMessageContent(nice_text),
                    )
                )
            ],
        )
Exemplo n.º 28
0
    async def inline_answer(_, inline_query: InlineQuery):
        results = []
        i_q = inline_query.query
        string = i_q.lower()  # All lower
        str_x = i_q.split(" ", 2)  # trigger @username Text
        str_y = i_q.split(" ", 1)  # trigger and Text
        string_split = string.split()  # All lower and Split each word

        if (inline_query.from_user.id in Config.OWNER_ID
                or inline_query.from_user.id in Config.SUDO_USERS):

            if string == "syntax":
                owner = [[
                    InlineKeyboardButton(text="Contact",
                                         url="https://t.me/deleteduser420")
                ]]
                results.append(
                    InlineQueryResultPhoto(
                        photo_url=
                        "https://coverfiles.alphacoders.com/123/123388.png",
                        caption="Hey I solved **𝚂𝚢𝚗𝚝𝚊𝚡's ░ Σrr♢r**",
                        reply_markup=InlineKeyboardMarkup(owner),
                    ))

            if string == "age_verification_alert":
                buttons = [[
                    InlineKeyboardButton(
                        text="Yes I'm 18+",
                        callback_data="age_verification_true"),
                    InlineKeyboardButton(
                        text="No I'm Not",
                        callback_data="age_verification_false"),
                ]]
                results.append(
                    InlineQueryResultPhoto(
                        photo_url="https://i.imgur.com/Zg58iXc.jpg",
                        caption="**ARE YOU OLD ENOUGH FOR THIS ?**",
                        reply_markup=InlineKeyboardMarkup(buttons),
                    ))

            if str_y[0] == "reddit":
                reddit_api = "https://meme-api.herokuapp.com/gimme/"
                if len(str_y) == 2:
                    subreddit_regex = r"^([a-zA-Z]+)\.$"
                    match = re.search(subreddit_regex, str_y[1])
                    if match:
                        subreddit_name = match.group(1)
                        reddit_api += f"{subreddit_name}/30"
                    else:
                        return
                else:
                    reddit_api += "30"
                try:
                    r = await get_response.json(reddit_api)
                except ValueError:
                    results.append(
                        InlineQueryResultArticle(
                            title="Reddit Api is Down !",
                            input_message_content=InputTextMessageContent(
                                "**Error Code: Status != 200**"),
                            thumb_url="https://i.imgur.com/7a7aPVa.png",
                        ))
                else:
                    if "code" in r:
                        bool_is_gallery = False
                        code = r["code"]
                        code_message = r["message"]
                        results.append(
                            InlineQueryResultArticle(
                                title=str(code),
                                input_message_content=InputTextMessageContent(
                                    f"**Error Code: {code}**\n`{code_message}`"
                                ),
                                description="Enter A Valid Subreddit Name !",
                                thumb_url="https://i.imgur.com/7a7aPVa.png",
                            ))
                    else:
                        bool_is_gallery = True
                        for post in r["memes"]:
                            if "url" in post:
                                postlink = post["postLink"]
                                subreddit = post["subreddit"]
                                title = post["title"]
                                media_url = post["url"]
                                author = post["author"]
                                upvote = post["ups"]
                                captionx = f"<b>{title}</b>\n"
                                captionx += f"`Posted by u/{author}`\n"
                                captionx += f"↕️ <code>{upvote}</code>\n"
                                thumbnail = reddit_thumb_link(post["preview"])
                                if post["spoiler"]:
                                    captionx += "⚠️ Post marked as SPOILER\n"
                                if post["nsfw"]:
                                    captionx += "🔞 Post marked Adult \n"
                                buttons = [[
                                    InlineKeyboardButton(
                                        f"Source: r/{subreddit}", url=postlink)
                                ]]
                                if media_url.endswith(".gif"):
                                    results.append(
                                        InlineQueryResultAnimation(
                                            animation_url=media_url,
                                            thumb_url=thumbnail,
                                            caption=captionx,
                                            reply_markup=InlineKeyboardMarkup(
                                                buttons),
                                        ))
                                else:
                                    results.append(
                                        InlineQueryResultPhoto(
                                            photo_url=media_url,
                                            thumb_url=thumbnail,
                                            caption=captionx,
                                            reply_markup=InlineKeyboardMarkup(
                                                buttons),
                                        ))
                    await inline_query.answer(
                        results=results,
                        cache_time=1,
                        is_gallery=bool_is_gallery,
                        switch_pm_text="Available Commands",
                        switch_pm_parameter="inline",
                    )
                    return

            # if string == "rick":
            #     rick = [[InlineKeyboardButton(text="🔍", callback_data="mm")]]
            #     results.append(
            #         InlineQueryResultArticle(
            #             title="Not a Rick Roll",
            #             input_message_content=InputTextMessageContent("Search Results"),
            #             description="Definately Not a Rick Roll",
            #             thumb_url="https://i.imgur.com/hRCaKAy.png",
            #             reply_markup=InlineKeyboardMarkup(rick),
            #         )
            #     )

            if string == "alive":
                buttons = [[
                    InlineKeyboardButton("🔧 SETTINGS",
                                         callback_data="settings_btn"),
                    InlineKeyboardButton(text="⚡️ REPO",
                                         url=Config.UPSTREAM_REPO),
                ]]

                alive_info = f"""
    **[USERGE-X](https://telegram.dog/x_xtests) is Up and Running**

 • 🐍 Python :  `v{versions.__python_version__}`
 • 🔥 Pyrogram :  `v{versions.__pyro_version__}`
 • 🧬 𝑿 :  `v{get_version()}`

{_get_mode()}  |  🕔: {userge.uptime}
"""

                if not MEDIA_URL and Config.ALIVE_MEDIA:
                    await get_alive_()

                if MEDIA_URL:
                    if MEDIA_TYPE == "url_gif":
                        results.append(
                            InlineQueryResultAnimation(
                                animation_url=MEDIA_URL,
                                caption=alive_info,
                                reply_markup=InlineKeyboardMarkup(buttons),
                            ))
                    elif MEDIA_TYPE == "url_image":
                        results.append(
                            InlineQueryResultPhoto(
                                photo_url=MEDIA_URL,
                                caption=alive_info,
                                reply_markup=InlineKeyboardMarkup(buttons),
                            ))
                    elif MEDIA_TYPE == "tg_image":
                        results.append(
                            InlineQueryResultCachedPhoto(
                                file_id=MEDIA_URL,
                                caption=alive_info,
                                reply_markup=InlineKeyboardMarkup(buttons),
                            ))
                    else:
                        results.append(
                            InlineQueryResultCachedDocument(
                                title="USERGE-X",
                                file_id=MEDIA_URL,
                                caption=alive_info,
                                description="ALIVE",
                                reply_markup=InlineKeyboardMarkup(buttons),
                            ))
                else:  # default
                    random_alive = random.choice(ALIVE_IMGS)
                    results.append(
                        InlineQueryResultPhoto(
                            photo_url=random_alive,
                            caption=alive_info,
                            reply_markup=InlineKeyboardMarkup(buttons),
                        ))

            if string == "geass":
                results.append(
                    InlineQueryResultAnimation(
                        animation_url="https://i.imgur.com/DeZHcRK.gif",
                        caption="To defeat evil, I must become a greater evil",
                    ))

            if string == "gapps":
                buttons = [
                    [
                        InlineKeyboardButton("Open GApps",
                                             callback_data="open_gapps"),
                        InlineKeyboardButton("Flame GApps",
                                             callback_data="flame_gapps"),
                    ],
                    [
                        InlineKeyboardButton("Nik GApps",
                                             callback_data="nik_gapps")
                    ],
                ]
                results.append(
                    InlineQueryResultArticle(
                        title="GApps",
                        input_message_content=InputTextMessageContent(
                            "[\u200c](https://i.imgur.com/BZBMrfn.jpg) **LATEST Android 10 arm64 GApps**"
                        ),
                        description=
                        "Get Latest GApps Download Links Directly from SF",
                        thumb_url="https://i.imgur.com/Npzw8Ph.png",
                        reply_markup=InlineKeyboardMarkup(buttons),
                    ))

            if len(string_split) == 2 and (string_split[0] == "ofox"):
                codename = string_split[1]
                t = TelegraphPoster(use_api=True)
                t.create_api_token("Userge-X")
                photo = "https://i.imgur.com/582uaSk.png"
                api_host = "https://api.orangefox.download/v2/device/"
                try:
                    cn = requests.get(f"{api_host}{codename}")
                    r = cn.json()
                except ValueError:
                    return
                s = requests.get(
                    f"{api_host}{codename}/releases/stable/last").json()
                info = f"📱 **Device**: {r['fullname']}\n"
                info += f"👤 **Maintainer**: {r['maintainer']['name']}\n\n"
                recovery = f"🦊 <code>{s['file_name']}</code>\n"
                recovery += f"📅 {s['date']}\n"
                recovery += f"ℹ️ **Version:** {s['version']}\n"
                recovery += f"📌 **Build Type:** {s['build_type']}\n"
                recovery += f"🔰 **Size:** {s['size_human']}\n\n"
                recovery += "📍 **Changelog:**\n"
                recovery += f"<code>{s['changelog']}</code>\n\n"
                msg = info
                msg += recovery
                notes_ = s.get("notes")
                if notes_:
                    notes = t.post(title="READ Notes", author="", text=notes_)
                    buttons = [[
                        InlineKeyboardButton("🗒️ NOTES", url=notes["url"]),
                        InlineKeyboardButton("⬇️ DOWNLOAD", url=s["url"]),
                    ]]
                else:
                    buttons = [[
                        InlineKeyboardButton(text="⬇️ DOWNLOAD", url=s["url"])
                    ]]

                results.append(
                    InlineQueryResultPhoto(
                        photo_url=photo,
                        thumb_url="https://i.imgur.com/o0onLYB.jpg",
                        title="Latest OFOX RECOVERY",
                        description=f"For device : {codename}",
                        caption=msg,
                        reply_markup=InlineKeyboardMarkup(buttons),
                    ))

            if string == "repo":
                results.append(REPO_X)

            if len(str_y) == 2 and str_y[0] == "anime":
                for i in await Anime.search(str_y[1]):
                    results.append(
                        InlineQueryResultArticle(
                            title=i.get("title"),
                            input_message_content=InputTextMessageContent(
                                f'[\u200c]({i.get("image")})**{i.get("title")}**\n{i.get("release")}'
                            ),
                            description=i.get("release"),
                            thumb_url=i.get("image"),
                            reply_markup=InlineKeyboardMarkup([[
                                InlineKeyboardButton(
                                    text="⬇️  Download",
                                    callback_data=f'get_eps{i.get("key")}',
                                )
                            ]]),
                        ))
                if len(results) != 0:
                    await inline_query.answer(
                        results=results[:50],
                        cache_time=1,
                        switch_pm_text="Available Commands",
                        switch_pm_parameter="inline",
                    )
                    return

            if str_y[0] == "spoiler":
                if not os.path.exists("./userge/xcache/spoiler_db.json"):
                    results.append(
                        InlineQueryResultArticle(
                            title="No Spoiler Found",
                            input_message_content=InputTextMessageContent(
                                "No Spoiler Found !\nLet's Add Some 😈"),
                            description="See .help spoiler for more info",
                        ))
                else:
                    bot_name = (await userge.bot.get_me()).username
                    if len(str_y) == 2:
                        link = f"https://t.me/{bot_name}?start=spoiler_{str_y[1]}"
                        buttons = [[
                            InlineKeyboardButton(text="View Spoiler", url=link)
                        ]]
                        results.append(
                            InlineQueryResultArticle(
                                title="Spoiler",
                                input_message_content=InputTextMessageContent(
                                    "<b>Click To View The Spoiler !</b>"),
                                description="Click To Send",
                                thumb_url=
                                "https://telegra.ph/file/ee3a6439494463acd1a3a.jpg",
                                reply_markup=InlineKeyboardMarkup(buttons),
                            ))
                    else:
                        fo = open("./userge/xcache/spoiler_db.json")
                        view_db = ujson.load(fo)
                        fo.close()
                        if len(view_db) != 0:
                            for numm, spoilerr in enumerate(view_db, start=1):
                                buttons = [[
                                    InlineKeyboardButton(
                                        text="View Spoiler",
                                        url=
                                        f"https://t.me/{bot_name}?start=spoiler_{spoilerr}",
                                    )
                                ]]
                                saved_at = view_db.get(spoilerr, None)
                                savetime = (saved_at.get("savetime", None)
                                            if saved_at else None)
                                results.append(
                                    InlineQueryResultArticle(
                                        title=f"#{numm}  Spoiler",
                                        input_message_content=
                                        InputTextMessageContent(
                                            "<b>Click To View The Spoiler !</b>"
                                        ),
                                        description=f"Created At: {savetime}",
                                        thumb_url=
                                        "https://telegra.ph/file/ee3a6439494463acd1a3a.jpg",
                                        reply_markup=InlineKeyboardMarkup(
                                            buttons),
                                    ))

            if str_x[0].lower() == "op" and len(str_x) > 1:
                txt = i_q[3:]

                opinion = os.path.join(PATH, "emoji_data.txt")
                if os.path.exists(opinion):
                    with open(opinion) as fo:
                        view_data = ujson.load(fo)
                    # Uniquely identifies an inline message
                    new_id = {int(inline_query.id): [{}]}
                    view_data.update(new_id)
                else:
                    view_data = {int(inline_query.id): [{}]}

                with open(opinion, "w") as outfile:
                    ujson.dump(view_data, outfile)

                buttons = [[
                    InlineKeyboardButton(
                        "👍", callback_data=f"op_y_{inline_query.id}"),
                    InlineKeyboardButton(
                        "👎", callback_data=f"op_n_{inline_query.id}"),
                ]]
                results.append(
                    InlineQueryResultArticle(
                        title="Ask For Opinion",
                        input_message_content=InputTextMessageContent(txt),
                        description=f"Q. {txt}",
                        thumb_url="https://i.imgur.com/Zlc98qS.jpg",
                        reply_markup=InlineKeyboardMarkup(buttons),
                    ))

            if "btn_" in str_y[0] or str_y[0] == "btn":

                inline_db_path = "./userge/xcache/inline_db.json"
                if os.path.exists(inline_db_path):
                    with open(inline_db_path, "r") as data_file:
                        view_db = ujson.load(data_file)

                    data_count_n = 1
                    reverse_list = list(view_db)
                    reverse_list.reverse()
                    for butt_ons in reverse_list:
                        if data_count_n > 15:
                            view_db.pop(butt_ons, None)
                        data_count_n += 1

                    with open(inline_db_path, "w") as data_file:
                        ujson.dump(view_db, data_file)

                    if str_y[0] == "btn":
                        inline_storage = list(view_db)
                    else:
                        rnd_id = (str_y[0].split("_", 1))[1]
                        inline_storage = [rnd_id]

                    if len(inline_storage) == 0:
                        return

                    for inline_content in inline_storage:
                        inline_db = view_db.get(inline_content)
                        if inline_db:
                            if (inline_db["media_valid"]
                                    and int(inline_db["media_id"]) != 0):
                                saved_msg = await userge.bot.get_messages(
                                    Config.LOG_CHANNEL_ID,
                                    int(inline_db["media_id"]))
                                media_data = get_file_id(saved_msg)

                            textx, buttonsx = pb(inline_db["msg_content"])

                            if inline_db["media_valid"]:
                                if saved_msg.photo:
                                    results.append(
                                        InlineQueryResultCachedPhoto(
                                            file_id=media_data,
                                            caption=textx,
                                            reply_markup=buttonsx,
                                        ))
                                else:
                                    results.append(
                                        InlineQueryResultCachedDocument(
                                            title=textx,
                                            file_id=media_data,
                                            caption=textx,
                                            description="Inline Button",
                                            reply_markup=buttonsx,
                                        ))
                            else:
                                results.append(
                                    InlineQueryResultArticle(
                                        title=textx,
                                        input_message_content=
                                        InputTextMessageContent(textx),
                                        reply_markup=buttonsx,
                                    ))

            if str_y[0].lower() == "stylish":
                if len(str_y) == 2:
                    results = []
                    input_text = str_y[1]
                    font_names = [
                        "serif",
                        "sans",
                        "sans_i",
                        "serif_i",
                        "medi_b",
                        "medi",
                        "double",
                        "cursive_b",
                        "cursive",
                        "bigsmall",
                        "reverse",
                        "circle",
                        "circle_b",
                        "mono",
                        "square_b",
                        "square",
                        "smoth",
                        "goth",
                        "wide",
                        "web",
                        "weeb",
                        "weeeb",
                    ]
                    for f_name in font_names:
                        styled_str = await font_gen(f_name, input_text)
                        results.append(
                            InlineQueryResultArticle(
                                title=f_name.upper(),
                                input_message_content=InputTextMessageContent(
                                    styled_str),
                                description=styled_str,
                            ))
                    await inline_query.answer(
                        results=results,
                        cache_time=1,
                        switch_pm_text="Available Commands",
                        switch_pm_parameter="inline",
                    )
                    return

            if str_x[0].lower() == "secret" and len(str_x) == 3:
                user_name = str_x[1]
                msg = str_x[2]
                try:
                    a = await userge.get_users(user_name)
                    user_id = a.id
                except BaseException:
                    return
                secret = os.path.join(PATH, "secret.txt")
                if os.path.exists(secret):
                    with open(secret) as outfile:
                        view_data = ujson.load(outfile)
                    # Uniquely identifies an inline message
                    new_id = {
                        str(inline_query.id): {
                            "user_id": user_id,
                            "msg": msg
                        }
                    }
                    view_data.update(new_id)
                else:
                    view_data = {
                        str(inline_query.id): {
                            "user_id": user_id,
                            "msg": msg
                        }
                    }
                # Save
                with open(secret, "w") as r:
                    ujson.dump(view_data, r)

                buttons = [[
                    InlineKeyboardButton(
                        "🔐  SHOW", callback_data=f"secret_{inline_query.id}")
                ]]
                results.append(
                    InlineQueryResultArticle(
                        title="Send A Secret Message",
                        input_message_content=InputTextMessageContent(
                            f"📩 <b>Secret Msg</b> for {user_name}. Only he/she can open it."
                        ),
                        description=f"Send Secret Message to: {user_name}",
                        thumb_url="https://i.imgur.com/c5pZebC.png",
                        reply_markup=InlineKeyboardMarkup(buttons),
                    ))

            if str_y[0].lower() == "ytdl" and len(str_y) == 2:
                link = get_yt_video_id(str_y[1])
                found_ = True
                if link is None:
                    search = VideosSearch(str_y[1], limit=15)
                    resp = (search.result()).get("result")
                    if len(resp) == 0:
                        found_ = False
                    else:
                        outdata = await result_formatter(resp)
                        key_ = rand_key()
                        ytsearch_data.store_(key_, outdata)
                        buttons = InlineKeyboardMarkup([
                            [
                                InlineKeyboardButton(
                                    text=f"1 / {len(outdata)}",
                                    callback_data=f"ytdl_next_{key_}_1",
                                )
                            ],
                            [
                                InlineKeyboardButton(
                                    text="📜  List all",
                                    callback_data=f"ytdl_listall_{key_}_1",
                                ),
                                InlineKeyboardButton(
                                    text="⬇️  Download",
                                    callback_data=
                                    f'ytdl_download_{outdata[1]["video_id"]}_0',
                                ),
                            ],
                        ])
                        caption = outdata[1]["message"]
                        photo = outdata[1]["thumb"]
                else:
                    caption, buttons = await download_button(link, body=True)
                    photo = await get_ytthumb(link)

                if found_:
                    results.append(
                        InlineQueryResultPhoto(
                            photo_url=photo,
                            title=link,
                            description="⬇️ Click to Download",
                            caption=caption,
                            reply_markup=buttons,
                        ))
                else:
                    results.append(
                        InlineQueryResultArticle(
                            title="not Found",
                            input_message_content=InputTextMessageContent(
                                f"No Results found for `{str_y[1]}`"),
                            description="INVALID",
                        ))

            MAIN_MENU = InlineQueryResultArticle(
                title="Main Menu",
                input_message_content=InputTextMessageContent(
                    " 𝐔𝐒𝐄𝐑𝐆𝐄-𝐗  𝗠𝗔𝗜𝗡 𝗠𝗘𝗡𝗨 "),
                url="https://github.com/code-rgb/USERGE-X",
                description="Userge-X Main Menu",
                thumb_url="https://i.imgur.com/1xsOo9o.png",
                reply_markup=InlineKeyboardMarkup(main_menu_buttons()),
            )
            results.append(MAIN_MENU)
            if len(results) != 0:
                await inline_query.answer(
                    results=results,
                    cache_time=1,
                    switch_pm_text="Available Commands",
                    switch_pm_parameter="inline",
                )
        else:
            results.append(REPO_X)
            owner_name = (await userge.get_me()).first_name
            await inline_query.answer(
                results=results,
                cache_time=1,
                switch_pm_text=f"This bot is only for {owner_name}",
                switch_pm_parameter="start",
            )
Exemplo n.º 29
0
_CATEGORY = {
    "admin": "🙋🏻‍♂️",
    "fun": "🎨",
    "misc": "🧩",
    "tools": "🧰",
    "utils": "🗂",
    "unofficial": "➕",
    "temp": "♻️",
    "plugins": "💎",
    "bot": "💠",
}
# Database
SAVED_SETTINGS = get_collection("CONFIGS")
REPO_X = InlineQueryResultArticle(
    title="Repo",
    input_message_content=InputTextMessageContent(
        "**Here's how to setup USERGE-X** "),
    url="https://github.com/code-rgb/USERGE-X",
    description="Setup Your Own",
    thumb_url="https://i.imgur.com/1xsOo9o.png",
    reply_markup=InlineKeyboardMarkup([[
        InlineKeyboardButton("🔥 USERGE-X Repo",
                             url="https://github.com/code-rgb/USERGE-X"),
        InlineKeyboardButton(
            "🚀 Deploy USERGE-X",
            url=("https://heroku.com/deploy?template="
                 "https://github.com/code-rgb/USERGE-X/tree/alpha"),
        ),
    ]]),
)
# Thanks boi @FLAMEPOSEIDON
ALIVE_IMGS = [
Exemplo n.º 30
0
async def stylish_func(text, answers):
    upside = upsidedown_text_inline(text)
    answers.append(
        InlineQueryResultArticle(
            title=upside,
            description='Upside-down Text',
            input_message_content=InputTextMessageContent(upside),
        ), )
    over = text_style_generator(text, CHAR_OVER)
    answers.append(
        InlineQueryResultArticle(
            title=over,
            description='Overline Text',
            input_message_content=InputTextMessageContent(over),
        ), )
    under = text_style_generator(text, CHAR_UNDER)
    answers.append(
        InlineQueryResultArticle(
            title=under,
            description='Underline Text',
            input_message_content=InputTextMessageContent(under),
        ), )
    strike = text_style_generator(text, CHAR_STRIKE)
    answers.append(
        InlineQueryResultArticle(
            title=strike,
            description='Strike Text',
            input_message_content=InputTextMessageContent(strike),
        ), )
    points = text_style_generator(text, CHAR_POINTS)
    answers.append(
        InlineQueryResultArticle(
            title=points,
            description='Points Text',
            input_message_content=InputTextMessageContent(points),
        ), )
    smallcaps_conv = formatting_text_inline(text, smallcaps)
    answers.append(
        InlineQueryResultArticle(
            title=smallcaps_conv,
            description='Smallcaps Text',
            input_message_content=InputTextMessageContent(smallcaps_conv),
        ), )
    super_script = formatting_text_inline(text, superscript)
    answers.append(
        InlineQueryResultArticle(
            title=super_script,
            description='Superscript Text',
            input_message_content=InputTextMessageContent(super_script),
        ), )
    sub_script = formatting_text_inline(text, subscript)
    answers.append(
        InlineQueryResultArticle(
            title=sub_script,
            description='Subscript Text',
            input_message_content=InputTextMessageContent(sub_script),
        ), )
    wide_text = formatting_text_inline(text, wide)
    answers.append(
        InlineQueryResultArticle(
            title=wide_text,
            description='Wide Text',
            input_message_content=InputTextMessageContent(wide_text),
        ), )
    bubbles_text = formatting_text_inline(text, bubbles)
    answers.append(
        InlineQueryResultArticle(
            title=bubbles_text,
            description='Bubbles Text',
            input_message_content=InputTextMessageContent(bubbles_text),
        ), )
    bubblesblack_text = formatting_text_inline(text, bubblesblack)
    answers.append(
        InlineQueryResultArticle(
            title=bubblesblack_text,
            description='Bubbles Black Text',
            input_message_content=InputTextMessageContent(bubblesblack_text, ),
        ), )
    smoth_text = formatting_text_inline(text, smothtext)
    answers.append(
        InlineQueryResultArticle(
            title=smoth_text,
            description='Smoth Text',
            input_message_content=InputTextMessageContent(smoth_text),
        ), )

    graffiti_text = formatting_text_inline(text, graffiti)
    answers.append(
        InlineQueryResultArticle(
            title=graffiti_text,
            description='Graffiti Text',
            input_message_content=InputTextMessageContent(graffiti_text),
        ), )
    graffitib_text = formatting_text_inline(text, graffitib)
    answers.append(
        InlineQueryResultArticle(
            title=graffitib_text,
            description='Graffiti Bold Text',
            input_message_content=InputTextMessageContent(graffitib_text),
        ), )
    handwriting_text = formatting_text_inline(text, handwriting)
    answers.append(
        InlineQueryResultArticle(
            title=handwriting_text,
            description='Handwriting Text',
            input_message_content=InputTextMessageContent(handwriting_text, ),
        ), )
    handwritingb_text = formatting_text_inline(text, handwritingb)
    answers.append(
        InlineQueryResultArticle(
            title=handwritingb_text,
            description='Handwriting Bold Text',
            input_message_content=InputTextMessageContent(handwritingb_text, ),
        ), )