Пример #1
0
        await asyncio.sleep(10)
        await no_admin_privilege_message.edit(
            "This is useless SPAM dude . stop this enjoy chat man ",
            link_preview=False)
    else:
        await event.client.send_message(
            entity=event.chat_id,
            message="""**Automatic AntiFlooder**
[User](tg://user?id={}) has been automatically restricted
because he reached the defined flood limit.""".format(event.message.from_id),
            reply_to=event.message.id,
        )


@jarvis.on(admin_cmd(pattern="setflood (.*)"))
@jarvis.on(sudo_cmd(pattern="setflood (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    try:
        sql.set_flood(event.chat_id, input_str)
        sql.__load_flood_settings()
        await edit_or_reply(
            event,
            "Antiflood updated to {} in the current chat".format(input_str))
    except Exception as e:  # pylint:disable=C0103,W0703
        await edit_or_reply(event, str(e))


CMD_HELP.update({
Пример #2
0
# For JARVIS
# By Priyam Kalra
# Ported To JARVIS By Spidy
# Syntax (.hl <link>)

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd(pattern="hl ?(.*)", outgoing=True))
@jarvis.on(sudo_cmd(pattern="hl ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input = event.pattern_match.group(1)
    await edit_or_reply(event, "[ㅤㅤㅤㅤㅤㅤㅤ](" + input + ")")
Пример #3
0
"""Dictionary Plugin for @UniBorg
Syntax: .meaning <word>"""

import requests

from jarvis.utils import admin_cmd, sudo_cmd


@jarvis.on(admin_cmd("meaning (.*)"))
@jarvis.on(sudo_cmd("meaning (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    input_url = "https://bots.shrimadhavuk.me/dictionary/?s={}".format(
        input_str)
    headers = {"USER-AGENT": "UniBorg"}
    caption_str = f"Meaning of __{input_str}__\n"
    try:
        response = requests.get(input_url, headers=headers).json()
        pronounciation = response.get("p")
        meaning_dict = response.get("lwo")
        for current_meaning in meaning_dict:
            current_meaning_type = current_meaning.get("type")
            current_meaning_definition = current_meaning.get("definition")
            caption_str += (
                f"**{current_meaning_type}**: {current_meaning_definition}\n\n"
            )
    except Exception as e:
        caption_str = str(e)
    reply_msg_id = event.message.id
Пример #4
0
# BY @Deonnn
""" Game of Thrones Dialogues That You Can Use In Everyday Situations
 command .gotm
 by @Deonnn
"""

import asyncio
import random

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd(pattern=r"gotm", outgoing=True))
@jarvis.on(sudo_cmd(pattern=r"gotm", allow_sudo=True))
async def _(event):

    if event.fwd_from:

        return

    await edit_or_reply(event, "Thinking... 🤔")

    await asyncio.sleep(2)

    x = random.randrange(1, 30)

    if x == 1:

        await event.edit(
            "[To your teachers on failing you in all your papers confidently, every time...](https://telegra.ph/file/431d178780f9bff353047.jpg)",
            link_preview=True,
Пример #5
0
            )
        except Exception as e:  # pylint:disable=C0103,W0703
            await jbot.send_message(  # pylint:disable=E0602
                event.chat_id,
                "Please set `PLUGIN_CHANNEL` " +
                "for the proper functioning of afk functionality " +
                "in @JarvisSupportOT\n\n `{}`".format(str(e)),
                reply_to=event.message.id,
                silent=True,
            )
        USER_AFK = {}  # pylint:disable=E0602
        afk_time = None  # pylint:disable=E0602


@jarvis.on(admin_cmd(pattern=r"afk ?(.*)"))
@jarvis.on(sudo_cmd(pattern=r"afk ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    global USER_AFK  # pylint:disable=E0602
    global afk_time  # pylint:disable=E0602
    global last_afk_message  # pylint:disable=E0602
    global reason
    USER_AFK = {}
    afk_time = None
    last_afk_message = {}
    reason = event.pattern_match.group(1)
    if not USER_AFK:  # pylint:disable=E0602
        last_seen_status = await jbot(  # pylint:disable=E0602
            functions.account.GetPrivacyRequest(
                types.InputPrivacyKeyStatusTimestamp()))
Пример #6
0
# Lots of lub to @r4v4n4 for gibing the base <3
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd("scan ?(.*)"))
@jarvis.on(sudo_cmd("scan ?(.*)", 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 event.edit_or_reply("```reply to a media message```")
        return
    chat = "@DrWebBot"
    reply_message.sender
    if reply_message.sender.jbot:
        await event.edit("```Reply to actual users message.```")
        return
    await event.edit(" `Sliding my tip, of fingers over it`")
    async with jbot.conversation(chat) as conv:
        try:
            response = conv.wait_event(
                events.NewMessage(incoming=True, from_users=161163358))
            await jbot.forward_messages(chat, reply_message)
            response = await response
Пример #7
0
    "\U0001F800-\U0001F8FF"  # Supplemental Arrows-C
    "\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))
@jarvis.on(admin_cmd(pattern=r"waifu(?: |$)(.*)"))
@jarvis.on(sudo_cmd(outgoing=True, pattern="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 animu.edit(
                "`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))}")
    await sticcers[0].click(animu.chat_id,
Пример #8
0
import heroku3
import requests

from jarvis import CMD_HNDLR
from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd

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


@jarvis.on(
    admin_cmd(outgoing=True,
              pattern=r"(set|get|del) var(?: |$)(.*)(?: |$)([\s\S]*)"))
@jarvis.on(
    sudo_cmd(pattern=r"(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...`")
Пример #9
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 jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd("whois ?(.*)", outgoing=True))
@jarvis.on(sudo_cmd("whois ?(.*)", 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 edit_or_reply(event, 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:
Пример #10
0
# For @UniBorg
# Courtesy @yasirsiddiqui

"""
.bye
"""
import time

from telethon.tl.functions.channels import LeaveChannelRequest

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd("bye", outgoing=True))
@jarvis.on(sudo_cmd("bye", allow_sudo=True))
async def leave(e):
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        await edit_or_reply(e, "`I am leaving this chat.....!`")
        time.sleep(3)
        if "-" in str(e.chat_id):
            await borg(LeaveChannelRequest(e.chat_id))
        else:
            await e.edit("`Sir This is Not A Chat`")
Пример #11
0
import asyncio
import math
import os

import heroku3
import requests

from jarvis import CMD_HELP, CMD_HNDLR
from jarvis.utils import admin_cmd, edit_or_reply, eor, sudo_cmd

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


@jarvis.on(admin_cmd(pattern=r"(set|get|del) var (.*)", outgoing=True))
@jarvis.on(sudo_cmd(pattern=r"(set|get|del) var (.*)", outgoing=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":
        toput = await edit_or_reply(var, "`Getting information...`")
Пример #12
0
"""Quickly make a decision
Syntax: .decide"""
import requests

from jarvis.utils import admin_cmd, sudo_cmd


@jarvis.on(admin_cmd("decide", outgoing=True))
@jarvis.on(sudo_cmd("decide", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    message_id = event.message.id
    if event.reply_to_msg_id:
        message_id = event.reply_to_msg_id
    r = requests.get("https://yesno.wtf/api").json()
    await jbot.send_message(
        event.chat_id, r["answer"], reply_to=message_id, file=r["image"]
    )
    await event.delete()
Пример #13
0
from telethon import functions

from jarvis import ALIVE_NAME, CMD_LIST
from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd

DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "@JarvisOT"


@jarvis.on(admin_cmd(pattern="help ?(.*)", outgoing=True))
@jarvis.on(sudo_cmd(pattern="help ?(.*)", allow_sudo=True))
async def cmd_list(event):
    tgbotusername = Var.TG_BOT_USER_NAME_BF_HER
    input_str = event.pattern_match.group(1)
    if tgbotusername is None or input_str == "text":
        string = ""
        for i in CMD_LIST:
            string += "💗" + i + "\n"
            for iter_list in CMD_LIST[i]:
                string += "    " + str(iter_list) + ""
                string += "\n"
            string += "\n"
        if len(string) > 4095:
            with io.BytesIO(str.encode(string)) as out_file:
                out_file.name = "cmd.txt"
                await bot.send_file(
                    event.chat_id,
                    out_file,
                    force_document=True,
                    allow_cache=False,
                    caption="**COMMANDS**",
                    reply_to=reply_to_id,
Пример #14
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))
@jarvis.on(j_cmd(pattern=r"waifu(?: |$)(.*)"))
@jarvis.on(sudo_cmd(pattern=r"waifu(?: |$)(.*)", allow_sudo=True))
async def waifu(animu):
    if event.fwd_from:
        return
    # """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]
Пример #15
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


@jarvis.on(admin_cmd(pattern="ping$", outgoing=True))
@jarvis.on(sudo_cmd(pattern="ping$", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    end = datetime.now()
    ms = (end - start).microseconds / 1000
    await edit_or_reply(event, f"Pong! � {ms} ..")


@jarvis.on(admin_cmd(pattern="pong", outgoing=True))
@jarvis.on(sudo_cmd(pattern="pong", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
Пример #16
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)

# ================================================


@jarvis.on(j_cmd("setgpic$"))
@jarvis.on(sudo_cmd(pattern="setgpic$", allow_sudo=True))
@errors_handler
async def set_group_photo(gpic):
    if not gpic.is_group:
        await edit_or_reply(gpic, "`I don't think this is a group.`")
        return
    replymsg = await gpic.get_reply_message()
    chat = await gpic.get_chat()
    admin = chat.admin_rights
    creator = chat.creator
    photo = None
    if not admin and not creator:
        await edit_or_reply(gpic, NO_ADMIN)
        return
    if replymsg and replymsg.media:
        if isinstance(replymsg.media, MessageMediaPhoto):
Пример #17
0
"""Invite the user(s) to the current chat
Syntax: .invite <User(s)>"""

from telethon import functions

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd(pattern="invite ?(.*)"))
@jarvis.on(sudo_cmd(pattern="invite ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    to_add_users = event.pattern_match.group(1)
    if event.is_private:
        await edit_or_reply(
            event, "`.invite` users to a chat, not to a Private Message")
    else:
        logger.info(to_add_users)
        if not event.is_channel and event.is_group:
            # https://lonamiwebs.github.io/Telethon/methods/messages/add_chat_user.html
            for user_id in to_add_users.split(" "):
                try:
                    await jarvis(
                        functions.messages.AddChatUserRequest(
                            chat_id=event.chat_id,
                            user_id=user_id,
                            fwd_limit=1000000))
                except Exception as e:
                    await edit_or_reply(event, str(e))
                    return
Пример #18
0
import random

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd

RUNSREACTS = [
    "`Congratulations and BRAVO!`",
    "`You did it! So proud of you!`",
    "`This calls for celebrating! Congratulations!`",
    "`I knew it was only a matter of time. Well done!`",
    "`Congratulations on your well-deserved success.`",
    "`Heartfelt congratulations to you.`",
    "`Warmest congratulations on your achievement.`",
    "`Congratulations and best wishes for your next adventure!”`",
    "`So pleased to see you accomplishing great things.`",
    "`Feeling so much joy for you today. What an impressive achievement!`",
]


@jarvis.on(admin_cmd(pattern="congo", outgoing=True))
@jarvis.on(sudo_cmd(pattern="congo", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    bro = random.randint(0, len(RUNSREACTS) - 1)
    reply_text = RUNSREACTS[bro]
    await edit_or_reply(event, reply_text)
Пример #19
0
"""Get info about a File Extension
Syntax: .filext EXTENSION"""
import requests
from bs4 import BeautifulSoup

from jarvis.utils import j_cmd, edit_or_reply, sudo_cmd


@jarvis.on(j_cmd(pattern="filext (.*)", outgoing=True))
@jarvis.on(sudo_cmd(pattern="filext (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    await edit_or_reply(event, "Processing ...")
    sample_url = "https://www.fileext.com/file-extension/{}.html"
    input_str = event.pattern_match.group(1).lower()
    response_api = requests.get(sample_url.format(input_str))
    status_code = response_api.status_code
    if status_code == 200:
        raw_html = response_api.content
        soup = BeautifulSoup(raw_html, "html.parser")
        ext_details = soup.find_all("td", {"colspan": "3"})[-1].text
        await event.edit(
            "**File Extension**: `{}`\n**Description**: `{}`".format(
                input_str, ext_details))
    else:
        await edit_or_reply(
            event,
            "https://www.fileext.com/ responded with {} for query: {}".format(
                status_code, input_str),
        )
Пример #20
0
                     )[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


@jarvis.on(admin_cmd("rename (.*)", outgoing=True))
@jarvis.on(sudo_cmd("rename (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    ievent = await eor(event, "Renaming in process 🙄")
    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()
        time.time()
        to_download_directory = Config.TMP_DOWNLOAD_DIRECTORY
        downloaded_file_name = os.path.join(to_download_directory, file_name)
        downloaded_file_name = await jbot.download_media(
Пример #21
0
    fy = "http://getwallpapers.com" + random.choice(f)

    print(fy)

    if not os.path.exists("f.ttf"):

        urllib.request.urlretrieve(
            "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf",
            "f.ttf",
        )

    urllib.request.urlretrieve(fy, "donottouch.jpg")


@jarvis.on(admin_cmd(pattern="gamerdp ?(.*)", outgoing=True))
@jarvis.on(sudo_cmd(pattern="gamerdp ?(.*)", allow_sudo=True))
async def main(event):

    await edit_or_reply(
        event, "**Starting Gamer Profile Pic...\n\nDone !!! Check Your DP")

    while True:

        await animepp()

        file = await event.client.upload_file("donottouch.jpg")

        await event.client(functions.photos.UploadProfilePhotoRequest(file))

        os.system("rm -rf donottouch.jpg")
Пример #22
0
from random import randint
from time import sleep

from telethon.tl.types import (
    ChannelParticipantAdmin,
    ChannelParticipantCreator,
    ChannelParticipantsAdmins,
    ChannelParticipantsBots,
)
from telethon.utils import pack_jbot_file_id

from jarvis.utils import admin_cmd, edit_or_reply, eor, sudo_cmd


@jarvis.on(admin_cmd(outgoing=True, pattern="random"))
@jarvis.on(sudo_cmd(allow_sudo=True, pattern="random"))
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] + "`",
        )


@jarvis.on(admin_cmd(outgoing=True, pattern="sleep( [0-9]+)?$"))
@jarvis.on(sudo_cmd(allow_sudo=True, pattern="sleep( [0-9]+)?$"))
Пример #23
0
"""Color Plugin for @Jarvis
Syntax: .color <color_code>"""
import os

from PIL import Image, ImageColor

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd(pattern="color (.*)", outgoing=True))
@jarvis.on(sudo_cmd(pattern="color (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    message_id = event.message.id
    if event.reply_to_msg_id:
        message_id = event.reply_to_msg_id
    if input_str.startswith("#"):
        try:
            usercolor = ImageColor.getrgb(input_str)
        except Exception as e:
            await edit_or_reply(event, str(e))
            return False
        else:
            im = Image.new(mode="RGB", size=(1280, 720), color=usercolor)
            im.save("jarvis.png", "PNG")
            input_str = input_str.replace("#", "#COLOR_")
            await borg.send_file(
                event.chat_id,
                "jarvis.png",
Пример #24
0
"""Get information about an user on GitHub
Syntax: .github USERNAME"""
import requests

from jarvis.utils import j_cmd, edit_or_reply, sudo_cmd


@jarvis.on(j_cmd("github (.*)", outgoing=True))
@jarvis.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: {}
Пример #25
0
    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)
# ================================================


# @register(outgoing=True, pattern="^.setgpic$", allow_sudo=True))
@jarvis.on(admin_cmd(pattern=r"setgpic"))
@jarvis.on(sudo_cmd(pattern=r"setgpic", allow_sudo=True))
@errors_handler
async def set_group_photo(gpic):
    """ For .setgpic command, changes the picture of a group """
    if not gpic.is_group:
        await gpic.edit_or_reply("`I don't think this is a group.`")
        return
    replymsg = await gpic.get_reply_message()
    chat = await gpic.get_chat()
    admin = chat.admin_rights
    creator = chat.creator
    photo = None

    if not admin and not creator:
        await gpic.edit(NO_ADMIN)
        return
Пример #26
0
"""Emoji

Available Commands:

.ding"""

import asyncio

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd(pattern=r"ding", outgoing=True))
@jarvis.on(sudo_cmd(pattern=r"ding", allow_sudo=True))
async def _(event):

    if event.fwd_from:

        return

    animation_interval = 0.5

    animation_ttl = range(0, 10)

    # input_str = event.pattern_match.group(1)

    # if input_str == "ding":

    await edit_or_reply(event, "dong")

    animation_chars = [
        "🔴⬛⬛⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜",
Пример #27
0
import asyncio
import time

from telethon.errors import FloodWaitError
from telethon.tl import functions

from jarvis.utils import admin_cmd, eor, sudo_cmd

DEL_TIME_OUT = 60


@jarvis.on(admin_cmd(pattern="bio"))  # pylint:disable=E0602
@jarvis.on(sudo_cmd(pattern="bio", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    while True:
        DMY = time.strftime("%d.%m.%Y")
        HM = time.strftime("%H:%M:%S")
        bio = f"📅 {DMY} | User Of JarvisUserbot 😎 | ⌚️ {HM}"
        logger.info(bio)
        try:
            await bot(
                functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                    about=bio
                )
            )
            await eor(event, "Autobio Enabled !!")
            await asyncio.sleep(2)
            await event.delete()
        except FloodWaitError as ex:
Пример #28
0
"""Profile Updation Commands
.pbio <Bio>
.pname <Name>
.ppic"""
import os

from telethon.tl import functions

from jarvis.utils import admin_cmd, eor, sudo_cmd


@jarvis.on(admin_cmd(pattern="pbio (.*)", outgoing=True))
@jarvis.on(sudo_cmd(pattern="pbio (.*)", allow_sudo=True))  # pylint:disable=E0602
async def _(event):
    if event.fwd_from:
        return
    bio = event.pattern_match.group(1)
    try:
        await jbot(
            functions.account.UpdateProfileRequest(about=bio)  # pylint:disable=E0602
        )
        await eor(event, "Succesfully changed my profile bio")
    except Exception as e:  # pylint:disable=C0103,W0703
        await eor(event, str(e))


@jarvis.on(admin_cmd(pattern="pname ((.|\n)*)", outgoing=True))
@jarvis.on(sudo_cmd(pattern="pname ((.|\n)*)", allow_sudo=True))  # pylint:disable=E0602,W0703
async def _(event):
    if event.fwd_from:
        return
Пример #29
0
"""Check your internet speed powered by speedtest.net
Syntax: .speedtest
Available Options: image, file, text"""
from datetime import datetime

import speedtest

from jarvis.utils import j_cmd, eor, sudo_cmd


@jarvis.on(j_cmd("speed ?(.*)", outgoing=True))
@jarvis.on(sudo_cmd("speed ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    as_text = True
    as_document = False
    if input_str == "image":
        as_document = False
    elif input_str == "file":
        as_document = True
    elif input_str == "text":
        as_text = True
    await eor(event, "`Calculating my internet speed. Please wait!`")
    start = datetime.now()
    s = speedtest.Speedtest()
    s.get_best_server()
    s.download()
    s.upload()
    end = datetime.now()
Пример #30
0
`{}`""".format(event.message.from_id, str(e)),
            reply_to=event.message.id)
        await asyncio.sleep(10)
        await no_admin_privilege_message.edit(
            "This is useless SPAM dude . stop this enjoy chat man ",
            link_preview=False)
    else:
        await event.client.send_message(entity=event.chat_id,
                                        message="""**Automatic AntiFlooder**
[User](tg://user?id={}) has been automatically restricted
because he reached the defined flood limit.""".format(event.message.from_id),
                                        reply_to=event.message.id)


@jarvis.on(admin_cmd(pattern="setflood (.*)"))
@jarvis.on(sudo_cmd(outgoing=True, pattern="setflood (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    try:
        sql.set_flood(event.chat_id, input_str)
        CHAT_FLOOD = sql.__load_flood_settings()
        await event.edit(
            "Antiflood updated to {} in the current chat".format(input_str))
    except Exception as e:  # pylint:disable=C0103,W0703
        await event.edit(str(e))


CMD_HELP.update({
    "antiflood":