Пример #1
0
# Copyright (c) By Midhun KM [@StarkXD]
# I Am Noob
# Official Web : nekobot.xyz
# "Copy It As You Want But Don't Edit Credits"
import requests
from WhiteEyeUserBot.utils import edit_or_reply, WhiteEye_on_cmd, sudo_cmd
from WhiteEyeUserBot import CMD_HELP


@WhiteEye.on(WhiteEye_on_cmd("ttt ?(.*)"))
@WhiteEye.on(sudo_cmd("ttt ?(.*)", allow_sudo=True))
async def noobishere(event):
    reply_to_id = event.message.id
    if event.reply_to_msg_id:
        reply_to_id = event.reply_to_msg_id
    reply = await event.get_reply_message()
    if event.pattern_match.group(1):
        ipman = event.pattern_match.group(1)
    elif reply.text:
        ipman = reply.message
    else:
        await edit_or_reply(event, "Trump : What Should I Tweet For You ?")
        return

    url = f"https://nekobot.xyz/api/imagegen?type=trumptweet&text={ipman}"
    starkgang = requests.get(url=url).json()
    meikobot = starkgang.get("message")
    tweetimg = meikobot
    starkxd = f"Trump Has Tweeted {ipman}"
    await edit_or_reply(event, "Trump : Wait I Am Tweeting Your Texts")
    await event.client.send_file(event.chat_id,
Пример #2
0
    "\U0001F900-\U0001F9FF"  # Supplemental Symbols and Pictographs
    "\U0001FA00-\U0001FA6F"  # Chess Symbols
    "\U0001FA70-\U0001FAFF"  # Symbols and Pictographs Extended-A
    "\U00002702-\U000027B0"  # Dingbats
    "]+"
)


def deEmojify(inputString: str) -> str:
    """Remove emojis and other non-safe characters from string"""
    return re.sub(EMOJI_PATTERN, "", inputString)


