Beispiel #1
0
from W2HBOT.plugins.sql_helper.fban_sql import (
    add_channel,
    get_all_channels,
    in_channels,
    rm_channel,
)

logs_id = Config.FBAN_LOGGER_GROUP
bot = "@MissRose_bot"
W2H_logo = "./W2H/W2HBOT_logo.jpg"
# Keep all credits pls
# madewith great effort by @HeisenbergTheDanger
# modified by @David99q for fbans


@W2HBOT.on(admin_cmd(pattern="fban ?(.*)"))
@W2HBOT.on(sudo_cmd(pattern="fban ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    mssg = await eor(event, "`...`")
    if not event.is_reply:
        await mssg.edit("Reply to a message to start fban....")
        return
    channels = get_all_channels()
    error_count = 0
    sent_count = 0
    await mssg.edit("Fbanning....")
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        if previous_message.sticker or previous_message.poll:
Beispiel #2
0
import re

from W2HBOT import bot
from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from W2HBOT.cmdhelp import CmdHelp
from W2HBOT.helpers.functions import deEmojify


@bot.on(admin_cmd(pattern="anime(?: |$)(.*)"))
@bot.on(sudo_cmd(pattern="anime(?: |$)(.*)", allow_sudo=True))
async def nope(aura):
    W2H = aura.pattern_match.group(1)
    if not W2H:
        if aura.is_reply:
            (await aura.get_reply_message()).message
        else:
            await edit_or_reply(aura, "`Sir please give some query to search and download it for you..!`"
            )
            return

    troll = await bot.inline_query("animedb_bot", f"{(deEmojify(W2H))}")

    await troll[0].click(
        aura.chat_id,
        reply_to=aura.reply_to_msg_id,
        silent=True if aura.is_reply else False,
        hide_via=True,
    )
    await aura.delete()
    
Beispiel #3
0
# Enjoy

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

from userbot import bot
from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from userbot.cmdhelp import CmdHelp


@bot.on(admin_cmd(pattern="nhentai(?: |$)(.*)", outgoing=True))
@bot.on(sudo_cmd(pattern="nhentai(?: |$)(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    link = event.pattern_match.group()
    chat = "@nHentaiBot"
    await edit_or_reply(event, "```Processing```")
    async with bot.conversation(chat) as conv:
        try:
            response = conv.wait_event(
                events.NewMessage(incoming=True, from_users=424466890))
            await bot.send_message(chat, link)
            response = await response
        except YouBlockedUserError:
            await edit_or_reply(
                event, "```Please unblock @nHentaiBot and try again```")
            return
        if response.text.startswith("**Sorry I couldn't get manga from**"):
            await edit_or_reply(event,
                                "```I think this is not the right link```")
Beispiel #4
0
async def await_read(chat, message):
    chat = telethon.utils.get_peer_id(chat)

    async def read_filter(read_event):
        return read_event.chat_id == chat and read_event.is_read(message)

    fut = borg.await_event(events.MessageRead(inbox=False), read_filter)

    if await is_read(borg, chat, message):
        fut.cancel()
        return

    await fut


@bot.on(admin_cmd(pattern="(del)(?:ete)?$"))
@bot.on(admin_cmd(pattern="(edit)(?:\s+(.*))?$"))
async def delete(event):
    await event.delete()
    command = event.pattern_match.group(1)
    if command == "edit":
        text = event.pattern_match.group(2)
        if not text:
            return
    target = await get_target_message(event)
    if target:
        chat = await event.get_input_chat()
        await await_read(chat, target)
        await asyncio.sleep(0.5)
        if command == "edit":
            await borg.edit_message(chat, target, text)
Beispiel #5
0
import asyncio

from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from userbot.cmdhelp import CmdHelp


@bot.on(admin_cmd(pattern="undlt"))
@bot.on(sudo_cmd(pattern="undlt", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    c = await event.get_chat()
    if c.admin_rights or c.creator:
        a = await borg.get_admin_log(
            event.chat_id, limit=5, search="", edit=False, delete=True
        )
        for i in a:
            await event.reply(i.original.action.message)
    else:
        await edit_or_reply(event, "You need administrative permissions in order to do this command"
        )
        await asyncio.sleep(3)
        await event.delete()

CmdHelp("undlt").add_command(
  "undlt", None, "Sends 5 recently deleted message from that group. Requires admin position"
).add()
Beispiel #6
0
"""Get Administrators of any Chat*
Syntax: .userlist"""
from telethon import events
from telethon.errors.rpcerrorlist import MessageTooLongError
from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from userbot.cmdhelp import CmdHelp


@bot.on(admin_cmd(pattern=r"userlist ?(.*)", outgoing=True))
@bot.on(sudo_cmd(pattern=r"userlist ?(.*)", allow_sudo=True))
async def get_users(show):
    """ For .userslist command, list all of the users of the chat. """
    if not show.text[0].isalpha() and show.text[0] not in ("/", "#", "@", "!"):
        if not show.is_group:
            await edit_or_reply(show, "Are you sure this is a group?")
            return
        info = await show.client.get_entity(show.chat_id)
        title = info.title if info.title else "this chat"
        mentions = "Users in {}: \n".format(title)
        try:
            if not show.pattern_match.group(1):
                async for user in show.client.iter_participants(show.chat_id):
                    if not user.deleted:
                        mentions += (
                            f"\n[{user.first_name}](tg://user?id={user.id}) `{user.id}`"
                        )
                    else:
                        mentions += f"\nDeleted Account `{user.id}`"
            else:
                searchq = show.pattern_match.group(1)
                async for user in show.client.iter_participants(
Beispiel #7
0
from telethon import events, utils
from telethon.tl import types
from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from userbot.cmdhelp import CmdHelp
from userbot.plugins.sql_helper.filter_sql import get_filter, add_filter, remove_filter, get_all_filters, remove_all_filters

DELETE_TIMEOUT = 0
TYPE_TEXT = 0
TYPE_PHOTO = 1
TYPE_DOCUMENT = 2

global last_triggered_filters
last_triggered_filters = {}  # pylint:disable=E0602


@bot.on(admin_cmd(incoming=True))
async def on_snip(event):
    global last_triggered_filters
    name = event.raw_text
    if event.chat_id in last_triggered_filters:
        if name in last_triggered_filters[event.chat_id]:
            # avoid userbot spam
            # "I demand rights for us bots, we are equal to you humans." -Henri Koivuneva (t.me/UserbotTesting/2698)
            return False
    snips = get_all_filters(event.chat_id)
    if snips:
        for snip in snips:
            pattern = r"( |^|[^\w])" + re.escape(snip.keyword) + r"( |$|[^\w])"
            if re.search(pattern, name, flags=re.IGNORECASE):
                if snip.snip_type == TYPE_PHOTO:
                    media = types.InputPhoto(int(snip.media_id),
Beispiel #8
0
    "Ⓞ",
    "Ⓟ",
    "Ⓠ",
    "Ⓡ",
    "Ⓢ",
    "Ⓣ",
    "Ⓤ",
    "Ⓥ",
    "Ⓦ",
    "Ⓧ",
    "Ⓨ",
    "Ⓩ",
]


@bot.on(admin_cmd(pattern="weeb(?: |$)(.*)", command="weeb"))
@bot.on(sudo_cmd(pattern="weeb(?: |$)(.*)", command="weeb", allow_sudo=True))
async def weebify(event):
    if event.fwd_from:
        return
    args = event.pattern_match.group(1)
    if not args:
        get = await event.get_reply_message()
        args = get.text
    if not args:
        await edit_or_reply(event, "`What I am Supposed to Weebify U Dumb`")
        return
    string = "".join(args).lower()
    for normiecharacter in string:
        if normiecharacter in normiefont:
            weebycharacter = weebyfont[normiefont.index(normiecharacter)]
Beispiel #9
0
import os
import asyncio

from userbot import CmdHelp
from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from userbot import bot as W2HBOT


@W2HBOT.on(admin_cmd(pattern=r"unpack", outgoing=True))
@W2HBOT.on(sudo_cmd(pattern=r"unpack"))
async def _(event):
    b = await event.client.download_media(await event.get_reply_message())
    a = open(b, "r")
    c = a.read()
    a.close()
    a = await edit_or_reply(event, "```unpacking...```")
    if len(c) > 4095:
        await a.edit("`word limit of telegram is exceded!!! aborting...`")
    else:
        await event.client.send_message(event.chat_id, f"```{c}```")
        await a.delete()
    os.remove(b)


@W2HBOT.on(admin_cmd(pattern="repack ?(.*)", outgoing=True))
@W2HBOT.on(sudo_cmd(pattern="repack ?(.*)", allow_sudo=True))
async def _(event):
    a = await event.get_reply_message()
    input_str = event.pattern_match.group(1)
    b = open(input_str, "w")
    b.write(str(a.message))
Beispiel #10
0
                int((0, metadata.get("duration").seconds
                     )[metadata.has("duration")] / 2)),
            "-filter:v",
            "scale={}:-1".format(width),
            "-vframes",
            "1",
            output,
        ],
        stdout=subprocess.PIPE,
        stderr=subprocess.DEVNULL,
    )
    if not p.returncode and os.path.lexists(file):
        return output


@bot.on(admin_cmd(pattern="rename (.*)", outgoing=True))
@bot.on(sudo_cmd(pattern="rename (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    await edit_or_reply(
        event,
        "Renaming in process 🙄🙇‍♂️🙇‍♂️🙇‍♀️ It might take some time if file size is big"
    )
    input_str = event.pattern_match.group(1)
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    if event.reply_to_msg_id:
        start = datetime.now()
        file_name = input_str
        reply_message = await event.get_reply_message()
Beispiel #11
0
    elif message and message.video_note:
        media = "Round Video"
    elif message and message.gif:
        media = "Gif"
    elif message and message.sticker:
        media = "Sticker"
    elif message and message.video:
        media = "Video"
    elif message and message.document:
        media = "Document"
    else:
        media = None
    return media


@bot.on(admin_cmd(pattern="ffmpegsave$"))
@bot.on(sudo_cmd(pattern="ffmpegsave$", allow_sudo=True))
async def ff_mpeg_trim_cmd(event):
    if event.fwd_from:
        return
    if not os.path.exists(FF_MPEG_DOWN_LOAD_MEDIA_PATH):
        reply_message = await event.get_reply_message()
        if reply_message:
            start = datetime.now()
            media = media_type(reply_message)
            if media not in ["Video", "Audio", "Voice", "Round Video", "Gif"]:
                return await edit_delete(event,
                                         "`Only media files are supported`", 5)
            W2Hevent = await edit_or_reply(event, "`Saving the file...`")
            try:
                c_time = time.time()
Beispiel #12
0
                f"Mine Owner has Gone to Sleep (Pure Din Sota hi Rehta He {DEFAULTUSER} )",
            )
        except Exception as e:  # pylint:disable=C0103,W0703
            await borg.send_message(  # pylint:disable=E0602
                event.chat_id,
                "Please set `PLUGIN_CHANNEL` " +
                "for the proper functioning of night functionality " +
                "report in [W2HBOT](t.me/W2HSupport)\n\n `{}`".format(str(e)),
                reply_to=event.message.id,
                silent=True,
            )
        USER_night = {}  # pylint:disable=E0602
        night_time = None  # pylint:disable=E0602


@borg.on(admin_cmd(pattern=r"night ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    global USER_night  # pylint:disable=E0602
    global night_time  # pylint:disable=E0602
    global last_night_message  # pylint:disable=E0602
    global reason
    USER_night = {}
    night_time = None
    last_night_message = {}
    reason = event.pattern_match.group(1)
    if not USER_night:  # pylint:disable=E0602
        last_seen_status = await borg(  # pylint:disable=E0602
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
Beispiel #13
0
            await event.reply("`Channel or supergroup doesn't exist`")
            return None
        except (TypeError, ValueError):
            await event.reply("`Invalid channel/group`")
            return None
    return chat_info


def user_full_name(user):
    names = [user.first_name, user.last_name]
    names = [i for i in list(names) if i]
    full_name = " ".join(names)
    return full_name


@bot.on(admin_cmd(pattern="inviteall ?(.*)"))
@bot.on(sudo_cmd(pattern="inviteall ?(.*)", allow_sudo=True))
async def get_users(event):
    sender = await event.get_sender()
    me = await event.client.get_me()
    if not sender.id == me.id:
        W2H = await edit_or_reply(event, "`processing...`")
    else:
        W2H = await edit_or_reply(event, "`processing...`")
    aura = await get_chatinfo(event)
    chat = await event.get_chat()
    if event.is_private:
        return await W2H.edit("`Sorry, Cant add users here`")
    s = 0
    f = 0
    error = "None"
Beispiel #14
0
"""Fetch App Details from Playstore. @W2H_Userbot
.app <app_name> to fetch app details.
.appr <app_name>  to fetch app details with Xpl0iter request link.
.mods <app_name> to get the premier app from telegram if available.."""

import bs4
import requests

from userbot import ALIVE_NAME, CMD_HELP
from W2HBOT.utils import admin_cmd, edit_or_reply, sudo_cmd
from userbot.cmdhelp import CmdHelp

DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "W2H User"


@bot.on(admin_cmd(pattern="app (.*)"))
@bot.on(sudo_cmd(pattern="app (.*)", allow_sudo=True))
async def apk(event):
    if event.fwd_from:
        return
    app_name = event.pattern_match.group(1)
    event = await edit_or_reply(event, "Searching!")
    try:
        remove_space = app_name.split(" ")
        final_name = "+".join(remove_space)
        page = requests.get("https://play.google.com/store/search?q=" +
                            final_name + "&c=apps")
        str(page.status_code)
        soup = bs4.BeautifulSoup(page.content, "lxml", from_encoding="utf-8")
        results = soup.findAll("div", "ZmHEEd")
        app_name = (results[0].findNext("div", "Vpfmgd").findNext(
Beispiel #15
0
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError

from userbot import ALIVE_NAME, CMD_HELP
from W2HBOT.utils import admin_cmd, edit_or_reply, sudo_cmd
from userbot.cmdhelp import CmdHelp

DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "W2H User"

USERID = bot.uid

mention = f"[{DEFAULTUSER}](tg://user?id={USERID})"


@bot.on(admin_cmd("ascii ?(.*)"))
@bot.on(sudo_cmd(pattern="ascii ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if not event.reply_to_msg_id:
        await edit_or_reply(event, "Reply to any user message.😒🤐")
        return
    reply_message = await event.get_reply_message()
    if not reply_message.media:
        await edit_or_reply(event, "Reply to media message😒🤐")
        return
    chat = "@asciiart_bot"
    reply_message.sender
    if reply_message.sender.bot:
        await edit_or_reply(event, "Reply to actual users message.😒🤐")
Beispiel #16
0
from telegraph import Telegraph, exceptions, upload_file

from userbot import ALIVE_NAME
from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from userbot.cmdhelp import CmdHelp

W2H_NAME = str(ALIVE_NAME) if ALIVE_NAME else "W2H User"

aura = bot.uid

telegraph = Telegraph()
r = telegraph.create_account(short_name=Config.TELEGRAPH_SHORT_NAME)
auth_url = r["auth_url"]


@bot.on(admin_cmd(pattern="t(m|t) ?(.*)", outgoing=True))
@bot.on(sudo_cmd(pattern="t(m|t) ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if Config.PLUGIN_CHANNEL is None:
        await edit_or_reply(
            event,
            "Please set the required environment variable `PLUGIN_CHANNEL` for this plugin to work\n\nGo to [W2HBOT Chat Group](t.me/W2HSupport) for assistance"
        )
        return
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    await event.client.send_message(
        Config.PLUGIN_CHANNEL,
        "Created New Telegraph account {} for the current session. \n**Do not give this url to anyone, even if they say they are from Telegram!**"
Beispiel #17
0
import io
import os
import time

from telethon import events

from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from userbot.cmdhelp import CmdHelp

if not os.path.isdir("./SAVED"):
    os.makedirs("./SAVED")
if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
    os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)


@bot.on(admin_cmd(pattern="ls ?(.*)", outgoing=True))
@bot.on(sudo_cmd(pattern="ls ?(.*)", allow_sudo=True))
async def lst(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    if input_str:
        msg = "📂 **Files in {} :**\n".format(input_str)
        files = os.listdir(input_str)
    else:
        msg = "📂 **Files in Current Directory :**\n"
        files = os.listdir(os.getcwd())
    for file in files:
        msg += "📑 `{}`\n".format(file)
    if len(msg) <= Config.MAX_MESSAGE_SIZE_LIMIT:
        await edit_or_reply(event, msg)
Beispiel #18
0
from userbot.plugins.sql_helper.mute_sql import is_muted, mute, unmute
import asyncio
from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from userbot.cmdhelp import CmdHelp
from telethon import events


@bot.on(admin_cmd(pattern=r"gmute ?(\d+)?"))
@bot.on(sudo_cmd(pattern=r"gmute ?(\d+)?", allow_sudo=True))
async def b*****b(event):
    private = False
    if event.fwd_from:
        return
    reply = await event.get_reply_message()
    user_id = reply.sender_id
    if user_id == (await borg.get_me()).id:	
        await edit_or_reply(event, "I guess you need some rest. You are trying to gmute yourself😌")	
        	
        return
    elif event.is_private:
        await edit_or_reply(event, "`Tum bhut chud liye ab thoda aram kr lo 😂`")
        await asyncio.sleep(3)
        private = True
    reply = await event.get_reply_message()
    if event.pattern_match.group(1) is not None:
        userid = event.pattern_match.group(1)
    elif reply is not None:
        userid = reply.sender_id
    elif private is True:
        userid = event.chat_id
    else:
Beispiel #19
0
    "(ノAヽ)",
    "(╥_╥)",
    "(T⌓T)",
    "(༎ຶ⌑༎ຶ)",
    "(☍﹏⁰)。",
    "(ಥ_ʖಥ)",
    "(つд⊂)",
    "(≖͞_≖̥)",
    "(இ﹏இ`。)",
    "༼ಢ_ಢ༽",
    "༼ ༎ຶ ෴ ༎ຶ༽",
]
# ===========================================


@bot.on(admin_cmd(pattern="cri$", outgoing=True))
@bot.on(sudo_cmd(pattern="cri$", allow_sudo=True))
async def cri(e):
    """ y u du dis, i cry everytime !! """
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        await edit_or_reply(e, random.choice(CRI))


@bot.on(admin_cmd(pattern="hey$", outgoing=True))
@bot.on(sudo_cmd(pattern="hey$", allow_sudo=True))
async def hoi(hello):
    """ Greet everyone! """
    if not hello.text[0].isalpha() and hello.text[0] not in ("/", "#", "@",
                                                             "!"):
        await edit_or_reply(hello, random.choice(HELLOSTR))
Beispiel #20
0
            "🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇",
            "🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆[🎁](https://github.com/W2HGalaxy-OP/W2HBOT)🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇",
            "🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆[🎁](https://github.com/W2HGalaxy-OP/W2HBOT)🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇",
            "🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇[🎁](https://github.com/W2HGalaxy-OP/W2HBOT)🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇",
            "🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆[🎁](https://github.com/W2HGalaxy-OP/W2HBOT)🎆\n🎇🎆🎇🎆🎇🎆🎇",
            "🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n[🎁](https://github.com/W2HGalaxy-OP/W2HBOT)🎆🎇🎆🎇🎆🎇",
            "🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇[🎁](https://W2HGalaxy-OP/W2HBOT)\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆",
            "🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇🎆\n🎇🎆🎇🎆🎇🎆🎇\n🎆🎇🎆🎇🎆🎇\n🎇🎆🎇🎆🎇🎆🎇",
            "**Game Over**",
        ]
        for i in animation_ttl:
            await asyncio.sleep(animation_interval)
            await event.edit(animation_chars[i % 14])


@bot.on(admin_cmd(pattern="xogame$", outgoing=True))
@bot.on(sudo_cmd(pattern="xogame$", allow_sudo=True))
async def gamez(event):
    if event.fwd_from:
        return
    botusername = "******"
    noob = "play"
    if event.reply_to_msg_id:
        await event.get_reply_message()
    tap = await bot.inline_query(botusername, noob)
    await tap[0].click(event.chat_id)
    await event.delete()

CmdHelp("games").add_command(
  "xogame", None, "Lets play a game bruh. X-O Game iz here🔥"
).add()
Beispiel #21
0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from asyncio import sleep
from telethon import events
import telethon.utils
from telethon.errors import rpcbaseerrors

from W2HBOT.utils import admin_cmd, sudo_cmd, errors_handler
from userbot import bot as W2HBOT
from userbot import BOTLOG, BOTLOG_CHATID


@W2HBOT.on(admin_cmd(outgoing=True, pattern="del$"))
@W2HBOT.on(sudo_cmd(allow_sudo=True, pattern="del$"))
@errors_handler
async def delete_it(safai):
    """ For .del command, delete the replied message. """
    msg_src = await safai.get_reply_message()
    if safai.reply_to_msg_id:
        try:
            await msg_src.delete()
            await safai.delete()
            if BOTLOG:
                await delme.client.send_message(
                    BOTLOG_CHATID, "#DEL \nDeletion of message was successful")
        except rpcbaseerrors.BadRequestError:
            if BOTLOG:
                await delme.client.send_message(
                    BOTLOG_CHATID, "Well, I can't delete a message")
Beispiel #22
0
# PLUGIN MADE BY @David99q FOR W2HBOT
# KEEP CREDITS ELSE GAY

import random, re
from W2HBOT.utils import admin_cmd
import asyncio
from telethon import events


@borg.on(admin_cmd(pattern="hklove", outgoing=True))
async def _(event):
    await event.edit(
        "❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘❤😘"
    )
    await asyncio.sleep(1)
    await event.edit(
        "🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘🧡😘"
    )
    await asyncio.sleep(1)
    await event.edit(
        "💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘💛😘"
    )
    await asyncio.sleep(1)
    await event.edit(
        "💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘💚😘"
    )
    await asyncio.sleep(1)
    await event.edit(
        "💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘💙😘"
    )
    await asyncio.sleep(1)
Beispiel #23
0
    "¯\_(ツ)_/¯",
    "( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°)ʖ ͡°) ͡°)",
    "ʕ•ᴥ•ʔ",
    "(▀ Ĺ̯▀   )",
    "(ง ͠° ͟ل͜ ͡°)ง",
    "༼ つ ◕_◕ ༽つ",
    "ಠ_ಠ",
    "(☞ ͡° ͜ʖ ͡°)☞",
    "¯\_༼ ି ~ ି ༽_/¯",
    "c༼ ͡° ͜ʖ ͡° ༽⊃",
]

#✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓


@bot.on(admin_cmd(pattern=f"gendar$", outgoing=True))
@bot.on(sudo_cmd(pattern=f"gendar$", allow_sudo=True))
async def metoo(e):
    if e.fwd_from:
        return
    txt = random.choice(GENDER)
    await edit_or_reply(e, txt)


@bot.on(admin_cmd(pattern=f"shrug$", outgoing=True))
@bot.on(sudo_cmd(pattern=f"shrug$", allow_sudo=True))
async def metoo(e):
    if e.fwd_from:
        return
    txt = random.choice(SHRUG)
    await edit_or_reply(e, txt)
Beispiel #24
0
#
# Licensed under the Raphielscape Public License, Version 1.b (the "License");
# you may not use this file except in compliance with the License.
#
# You can find misc modules, which dont fit in anything xD

""" Userbot module for other small commands. """

from random import randint
from time import sleep

from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from userbot.cmdhelp import CmdHelp


@bot.on(admin_cmd(pattern="random", outgoing=True))
@bot.on(sudo_cmd(pattern="random", allow_sudo=True))
async def randomise(items):
    """ For .random command, get a random item from the list of items. """
    if not items.text[0].isalpha() and items.text[0] not in ("/", "#", "@", "!"):
        itemo = (items.text[8:]).split()
        index = randint(1, len(itemo) - 1)
        await edit_or_reply(items, 
            "**Query: **\n`"
            + items.text[8:]
            + "`\n**Output: **\n`"
            + itemo[index]
            + "`"
        )

@bot.on(admin_cmd(pattern="sleep([0-9]+)?$", outgoing=True))
Beispiel #25
0
import io
import os
import time
from asyncio import create_subprocess_exec as asyncrunapp
from asyncio.subprocess import PIPE as asyncPIPE

from W2HBOT.utils import admin_cmd
from userbot.cmdhelp import CmdHelp

if not os.path.isdir("./SAVED"):
    os.makedirs("./SAVED")
if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
    os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)


@borg.on(admin_cmd(outgoing=True, pattern="pips(?: |$)(.*)"))
async def pipcheck(pip):
    pipmodule = pip.pattern_match.group(1)
    if pipmodule:
        await pip.edit("`Searching . . .`")
        pipc = await asyncrunapp(
            "pip3",
            "search",
            pipmodule,
            stdout=asyncPIPE,
            stderr=asyncPIPE,
        )

        stdout, stderr = await pipc.communicate()
        pipout = str(stdout.decode().strip()) + str(stderr.decode().strip())
Beispiel #26
0
"""Get Detailed info about any message
Syntax: .json"""
import io

from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply
from userbot.cmdhelp import CmdHelp


@bot.on(admin_cmd(pattern="json$", outgoing=True))
@bot.on(admin_cmd(pattern="json$", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    the_real_message = None
    reply_to_id = None
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        the_real_message = previous_message.stringify()
        reply_to_id = event.reply_to_msg_id
    else:
        the_real_message = event.stringify()
        reply_to_id = event.message.id
    if len(the_real_message) > Config.MAX_MESSAGE_SIZE_LIMIT:
        with io.BytesIO(str.encode(the_real_message)) as out_file:
            out_file.name = "json.text"
            await borg.send_file(
                event.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                reply_to=reply_to_id,
Beispiel #27
0
    "`You should try sleeping forever.`",
    "`Pick up a gun and shoot yourself.`",
    "`Try bathing with Hydrochloric Acid instead of water.`",
    "`Go Green! Stop inhaling Oxygen.`",
    "`God was searching for you. You should leave to meet him.`",
    "`You should Volunteer for target in an firing range.`",
    "`Try playing catch and throw with RDX its fun.`",
    "`People like you are the reason we have middle fingers.`",
    "`When your mom dropped you off at the school, she got a ticket for littering.`",
    "`You’re so ugly that when you cry, the tears roll down the back of your head…just to avoid your face.`",
    "`If you’re talking behind my back then you’re in a perfect position to kiss my a**!.`",
]


# ===========================================
@bot.on(admin_cmd(pattern=f"randi$", outgoing=True))
@bot.on(sudo_cmd(pattern=f"randi$", allow_sudo=True))
async def rendi(e):
    txt = random.choice(RENDISTR)
    await edit_or_reply(e, txt)


@bot.on(admin_cmd(pattern=f"habuse$", outgoing=True))
@bot.on(sudo_cmd(pattern=f"habuse$", allow_sudo=True))
async def thenus(e):
    txt = random.choice(THANOS_STRINGS)
    await edit_or_reply(e, txt)


@bot.on(admin_cmd(pattern=f"fuk$", outgoing=True))
@bot.on(sudo_cmd(pattern=f"fuk$", allow_sudo=True))
Beispiel #28
0
import asyncio

from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply


@bot.on(admin_cmd(pattern="unoob$", outgoing=True))
@bot.on(sudo_cmd(pattern="unoob$", allow_sudo=True))
async def _(event):

    if event.fwd_from:

        return

    animation_interval = 0.5

    animation_ttl = range(0, 9)

    await edit_or_reply(event, "You Noob")

    animation_chars = [
        "EvErYbOdY",
        "iZ",
        "BiGGeSt",
        "NoOoB",
        "uNtiL",
        "YoU",
        "aRriVe",
        "😈",
        "EvErYbOdY iZ BiGGeSt NoOoB uNtiL YoU aRriVe 😈",
    ]
Beispiel #29
0
"""Get Telegram Profile Picture and other information
Syntax: .info @username"""

import html

from telethon.tl.functions.photos import GetUserPhotosRequest
from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import MessageEntityMentionName
from telethon.utils import get_input_location

from W2HBOT.utils import admin_cmd, sudo_cmd, edit_or_reply


@bot.on(admin_cmd(pattern="info ?(.*)", outgoing=True))
@bot.on(sudo_cmd(pattern="info ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    replied_user, error_i_a = await get_full_user(event)
    if replied_user is None:
        await event.edit(str(error_i_a))
        return False
    replied_user_profile_photos = await borg(
        GetUserPhotosRequest(user_id=replied_user.user.id,
                             offset=42,
                             max_id=0,
                             limit=80))
    replied_user_profile_photos_count = "NaN"
    try:
        replied_user_profile_photos_count = replied_user_profile_photos.count
    except AttributeError:
Beispiel #30
0
from telethon import functions, types
from telethon.errors import PhotoInvalidDimensionsError
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.messages import SendMediaRequest

from W2HBOT.utils import admin_cmd, edit_or_reply, progress, sudo_cmd
from userbot import CMD_HELP
from userbot.helpers.functions import unzip
from userbot.cmdhelp import CmdHelp

if not os.path.isdir("./temp"):
    os.makedirs("./temp")


@bot.on(admin_cmd(pattern="stoi$"))
@bot.on(sudo_cmd(pattern="stoi$", allow_sudo=True))
async def _(W2H):
    if W2H.fwd_from:
        return
    reply_to_id = W2H.message.id
    if W2H.reply_to_msg_id:
        reply_to_id = W2H.reply_to_msg_id
    event = await edit_or_reply(W2H, "Converting.....")
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    if event.reply_to_msg_id:
        filename = "hi.jpg"
        file_name = filename
        reply_message = await event.get_reply_message()
        to_download_directory = Config.TMP_DOWNLOAD_DIRECTORY