# @register(outgoing=True, pattern="^.waifu(?: |$)(.*)", allow_sudo=True))
@WhiteEye.on(WhiteEye_on_cmd(pattern=r"waifu(?: |$)(.*)"))
@WhiteEye.on(sudo_cmd(pattern=r"waifu(?: |$)(.*)", allow_sudo=True))
async def waifu(animu):
    # """Creates random anime sticker!"""

    text = animu.pattern_match.group(1)
    if not text:
        if animu.is_reply:
            text = (await animu.get_reply_message()).message
        else:
            await edit_or_reply(
                animu, "`You haven't written any article, Waifu is going away.`"
            )
            return
    animus = [1, 3, 7, 9, 13, 22, 34, 35, 36, 37, 43, 44, 45, 52, 53, 55]
    sticcers = await bot.inline_query(
        "stickerizerbot", f"#{random.choice(animus)}{(deEmojify(text))}"
Пример #3
0
    name = event.raw_text
    snips = sql.get_chat_blacklist(event.chat_id)
    for snip in snips:
        pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
        if re.search(pattern, name, flags=re.IGNORECASE):
            try:
                await event.delete()
            except Exception:
                await event.reply(
                    "I do not have DELETE permission in this chat")
                sql.rm_from_blacklist(event.chat_id, snip.lower())
            break


@WhiteEye.on(WhiteEye_on_cmd("textblacklist ((.|\n)*)"))
@WhiteEye.on(sudo_cmd("textblacklist ((.|\n)*)", allow_sudo=True))
async def on_add_black_list(event):
    starksayxd = await edit_or_reply(
        event, "Trying To Set This Text As Blacklist xD")
    text = event.pattern_match.group(1)
    to_blacklist = list(
        set(trigger.strip() for trigger in text.split("\n")
            if trigger.strip()))
    for trigger in to_blacklist:
        sql.add_to_blacklist(event.chat_id, trigger.lower())
    await starksayxd.edit(
        "Added {} triggers to the blacklist in the current chat".format(
            len(to_blacklist)))


@WhiteEye.on(WhiteEye_on_cmd("listblacklist"))
Пример #4
0
"""
Created by @Jisan7509
plugin for @WhiteEyeOT
"""

from telethon.errors.rpcerrorlist import YouBlockedUserError

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, edit_or_reply, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd(pattern=r"score$"))
@WhiteEye.on(sudo_cmd(pattern=r"score$", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    chat = "@cricbuzz_bot"
    reply_to_id = event.message
    catevent = await edit_or_reply(event, "```Gathering info...```")
    async with event.client.conversation(chat) as conv:
        try:
            msg_start = await conv.send_message("/start")
            response = await conv.get_response()
            msg = await conv.send_message("/score")
            respond = await conv.get_response()
            await event.client.send_read_acknowledge(conv.chat_id)
        except YouBlockedUserError:
            await catevent.edit("Unblock @cricbuzz_bot & try again")
            return
        if respond.text.startswith("I can't find that"):
            await catevent.edit("sorry i can't find it")
Пример #5
0
        time_list.append(int(result))
        seconds = int(remainder)

    for x in range(len(time_list)):
        time_list[x] = str(time_list[x]) + time_suffix_list[x]
    if len(time_list) == 4:
        ping_time += time_list.pop() + ", "

    time_list.reverse()
    ping_time += ":".join(time_list)

    return ping_time


@WhiteEye.on(WhiteEye_on_cmd(pattern="ping$"))
@WhiteEye.on(sudo_cmd(pattern="ping$", allow_sudo=True))
async def _(event):
    starkislub = await edit_or_reply(event, "`Pong !`")
    if event.fwd_from:
        return
    start = datetime.now()
    end = datetime.now()
    ms = (end - start).microseconds / 1000
    uptime = get_readable_time((time.time() - Lastupdate))
    await starkislub.edit(
        f"**█▀█ █▀█ █▄░█ █▀▀ █ \n█▀▀ █▄█ █░▀█ █▄█ ▄**\n ➲ `{ms}` \n ➲ `{uptime}`"
    )


CMD_HELP.update({
    "ping":
Пример #6
0
# Lel, Didn't Get Time To Make New One So Used Plugin Made br @mrconfused and @sandy1709 dont edit credits
import io
import os

import lyricsgenius
from tswift import Song

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import edit_or_reply, WhiteEye_on_cmd, sudo_cmd

GENIUS = os.environ.get("GENIUS_API_TOKEN", None)


@WhiteEye.on(WhiteEye_on_cmd(outgoing=True, pattern="lyrics (.*)"))
@WhiteEye.on(sudo_cmd(pattern="lyrics (.*)", allow_sudo=True))
async def _(event):
    await edit_or_reply(event, "Searching For Lyrics.....")
    reply_to_id = event.message.id
    if event.reply_to_msg_id:
        reply_to_id = event.reply_to_msg_id
    reply = await event.get_reply_message()
    if event.pattern_match.group(1):
        query = event.pattern_match.group(1)
    elif reply.text:
        query = reply.message
    else:
        await edit_or_reply(event, "`What I am Supposed to find `")
        return

    song = ""
    song = Song.find_song(query)
Пример #7
0
"""Download & Upload Images on Telegram\n
Syntax: `.img <Name>` or `.img (replied message)`
\n Upgraded and Google Image Error Fixed
"""

import os
import shutil
from re import findall

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.googol_images import googleimagesdownload
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, edit_or_reply, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd(pattern="img ?(.*)"))
@WhiteEye.on(sudo_cmd(pattern="img ?(.*)", allow_sudo=True))
async def img_sampler(event):
    if event.fwd_from:
        return
    await edit_or_reply(event, "`Processing...`")
    reply = await event.get_reply_message()
    if event.pattern_match.group(1):
        query = event.pattern_match.group(1)
    elif reply:
        query = reply.message
    else:
        await edit_or_reply(
            event,
            "`um, mind mentioning what I actually need to search for ;_;`")
        return
Пример #8
0
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <https://www.gnu.org/licenses/>.
import requests
from telethon.tl.types import MessageMediaPhoto

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd(pattern=r"pcheck"))
@WhiteEye.on(sudo_cmd(pattern=r"pcheck", allow_sudo=True))
async def pcheck(event):
    url = "https://nsfw-categorize.it/api/upload"
    await event.edit("`Processing..`")
    replymsg = await event.get_reply_message()
    photo = None
    if replymsg and replymsg.media:
        if isinstance(replymsg.media, MessageMediaPhoto):
            photo = await borg.download_media(message=replymsg.photo)
        elif "image" in replymsg.media.document.mime_type.split("/"):
            photo = await borg.download_file(replymsg.media.document)
        else:
            await event.edit("`Reply To Image.`")
    if photo:
        files = {"image": (f"{photo}", open(f"{photo}", "rb"))}
        r = requests.post(url, files=files).json()
Пример #9
0
# For @UniBorg
# Courtesy @yasirsiddiqui
"""
.bye
"""
import time

from telethon.tl.functions.channels import LeaveChannelRequest

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, edit_or_reply, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd("bye", outgoing=True))
@WhiteEye.on(sudo_cmd("bye", allow_sudo=True))
async def leave(e):
    if event.fwd_from:
        return
    starkgang = await edit_or_reply(e, "Bye Kek")
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        await starkgang.edit("`I am leaving this chat.....!`")
        time.sleep(3)
        if "-" in str(e.chat_id):
            await borg(LeaveChannelRequest(e.chat_id))
        else:
            await starkgang.edit("`Sir This is Not A Group`")


CMD_HELP.update({
    "bye":
    "**Bye**\
Пример #10
0
from telethon.tl.functions.photos import DeletePhotosRequest, GetUserPhotosRequest
from telethon.tl.types import InputPhoto

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, edit_or_reply, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd(pattern="delpfp ?(.*)"))
@WhiteEye.on(sudo_cmd(pattern="delpfp ?(.*)", allow_sudo=True))
async def remove_profilepic(delpfp):
    """ For .delpfp command, delete your current profile picture in Telegram. """
    group = delpfp.text[8:]
    if group == "all":
        lim = 0
    elif group.isdigit():
        lim = int(group)
    else:
        lim = 1

    pfplist = await delpfp.client(
        GetUserPhotosRequest(user_id=delpfp.from_id, offset=0, max_id=0, limit=lim)
    )
    input_photos = []
    for sep in pfplist.photos:
        input_photos.append(
            InputPhoto(
                id=sep.id,
                access_hash=sep.access_hash,
                file_reference=sep.file_reference,
            )
        )
Пример #11
0
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.

#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <https://www.gnu.org/licenses/>.

"""
Echoes the message via your bot
"""

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, sudo_cmd

@WhiteEye.on(WhiteEye_on_cmd(pattern=r"echo (.*)"))
@WhiteEye.on(sudo_cmd(pattern=r"echo ( .*)", allow_sudo=True))
async def _(event):
    bxt = Var.TG_BOT_USER_NAME_BF_HER
    try:
        tex = str(event.text[6:])
        await tgbot.send_message(event.chat_id, tex)
        await event.delete()
    except BaseException:
        await event.client.send_message(event.chat_id, f"Please add @{bxt} here first!")
        await event.delete()

        
CMD_HELP.update(
    {
        "echo": ".echo <mssg>\nUse - Echoes the message you send via your bot. You must add it to this chat first, ofc."
    }
Пример #12
0
from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import edit_or_reply, WhiteEye_on_cmd, sudo_cmd

telegraph = Telegraph()
tgnoob = telegraph.create_account(short_name="WhiteEye 🇮🇳")

Heroku = heroku3.from_key(Var.HEROKU_API_KEY)
heroku_api = "https://api.heroku.com"


@WhiteEye.on(
    WhiteEye_on_cmd(pattern="(set|get|del) var(?: |$)(.*)(?: |$)([\s\S]*)",
                    outgoing=True))
@WhiteEye.on(
    sudo_cmd(pattern="(set|get|del) var(?: |$)(.*)(?: |$)([\s\S]*)",
             allow_sudo=True))
async def variable(var):
    """
    Manage most of ConfigVars setting, set new var, get current var,
    or delete var...
    """
    if Var.HEROKU_APP_NAME is not None:
        app = Heroku.app(Var.HEROKU_APP_NAME)
    else:
        return await edit_or_reply(
            var, "`[HEROKU]:"
            "\nPlease setup your` **HEROKU_APP_NAME**")
    exe = var.pattern_match.group(1)
    heroku_var = app.config()
    if exe == "get":
        await edit_or_reply(var, "`Getting information...`")
Пример #13
0
pm_caption += "✯ **Python:** `3.7.4` \n"
pm_caption += f"✯ **Uptime** : `{uptime}` \n"
pm_caption += "✯ **Database Status:**  `Functional`\n"
pm_caption += "✯ **Current Branch** : `master`\n"
pm_caption += f"✯ **My Boss** : {DEFAULTUSER} \n"
pm_caption += "✯ **Heroku Database** : `AWS - Working Properly`\n\n"
pm_caption += "✯**[Join Our Channel]**(https://t.me/WhiteEyeOT)\n"
pm_caption += "✯ **License** : [GNU General Public License v3.0](https://github.com/whiteeye-org/WhiteEyeUserBot/blob/main/LICENSE)\n"
pm_caption += "✯ **Copyright** : By [WhiteEye](https://t.me/WhiteEyeDevs)\n"
pm_caption += (
    "[🇮🇳 Deploy WhiteEyeUserBot 🇮🇳](https://whiteeye-org.github.io/WhiteEyeUserBot/)\n"
)


@WhiteEye.on(WhiteEye_on_cmd(pattern=r"online"))
@WhiteEye.on(sudo_cmd(pattern=r"alive", allow_sudo=True))
async def WhiteEye(alive):
    await alive.get_chat()
    """ For .online command, check if the bot is running.  """
    await borg.send_file(alive.chat_id, PM_IMG, caption=pm_caption)
    await alive.delete()
    await alive.delete()


CMD_HELP.update({
    "alive":
    "**ALive**\
\n\n**Syntax : **`.online`\
\n**Usage :** Check if UserBot is Alive"
})
Пример #14
0
"""Get ID of any Telegram media, or any user
Syntax: .get_id"""
from telethon.utils import pack_bot_file_id

from WhiteEyeUserBot.utils import edit_or_reply, WhiteEye_on_cmd, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd("get_id"))
@WhiteEye.on(sudo_cmd("get_id", allow_sudo=True))
async def _(event):
    starkisgreat = await edit_or_reply(event, "Processing")
    if event.fwd_from:
        return
    if event.reply_to_msg_id:
        await event.get_input_chat()
        r_msg = await event.get_reply_message()
        if r_msg.media:
            bot_api_file_id = pack_bot_file_id(r_msg.media)
            await starkisgreat.edit(
                "Current Chat ID: `{}`\nFrom User ID: `{}`\nBot API File ID: `{}`"
                .format(str(event.chat_id), str(r_msg.from_id),
                        bot_api_file_id))
        else:
            await starkisgreat.edit(
                "Current Chat ID: `{}`\nFrom User ID: `{}`".format(
                    str(event.chat_id), str(r_msg.from_id)))
    else:
        await starkisgreat.edit("Current Chat ID: `{}`".format(
            str(event.chat_id)))
Пример #15
0
from datetime import datetime

import requests
from bs4 import BeautifulSoup
from google_images_download import google_images_download

from WhiteEyeUserBot.utils import edit_or_reply, WhiteEye_on_cmd, sudo_cmd


def progress(current, total):
    logger.info("Downloaded {} of {}\nCompleted {}".format(
        current, total, (current / total) * 100))


@WhiteEye.on(WhiteEye_on_cmd(pattern="search (.*)"))
@WhiteEye.on(sudo_cmd(pattern="search (.*)", allow_sudo=True))
async def _(event):
    stark = await edit_or_reply(event, "`Processing Your Request`")
    if event.fwd_from:
        return
    start = datetime.now()
    await stark.edit("`Trying To Connect...`")
    # SHOW_DESCRIPTION = False
    input_str = event.pattern_match.group(
        1
    )  # + " -inurl:(htm|html|php|pls|txt) intitle:index.of \"last modified\" (mkv|mp4|avi|epub|pdf|mp3)"
    input_url = "https://bots.shrimadhavuk.me/search/?q={}".format(input_str)
    headers = {"USER-AGENT": "UniBorg"}
    response = requests.get(input_url, headers=headers).json()
    output_str = " "
    for result in response["results"]:
Пример #16
0
    "`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**!.`",
]
# ===========================================


@WhiteEye.on(WhiteEye_on_cmd(pattern="run ?(.*)"))
@WhiteEye.on(sudo_cmd(pattern="run ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    bro = random.randint(0, len(RUNSREACTS) - 1)
    event.pattern_match.group(1)
    reply_text = RUNSREACTS[bro]
    await edit_or_reply(event, reply_text)


@WhiteEye.on(WhiteEye_on_cmd(pattern="metoo ?(.*)"))
@WhiteEye.on(sudo_cmd(pattern="metoo ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    bro = random.randint(0, len(METOOSTR) - 1)
Пример #17
0
"""Get information about an user on GitHub
Syntax: .github USERNAME"""
import requests

from WhiteEyeUserBot.utils import edit_or_reply, WhiteEye_on_cmd, sudo_cmd


@borg.on(WhiteEye_on_cmd("github (.*)"))
@borg.on(sudo_cmd("github (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    url = "https://api.github.com/users/{}".format(input_str)
    r = requests.get(url)
    if r.status_code != 404:
        b = r.json()
        avatar_url = b["avatar_url"]
        html_url = b["html_url"]
        gh_type = b["type"]
        name = b["name"]
        company = b["company"]
        blog = b["blog"]
        location = b["location"]
        bio = b["bio"]
        created_at = b["created_at"]
        await borg.send_file(
            event.chat_id,
            caption="""Name: [{}]({})
Type: {}
Company: {}
Пример #18
0
# Copyright (C) By StarkGang [@Starkxd]
# Don't edit credits
# Works On Bases Of Cyberboysumanjay's Inshorts News Api
# Test

import requests

from WhiteEyeUserBot.utils import edit_or_reply, WhiteEye_on_cmd, sudo_cmd
from var import Var

newslog = Var.NEWS_CHANNEL_ID


@WhiteEye.on(WhiteEye_on_cmd("news (.*)"))
@WhiteEye.on(sudo_cmd("news (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if Var.NEWS_CHANNEL_ID is None:
        await edit_or_reply(
            event, "`Please ADD NEWS_CHANNEL_ID For This Module To Work`")
        return
    infintyvar = event.pattern_match.group(1)
    main_url = f"https://inshortsapi.vercel.app/news?category={infintyvar}"
    stuber = await edit_or_reply(
        event,
        f"Ok ! Fectching {infintyvar} From inshortsapi Server And Sending To News Channel",
    )
    await stuber.edit("All News Has Been Sucessfully Send To News Channel")
    starknews = requests.get(main_url).json()
    for item in starknews["data"]:
Пример #19
0
"""Malayalam Calendar plugin for Indian Bot
SYNTAX: .calendar YYYY-MM-DD"""
import json
from datetime import datetime

import requests

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd(pattern="calendar (.*)"))
@WhiteEye.on(sudo_cmd(pattern="calendar (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    input_str = event.pattern_match.group(1)
    input_sgra = input_str.split("-")
    if len(input_sgra) == 3:
        yyyy = input_sgra[0]
        mm = input_sgra[1]
        dd = input_sgra[2]
        required_url = "https://calendar.kollavarsham.org/api/years/{}/months/{}/days/{}?lang={}".format(
            yyyy, mm, dd, "en"
        )
        headers = {"Accept": "application/json"}
        response_content = requests.get(required_url, headers=headers).json()
        a = ""
        if "error" not in response_content:
            current_date_detail_arraays = response_content["months"][0]["days"][0]
Пример #20
0
    """Inputs time in milliseconds, to get beautified time,
    as string"""
    seconds, milliseconds = divmod(int(milliseconds), 1000)
    minutes, seconds = divmod(seconds, 60)
    hours, minutes = divmod(minutes, 60)
    days, hours = divmod(hours, 24)
    tmp = (((str(days) + " day(s), ") if days else "") +
           ((str(hours) + " hour(s), ") if hours else "") +
           ((str(minutes) + " minute(s), ") if minutes else "") +
           ((str(seconds) + " second(s), ") if seconds else "") +
           ((str(milliseconds) + " millisecond(s), ") if milliseconds else ""))
    return tmp[:-2]


@WhiteEye.on(WhiteEye_on_cmd(pattern="download(?: |$)(.*)", outgoing=True))
@WhiteEye.on(sudo_cmd(pattern="download(?: |$)(.*)", allow_sudo=True))
async def download(target_file):
    """ For .dl command, download files to the WhiteEyeUserBot's server. """
    WhiteEye = await edit_or_reply(target_file, "`Processing ...`")
    await WhiteEye.edit("Processing using WhiteEyeUserBot server ( ◜‿◝ )♡")
    input_str = target_file.pattern_match.group(1)
    if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
        os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
    if "|" in input_str:
        url, file_name = input_str.split("|")
        url = url.strip()
        # https://stackoverflow.com/a/761825/4723940
        file_name = file_name.strip()
        head, tail = os.path.split(file_name)
        if head:
            if not os.path.isdir(os.path.join(TEMP_DOWNLOAD_DIRECTORY, head)):
Пример #21
0
"""Evaluate Python Code inside Telegram
Syntax: .eval PythonCode"""
# 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/.

import io
import sys
import traceback

from WhiteEyeUserBot.utils import edit_or_reply, WhiteEye_on_cmd, sudo_cmd
from WhiteEyeUserBot import CMD_HELP


@WhiteEye.on(WhiteEye_on_cmd("eval"))
@WhiteEye.on(sudo_cmd("eval", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    await edit_or_reply(event, "Processing ...")
    cmd = event.text.split(" ", maxsplit=1)[1]
    reply_to_id = event.message.id
    if event.reply_to_msg_id:
        reply_to_id = event.reply_to_msg_id

    old_stderr = sys.stderr
    old_stdout = sys.stdout
    redirected_output = sys.stdout = io.StringIO()
    redirected_error = sys.stderr = io.StringIO()
    stdout, stderr, exc = None, None, None
Пример #22
0
"""Get Administrators of any Chat*
Syntax: .get_admin"""
from telethon.tl.types import (
    ChannelParticipantAdmin,
    ChannelParticipantCreator,
    ChannelParticipantsAdmins,
)

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, edit_or_reply, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd("get_ad?(m)in ?(.*)"))
@WhiteEye.on(sudo_cmd("get_ad?(m)in ?(.*)", allow_sudo=True))
async def _(event):
    admeme = await edit_or_reply(event, "Processing")
    if event.fwd_from:
        return
    mentions = "**Admins in this Channel**: \n"
    should_mention_admins = False
    reply_message = None
    pattern_match_str = event.pattern_match.group(1)
    if "m" in pattern_match_str:
        should_mention_admins = True
        if event.reply_to_msg_id:
            reply_message = await event.get_reply_message()
    input_str = event.pattern_match.group(2)
    to_write_chat = await event.get_input_chat()
    chat = None
    if not input_str:
        chat = to_write_chat
Пример #23
0
"""DA.GD helpers in @UniBorg
Available Commands:
.isup URL
.dns google.com
.url <long url>
.unshort <short url>"""
import requests

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import edit_or_reply, WhiteEye_on_cmd, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd("dns (.*)"))
@WhiteEye.on(sudo_cmd("dns (.*)", allow_sudo=True))
async def _(event):
    starky = await edit_or_reply(event, "Processing.....")
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    sample_url = "https://da.gd/dns/{}".format(input_str)
    response_api = requests.get(sample_url).text
    if response_api:
        await starky.edit("DNS records of {} are \n{}".format(
            input_str, response_api))
    else:
        await starky.edit(
            "i can't seem to find {} on the internet".format(input_str))


@WhiteEye.on(WhiteEye_on_cmd("url (.*)"))
@WhiteEye.on(sudo_cmd("dns (.*)", allow_sudo=True))
Пример #24
0
import pyshorteners

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd(pattern="urlshort (.*)"))
@WhiteEye.on(sudo_cmd(pattern="urlshort (.*)", allow_sudo=True))
async def vom(event):
    try:
        link = event.pattern_match.group(1)
        sed = pyshorteners.Shortener()
        kek = sed.tinyurl.short(link)
        bestisbest = (
            f"<b>Url Shortened</b> \n<b><u>Given Link</u></b> ➠ <code>{link}</code> \n"
            f"<b><u>Shortened Link</u></b> ➠ <code>{kek}</code>"
        )
        await event.edit(bestisbest, parse_mode="HTML")
    except Exception as e:
        await event.edit("SomeThing Went Wrong. \nError : " + e)


CMD_HELP.update(
    {
        "urlshortner": "UrlShortner\
\n\nSyntax : .urlshort <link>\
\nUsage : Shortens Your Url"
    }
)
Пример #25
0
    image_stream.seek(0)
    # finally, reply the sticker
    await event.client.send_file(
        event.chat_id,
        image_stream,
        caption="WhiteEyeOT",
        reply_to=event.message.reply_to_msg_id,
    )
    # cleanup
    try:
        os.remove(FONT_FILE)
    except:
        pass


@WhiteEye.on(sudo_cmd(pattern="stcr ?(?:(.*?) \| )?(.*)", allow_sudo=True))
async def sticklet(event):
    R = random.randint(0, 256)
    G = random.randint(0, 256)
    B = random.randint(0, 256)
    reply_message = event.message
    if event.fwd_from:
        return
    # get the input text
    # the text on which we would like to do the magic on
    font_file_name = event.pattern_match.group(1)
    if not font_file_name:
        font_file_name = ""
    sticktext = event.pattern_match.group(2)
    if not sticktext and event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
Пример #26
0
"""Syntax: .meaning <word>"""

from PyDictionary import PyDictionary

from WhiteEyeUserBot import CMD_HELP
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, edit_or_reply, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd("meaning (.*)"))
@WhiteEye.on(sudo_cmd("meaning (.*)", allow_sudo=True))
async def _(event):
    dayam = await edit_or_reply(event, "Finding Meaning.....")
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    dictionary = PyDictionary()
    a = dictionary.meaning(input_str)
    b = a.get("Noun")
    kaif = ""
    for x in b:
        kaif += x + "\n"
    await dayam.edit(
        f"<b> meaning of {input_str} is:-</b>\n {kaif}",
        parse_mode="HTML",
    )


CMD_HELP.update({
    "dictionary":
    "**Dictionary**\
\n\n**Syntax : **`.meaning <word>`\
Пример #27
0
                    )
                else:
                    media = None
                event.message.id
                if event.reply_to_msg_id:
                    event.reply_to_msg_id
                await event.reply(snip.reply, file=media)
                if event.chat_id not in last_triggered_filters:
                    last_triggered_filters[event.chat_id] = []
                last_triggered_filters[event.chat_id].append(name)
                await asyncio.sleep(DELETE_TIMEOUT)
                last_triggered_filters[event.chat_id].remove(name)


@WhiteEye.on(WhiteEye_on_cmd(pattern="filter (.*)"))
@WhiteEye.on(sudo_cmd(pattern="filter (.*)", allow_sudo=True))
async def on_snip_save(event):
    if event.fwd_from:
        return
    hitler = await edit_or_reply(event, "Processing....")
    name = event.pattern_match.group(1)
    msg = await event.get_reply_message()
    if msg:
        snip = {"type": TYPE_TEXT, "text": msg.message or ""}
        if msg.media:
            media = None
            if isinstance(msg.media, types.MessageMediaPhoto):
                media = utils.get_input_photo(msg.media.photo)
                snip["type"] = TYPE_PHOTO
            elif isinstance(msg.media, types.MessageMediaDocument):
                media = utils.get_input_document(msg.media.document)
Пример #28
0
import asyncio
import math
import os

import heroku3
import requests

from WhiteEyeUserBot.functions.heroku_helper import HerokuHelper
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, edit_or_reply, sudo_cmd

Heroku = heroku3.from_key(Config.HEROKU_API_KEY)
heroku_api = "https://api.heroku.com"


@WhiteEye.on(WhiteEye_on_cmd(pattern="(logs|log)"))
@WhiteEye.on(sudo_cmd(pattern="(logs|log)", allow_sudo=True))
async def giblog(event):
    if event.fwd_from:
        return
    herokuHelper = HerokuHelper(Config.HEROKU_APP_NAME, Config.HEROKU_API_KEY)
    logz = herokuHelper.getLog()
    with open("logs.txt", "w") as log:
        log.write(logz)
    await borg.send_file(event.chat_id,
                         "logs.txt",
                         caption=f"**Logs Of {Config.HEROKU_APP_NAME}**")


@WhiteEye.on(WhiteEye_on_cmd(pattern="(rerun|restarts)"))
@WhiteEye.on(sudo_cmd(pattern="(restart|restarts)", allow_sudo=True))
async def restart_me(event):
Пример #29
0
Available Commands: .lock <option>, .unlock <option>, .locks
API Options: msg, media, sticker, gif, gamee, ainline, gpoll, adduser, cpin, changeinfo
DB Options: bots, commands, email, forward, url"""

from telethon import events, functions, types

from WhiteEyeUserBot.modules.sql_helper.locks_sql import (
    get_locks,
    is_locked,
    update_lock,
)
from WhiteEyeUserBot.utils import WhiteEye_on_cmd, edit_or_reply, sudo_cmd


@WhiteEye.on(WhiteEye_on_cmd("lock( (?P<target>\S+)|$)"))
@WhiteEye.on(sudo_cmd("lock( (?P<target>\S+)|$)", allow_sudo=True))
async def _(event):
    mrhackerguy = await edit_or_reply(event, "Processing")
    # Space weirdness in regex required because argument is optional and other
    # commands start with ".lock"
    if event.fwd_from:
        return
    input_str = event.pattern_match.group("target")
    peer_id = event.chat_id
    if input_str in (("bots", "commands", "email", "forward", "url")):
        update_lock(peer_id, input_str, True)
        await mrhackerguy.edit("Locked {}".format(input_str))
    else:
        msg = None
        media = None
        sticker = None
Пример #30
0
    send_media=None,
    send_stickers=None,
    send_gifs=None,
    send_games=None,
    send_inline=None,
    embed_links=None,
)

MUTE_RIGHTS = ChatBannedRights(until_date=None, send_messages=True)

UNMUTE_RIGHTS = ChatBannedRights(until_date=None, send_messages=False)
# ================================================


@WhiteEye.on(WhiteEye_on_cmd(pattern=r"setgpic"))
@WhiteEye.on(sudo_cmd(pattern=r"setgpic", allow_sudo=True))
async def set_group_photo(gpic):
    """ For .setgpic command, changes the picture of a group """
    if not gpic.is_group:
        await gpic.edit("`I don't think this is a group.`")
        return
    replymsg = await gpic.get_reply_message()
    await gpic.get_chat()
    photo = None
    if replymsg and replymsg.media:
        if isinstance(replymsg.media, MessageMediaPhoto):
            photo = await gpic.client.download_media(message=replymsg.photo)
        elif "image" in replymsg.media.document.mime_type.split("/"):
            photo = await gpic.client.download_file(replymsg.media.document)
        else:
            await gpic.edit(INVALID_MEDIA)