Ejemplo n.º 1
0
def choser(cmd, pack, blacklist=None):
    if blacklist is None:
        blacklist = {}
    docs = None

    @mlobot.on(admin_cmd(pattern=rf"{cmd}", outgoing=True))
    async def handler(event):
        await event.delete()

        nonlocal docs
        if docs is None:
            docs = [
                utils.get_input_document(x) for x in (await borg(
                    functions.messages.GetStickerSetRequest(
                        types.InputStickerSetShortName(pack)))).documents
                if x.id not in blacklist
            ]

        await event.respond(file=random.choice(docs))
Ejemplo n.º 2
0
    # TODO: exempt admins from locks
    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


@mlobot.on(admin_cmd(pattern="addblacklist ((.|\n)*)"))
@mlobot.on(sudo_cmd(pattern="addblacklist ((.|\n)*)"))
async def on_add_black_list(event):
    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 eor(
        event,
        "Added {} triggers to the blacklist in the current chat".format(
            len(to_blacklist)),
    )

Ejemplo n.º 3
0
from mlobot import CMD_HELP
from mlobot.mlobotConfig import Var
from mlobot.utils import admin_cmd

logging.basicConfig(
    format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
    level=logging.WARN)

NO_PM_LOG_USERS = []

BOTLOG = True
BOTLOG_CHATID = Var.PRIVATE_GROUP_ID


@mlobot.on(admin_cmd(outgoing=True, pattern=r"save(?: |$)([\s\S]*)"))
@mlobot.on(sudo_cmd(allow_sudo=True, pattern=r"save(?: |$)([\s\S]*)"))
async def log(log_text):
    """ For .log command, forwards a message or the command argument to the bot logs group """
    if BOTLOG:
        if log_text.reply_to_msg_id:
            reply_msg = await log_text.get_reply_message()
            await reply_msg.forward_to(BOTLOG_CHATID)
        elif log_text.pattern_match.group(1):
            user = f"#LOG / Chat ID: {log_text.chat_id}\n\n"
            textx = user + log_text.pattern_match.group(1)
            await bot.send_message(BOTLOG_CHATID, textx)
        else:
            await log_text.edit("`What am I supposed to log?`")
            return
        await eor(log_text, "`Message saved 😁`")
Ejemplo n.º 4
0
    "口",
    "尸",
    "㔿",
    "尺",
    "丂",
    "丅",
    "凵",
    "リ",
    "山",
    "乂",
    "丫",
    "乙",
]


@mlobot.on(admin_cmd(pattern="weeb ?(.*)"))
@mlobot.on(sudo_cmd(pattern="weeb ?(.*)", allow_sudo=True))
async def weebify(event):

    args = event.pattern_match.group(1)
    if not args:
        get = await event.get_reply_message()
        args = get.text
    if not args:
        await eor(event, "`What I am Supposed to Weebify U Dumb Chal hatt`")
        return
    string = "  ".join(args).lower()
    for normiecharacter in string:
        if normiecharacter in normiefont:
            weebycharacter = weebyfont[normiefont.index(normiecharacter)]
            string = string.replace(normiecharacter, weebycharacter)
Ejemplo n.º 5
0
"""Schedule Plugin for @UniBorg
Syntax: .schd <time_in_seconds> ;=; <message to send>"""
import asyncio

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern="schd ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    ttl = 0
    message = "SYNTAX: `.schd <time_in_seconds> = <message to send>`"
    if input_str:
        await event.delete()
        if "=" in input_str:
            ttl, message = input_str.split("=")
        elif event.reply_to_msg_id:
            await event.delete()
            ttl = int(input_str)
            message = await event.get_reply_message()
        await asyncio.sleep(int(ttl))
        await event.respond(message)
    else:
        await event.edit(message)


CMD_HELP.update(
    {"schd": ".schd <time in sec> = <mssg to send>\nUse - Send a scheduled message."}
Ejemplo n.º 6
0
from coffeehouse.lydia import LydiaAI
from telethon import events

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd

# Non-SQL Mode
ACC_LYDIA = {}

if Var.LYDIA_API_KEY:
    api_key = Var.LYDIA_API_KEY
    api_client = API(api_key)
    lydia = LydiaAI(api_client)


@mlobot.on(admin_cmd(pattern="repcf", outgoing=True))
@mlobot.on(sudo_cmd(pattern="repcf", allow_sudo=True))
async def repcf(event):
    if event.fwd_from:
        return
    await eor(event, "Processing...")
    try:
        session = lydia.create_session()
        session.id
        reply = await event.get_reply_message()
        msg = reply.text
        text_rep = session.think_thought(msg)
        await eor(event, "**sun bsdk**: {0}".format(text_rep))
    except Exception as e:
        await eor(event, str(e))
Ejemplo n.º 7
0
""".admin Plugin for @UniBorg"""
from telethon.tl.types import ChannelParticipantsAdmins

from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern="warn1"))
@mlobot.on(sudo_cmd(pattern="warn1", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    mentions = (
        "`You Have  1/3  warnings...\nWatch out!....\nReason for warn: P**n Demand`"
    )
    chat = await event.get_input_chat()
    async for x in borg.iter_participants(chat,
                                          filter=ChannelParticipantsAdmins):
        mentions += f""
    reply_message = None
    if event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        await reply_message.reply(mentions)
    else:
        await event.reply(mentions)
    await event.delete()


""".admin Plugin for @UniBorg"""


@mlobot.on(admin_cmd(pattern="warn2"))
Ejemplo n.º 8
0
import re
import urllib

import requests
from bs4 import BeautifulSoup
from PIL import Image

from mlobot import CMD_HELP, bot
from mlobot.utils import admin_cmd, errors_handler

opener = urllib.request.build_opener()
useragent = "Mozilla/5.0 (Linux; Android 9; SM-G960F Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.157 Mobile Safari/537.36"
opener.addheaders = [("User-agent", useragent)]


@mlobot.on(admin_cmd(outgoing=True, pattern=r"reverse(?: |)(\d*)"))
@mlobot.on(sudo_cmd(allow_sudo=True, pattern=r"reverse(?: |)(\d*)"))
@errors_handler
async def okgoogle(img):
    """ For .reverse command, Google search images and stickers. """
    if os.path.isfile("okgoogle.png"):
        os.remove("okgoogle.png")

    message = await img.get_reply_message()
    if message and message.media:
        photo = io.BytesIO()
        await bot.download_media(message, photo)
    else:
        await eor(img, "`Reply to photo or sticker nigger.`")
        return
Ejemplo n.º 9
0

class SubSubSection(SubSection):
    def __init__(self, *args: String, indent: int = 12) -> None:
        super().__init__(*args, indent=indent)


class TGDoc:
    def __init__(self, *args: Union[String, "Section"]) -> None:
        self.sections = args

    def __str__(self) -> str:
        return "\n\n".join([str(section) for section in self.sections])


@mlobot.on(admin_cmd(pattern=r"u(?:ser)?(\s+[\S\s]+|$)", outgoing=True))
@mlobot.on(sudo_cmd(pattern=r"u(?:ser)?(\s+[\S\s]+|$)", allow_sudo=True))
async def who(event: NewMessage.Event):
    """ For .user command, get info about a user. """
    if event.fwd_from:
        return

    args, user = parse_arguments(
        event.pattern_match.group(1),
        ["id", "forward", "general", "bot", "misc", "all", "mention"],
    )

    args["forward"] = args.get("forward", True)
    args["user"] = user

    replied_user = await get_user_from_event(event, **args)
Ejemplo n.º 10
0
import asyncio

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern="bigoof"))
@mlobot.on(sudo_cmd(pattern="bigoof"))
async def _(event):
    if event.fwd_from:
        return
    animation_interval = 0.1
    animation_ttl = range(0, 36)
    # input_str = event.pattern_match.group(1)
    # if input_str == "nope":
    await eor(
        event,
        "┏━━━┓╋╋╋╋┏━━━┓ \n┃┏━┓┃╋╋╋╋┃┏━┓┃ \n┃┃╋┃┣┓┏┓┏┫┃╋┃┃ \n┃┃╋┃┃┗┛┗┛┃┃╋┃┃ \n┃┗━┛┣┓┏┓┏┫┗━┛┃ \n┗━━━┛┗┛┗┛┗━━━┛",
    )
    animation_chars = [
        "╭━━━╮╱╱╱╭━╮ \n┃╭━╮┃╱╱╱┃╭╯ \n┃┃╱┃┣━━┳╯╰╮ \n┃┃╱┃┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃┃┃ \n╰━━━┻━━╯╰╯ ",
        "╭━━━╮╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃┃┃ \n ╰━━━┻━━┻━━╯╰╯",
        "╭━━━╮╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━╯╰╯",
        "╭━━━╮╱╱╱╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━┻━━╯╰╯",
        "╭━━━╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━┻━━┻━━╯╰╯",
        "╭━━━╮╱╱╱╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━┻━━╯╰╯",
        "╭━━━╮╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━╯╰╯",
    ]

    for i in animation_ttl:
Ejemplo n.º 11
0
# GNU General Public License for more details.
#
"""Remove.BG Plugin for @UniBorg
Syntax: .remove.bg https://link.to/image.extension
Syntax: .remove.bg as reply to a media"""
import io
import os
from datetime import datetime

import requests

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern=r"remove\.bg ?(.*)"))
@mlobot.on(sudo_cmd(pattern=r"remove\.bg ?(.*)", allow_sudo=True))
async def _(event):
    HELP_STR = "`.remove.bg` as reply to a media, or give a link as an argument to this command"
    if event.fwd_from:
        return
    if Config.REM_BG_API_KEY is None:
        await eor(
            event,
            "Get your API key from [here](https://www.remove.bg/) and add in the var `REM_BG_API_KEY` for this plugin to work.",
        )
        return False
    input_str = event.pattern_match.group(1)
    start = datetime.now()
    message_id = event.message.id
    if event.reply_to_msg_id:
Ejemplo n.º 12
0
Available commands:
.ggl - howtogoogle
.duckduckgo - search on duckduckgo
.go - search on google
"""

from re import findall

import requests
from search_engine_parser import GoogleSearch

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(outgoing=True, pattern=r"gs (.*)"))
@mlobot.on(sudo_cmd(allow_sudo=True, pattern=r"gs (.*)"))
async def gsearch(q_event):
    """ For .google command, do a Google search from @Spamreporterr. """
    match = q_event.pattern_match.group(1)
    page = findall(r"page=\d+", match)
    try:
        page = page[0]
        page = page.replace("page=", "")
        match = match.replace("page=" + page[0], "")
    except IndexError:
        page = 1
    search_args = (str(match), int(page))
    gsearch = GoogleSearch()
    gresults = await gsearch.async_search(*search_args)
    msg = ""
Ejemplo n.º 13
0
# This is a troll indeed ffs *facepalm*
import asyncio

from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import ChannelParticipantsAdmins

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern="gbun"))
@mlobot.on(sudo_cmd(pattern="gbun", allow_sudo=True))
async def gbun(event):
    if event.fwd_from:
        return
    gbunVar = event.text
    gbunVar = gbunVar[6:]
    mentions = "`Warning!! User 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By Admin...\n`"
    no_reason = "__Reason: Retarded Dumb af Spammer. __"
    await eor(event, "**Summoning out le Gungnir ❗️⚜️☠️**")
    asyncio.sleep(3.5)
    chat = await event.get_input_chat()
    async for x in borg.iter_participants(chat,
                                          filter=ChannelParticipantsAdmins):
        mentions += f""
    reply_message = None
    if event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        replied_user = await event.client(
            GetFullUserRequest(reply_message.sender_id))
        firstname = replied_user.user.first_name
Ejemplo n.º 14
0
                        snip.media_file_reference,
                    )
                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)


@mlobot.on(admin_cmd(pattern="savefilter (.*)"))
@mlobot.on(sudo_cmd(pattern="savefilter (.*)", allow_sudo=True))
async def on_snip_save(event):
    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)
                snip["type"] = TYPE_DOCUMENT
            if media:
Ejemplo n.º 15
0
# For @UniBorg

# Courtesy @yasirsiddiqui
"""
.bye
"""

import time

from telethon.tl.functions.channels import LeaveChannelRequest

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern="bye", outgoing=True))
async def leave(e):
    x = bot.me
    name = x.first_name
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):

        await e.edit(
            f"`{name} leave the bakwas group 🥱 no mlo found 404:error, bye!!.`"
        )

        time.sleep(3)

        if "-" in str(e.chat_id):

            await borg(LeaveChannelRequest(e.chat_id))
Ejemplo n.º 16
0
#                 c += 1
#         elif d.is_group:
#             g += 1
#         else:
#             logger.info(d.stringify())
#     end = datetime.now()
#     ms = (end - start).seconds
#     await event.edit("""Obtained in {} seconds.
# Users:\t{}
# Groups:\t{}
# Super Groups:\t{}
# Channels:\t{}
# Bots:\t{}""".format(ms, u, g, c, bc, b))


@mlobot.on(admin_cmd(pattern="count"))
async def stats(
    event: NewMessage.Event,
) -> None:  # pylint: disable = R0912, R0914, R0915
    """Command to get stats about the account"""
    await event.edit("`Collecting stats of my king, Wait Master`")
    start_time = time.time()
    private_chats = 0
    bots = 0
    groups = 0
    broadcast_channels = 0
    admin_in_groups = 0
    creator_in_groups = 0
    admin_in_broadcast_channels = 0
    creator_in_channels = 0
    unread_mentions = 0
Ejemplo n.º 17
0
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.b (the "License");
# you may not use this file except in compliance with the License.
#

from asyncio import wait

from mlobot import CMD_HELP
from mlobot.mlobotConfig import Var
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern=r"spam", outgoing=True))
async def spammer(e):
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        message = e.text
        counter = int(message[6:8])
        spam_message = str(e.text[8:])

        await wait([e.respond(spam_message) for i in range(counter)])

        await e.delete()
        if Var.PRIVATE_GROUP_ID:
            await e.client.send_message(
                Var.PRIVATE_GROUP_ID, "#SPAM \n\n"
                "Spam was executed successfully")


CMD_HELP.update(
    {"spam": ".spam <n> <text>\nUse -Spam the word/sentence 'n' times."})
Ejemplo n.º 18
0
"""Invite the user(s) to the current chat
Syntax: .invite <User(s)>"""

from telethon import functions

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern="invite ?(.*)"))
@mlobot.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 eor(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 borg(
                        functions.messages.AddChatUserRequest(
                            chat_id=event.chat_id, user_id=user_id, fwd_limit=1000000
                        )
                    )
                except Exception as e:
                    await event.reply(str(e))
            await eor(event, "Invited Successfully")
Ejemplo n.º 19
0
import asyncio
import io
import time

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern="bash ?(.*)"))
@mlobot.on(sudo_cmd(pattern="bash ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    PROCESS_RUN_TIME = 100
    cmd = event.pattern_match.group(1)
    reply_to_id = event.message.id
    if event.reply_to_msg_id:
        reply_to_id = event.reply_to_msg_id
    time.time() + PROCESS_RUN_TIME
    process = await asyncio.create_subprocess_shell(
        cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
    stdout, stderr = await process.communicate()
    e = stderr.decode()
    if not e:
        e = "No Error"
    o = stdout.decode()
    if not o:
        o = "**Tip**: \n`If you want to see the results of your code, I suggest printing them to stdout.`"
    else:
        _o = o.split("\n")
        o = "`\n".join(_o)
Ejemplo n.º 20
0
""".admin Plugin for @UniBorg"""
from telethon.tl.types import ChannelParticipantsAdmins

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern="join"))
async def _(event):
    if event.fwd_from:
        return
    mentions = "`━━━━━┓ \n┓┓┓┓┓┃\n┓┓┓┓┓┃ ヽ○ノ ⇦ Me When You Joined \n┓┓┓┓┓┃.     /  \n┓┓┓┓┓┃ ノ) \n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃\n┓┓┓┓┓┃`"
    chat = await event.get_input_chat()
    async for x in borg.iter_participants(chat,
                                          filter=ChannelParticipantsAdmins):
        mentions += f""
    reply_message = None
    if event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        await reply_message.reply(mentions)
    else:
        await event.reply(mentions)
    await event.delete()


@mlobot.on(admin_cmd(pattern="pay"))
async def _(event):
    if event.fwd_from:
        return
    mentions = "`█▀▀▀▀▀█░▀▀░░░█░░░░█▀▀▀▀▀█\n█░███░█░█▄░█▀▀░▄▄░█░███░█\n█░▀▀▀░█░▀█▀▀▄▀█▀▀░█░▀▀▀░█\n▀▀▀▀▀▀▀░▀▄▀▄▀▄█▄▀░▀▀▀▀▀▀▀\n█▀█▀▄▄▀░█▄░░░▀▀░▄█░▄▀█▀░▀\n░█▄▀░▄▀▀░░░▄▄▄█░▀▄▄▄▀▄▄▀▄\n░░▀█░▀▀▀▀▀▄█░▄░████ ██▀█▄\n▄▀█░░▄▀█▀█▀░█▄▀░▀█▄██▀░█▄\n░░▀▀▀░▀░█▄▀▀▄▄░▄█▀▀▀█░█▀▀\n█▀▀▀▀▀█░░██▀█░░▄█░▀░█▄░██\n█░███░█░▄▀█▀██▄▄▀▀█▀█▄░▄▄\n█░▀▀▀░█░█░░▀▀▀░█░▀▀▀▀▄█▀░\n▀▀▀▀▀▀▀░▀▀░░▀░▀░░░▀▀░▀▀▀▀`"
    chat = await event.get_input_chat()
Ejemplo n.º 21
0
Syntax: .paste"""
import os
from datetime import datetime

import requests

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


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


@mlobot.on(admin_cmd(pattern="paste ?(.*)"))
@mlobot.on(sudo_cmd(pattern="paste ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    input_str = event.pattern_match.group(1)
    message = "SYNTAX: `.paste <long text to include>`"
    if input_str:
        message = input_str
    elif event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        if previous_message.media:
            downloaded_file_name = await borg.download_media(
Ejemplo n.º 22
0
""" Google Text to Speech
Available Commands:
.tts LanguageCode as reply to a message
.tts LangaugeCode | text to speak"""

import asyncio
import os
import subprocess
from datetime import datetime

from gtts import gTTS

from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern="tts (.*)"))
@mlobot.on(sudo_cmd(pattern="tts (.*)", allow_sudo=True))
async def _(event):

    if event.fwd_from:

        return

    input_str = event.pattern_match.group(1)

    start = datetime.now()

    if event.reply_to_msg_id:

        previous_message = await event.get_reply_message()
Ejemplo n.º 23
0
# plugin by lejend @r4r4n4
"""Emoji

Available Commands:

.lucky"""

import asyncio

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):

    if event.fwd_from:

        return

    animation_interval = 0.5

    animation_ttl = range(0, 17)

    input_str = event.pattern_match.group(1)

    if input_str == "lucky":

        await event.edit(input_str)

        animation_chars = [
Ejemplo n.º 24
0
     "РБ┐РБ┐РБ┐РБ┐РађРађРа╗Ра┐Ра┐Ра┐РБ┐РА┐Ра┐РаЄРађРБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐\n"
     "РБ┐РБ┐РБ┐РБ┐РађРађРБцРБцРБцРБцРБЙРАЄРађРађРађРБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐\n"
     "РБ┐РБ┐РБ┐РБ┐РађРађРбЅРБЕРБГРБГРБГРАёРађРађРађРБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐\n"
     "РБ┐РБ┐РБ┐РБ┐РађРађРБ┐РАЪРаІРаЅРаІРаЂРађРађРађРБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐\n"
     "РБ┐РБ┐РБ┐РБ┐РађРађРБЙРБ┐РБХРБХРБХРАєРађРађРађРБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐\n"
     "РБ┐РБ┐РБ┐РБ┐РађРађРБХРБХРБХРБХРБХРБХРБХРАєРађРБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐\n"
     "РБ┐РБ┐РБ┐РБ┐РађРађРБЙРБЈРађРађРБ╣РАЄРађРађРађРБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐\n"
     "РБ┐РБ┐РБ┐РБ┐РађРађРаўРа┐Ра┐Ра┐РаЪРаЃРађРађРађРб╣РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐\n"
     "РБ┐РБ┐РБ┐РБ┐РБХРБХРБХРБХРБХРБХРБХРБХРБХРБХРБХРБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐\n"
     "РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐\n")

n = str(
    ALIVE_NAME) if ALIVE_NAME else "Set ALIVE_NAME in config vars in Heroku"


@mlobot.on(admin_cmd(pattern="sthink (.*)"))
async def kakashi(think):
    name = think.pattern_match.group(1)
    A = (f"**  РъЦ {name} .\n\n**"
         "РађРађРађРађРбђРБђРБђРБђ\n"
         "РађРађРађРа░РА┐Ра┐РаЏРаЏРа╗Ра┐РБи\n"
         "РађРађРађРађРађРађРБђРБёРАђРађРађРађРађРбђРБђРБђРБцРБёРБђРАђ\n"
         "РађРађРађРађРађРбИРБ┐РБ┐РБиРађРађРађРађРаЏРаЏРБ┐РБ┐РБ┐РАЏРа┐Раи\n"
         "РађРађРађРађРађРаўРа┐Ра┐РаІРађРађРађРађРађРађРБ┐РБ┐РБ┐РаЄ\n"
         "РађРађРађРађРађРађРађРађРађРађРађРађРађРађРађРаѕРаЅРаЂ\n"
         "Рађ\n"
         "РађРађРађРађРБ┐РБиРБёРађРбХРБХРБиРБХРБХРБцРБђ\n"
         "РађРађРађРађРБ┐РБ┐РБ┐РађРађРађРађРађРаѕРаЎРа╗РаЌ\n"
         "РађРађРађРБ░РБ┐РБ┐РБ┐РађРађРађРађРбђРБђРБаРБцРБ┤РБХРАё\n"
         "РађРБаРБЙРБ┐РБ┐РБ┐РБЦРБХРБХРБ┐РБ┐РБ┐РБ┐РБ┐Ра┐Ра┐РаЏРаЃ\n"
         "Рб░РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РБ┐РАё\n"
Ejemplo n.º 25
0
"""
For Mlobot, credits to @pureindialover
"""

from telethon.tl import functions

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(outgoing=True, pattern="create (b|g|c)(?: |$)(.*)"))
async def telegraphs(grop):
    """ For .create command, Creating New Group & Channel """

    if not grop.text[0].isalpha() and grop.text[0] not in ("/", "#", "@", "!"):

        if grop.fwd_from:

            return

        type_of_group = grop.pattern_match.group(1)

        group_name = grop.pattern_match.group(2)

        if type_of_group == "b":

            try:

                result = await grop.client(
                    functions.messages.CreateChatRequest(  # pylint:disable=E0602
                        users=["@Serena_Robot"],
Ejemplo n.º 26
0
import asyncio

from mlobot import CMD_HELP
from mlobot.plugins.sql_helper.mute_sql import is_muted, mute, unmute
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(outgoing=True, pattern=r"gmute ?(\d+)?"))
@mlobot.on(sudo_cmd(allow_sudo=True, pattern=r"gmute ?(\d+)?"))
async def startgmute(event):
    private = False
    if event.fwd_from:
        return
    elif event.is_private:
        await eor(event, "Unexpected issues or ugly errors may occur!")
        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:
        return await eor(
            event, "Please reply to a user or add their into the command to gmute them."
        )
    event.chat_id
    await event.get_chat()
    if is_muted(userid, "gmute"):
Ejemplo n.º 27
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)
# ================================================

BOTLOG_CHATID = Var.PRIVATE_GROUP_ID


@mlobot.on(admin_cmd(outgoing=True, pattern="setgpic"))
@mlobot.on(sudo_cmd(outgoing=True, pattern="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.eor(event, "`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:
        x = await gpic.eor(x, NO_ADMIN)
Ejemplo n.º 28
0
# Using this might lead to ban of your account, use at your own risk.
# Re-Written by @mbbs_lover

import asyncio
import time

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

from mlobot import CMD_HELP
from mlobot.utils import admin_cmd

DEL_TIME_OUT = 60


@mlobot.on(admin_cmd(pattern="autobio"))  # pylint:disable=E0602
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} | This is my bio, I guess.. 😁 | ⌚️ {HM}"
        logger.info(bio)
        try:
            await borg(
                functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                    about=bio))
        except FloodWaitError as ex:
            logger.warning(str(e))
            await asyncio.sleep(ex.seconds)
Ejemplo n.º 29
0
"""Restart or Terminate the bot from any chat
Available Commands:
.restart
.shutdown"""
# This Source Code Form is subject to the terms of the GNU
# General Public License, v.3.0. If a copy of the GPL was not distributed with this
# file, You can obtain one at https://www.gnu.org/licenses/gpl-3.0.en.html
import os
import sys

from mlobot import CMD_HELP, CMD_HNDLR
from mlobot.utils import admin_cmd


@mlobot.on(admin_cmd(pattern="restart"))
async def _(event):
    if event.fwd_from:
        return
    # await asyncio.sleep(2)
    # await event.edit("Restarting \n□□□□□□□□□□")
    # await asyncio.sleep(2)
    # await event.edit(f"Restarting \n■■■■□□□□□□  ")
    # await asyncio.sleep(2)
    # await event.edit(f"Restarting \n■■■■■■■■□□   ")
    # await asyncio.sleep(2)
    # await event.edit(f"Done! \n■■■■■■■■■■  ")
    # await asyncio.sleep(2)
    await event.edit(
        f"__MloBot is Restarting...__\nPlease give it **a minute or two** and then use `{CMD_HNDLR}alive`! "
    )
    await borg.disconnect()
Ejemplo n.º 30
0
# For Mlobot

from mlobot import ALIVE_NAME
from mlobot.utils import admin_cmd

n = str(
    ALIVE_NAME) if ALIVE_NAME else "Set ALIVE_NAME in config vars in Heroku"

# @command(outgoing=True, pattern="^.ded$")


@mlobot.on(admin_cmd(pattern=r"ded"))
@mlobot.on(sudo_cmd(pattern=r"ded"))
async def bluedevilded(ded):
    await eor(
        ded,
        n + " ==             |\n     |"
        "\n     | \n"
        "     | \n"
        "     | \n"
        "     | \n"
        "     | \n"
        "     | \n"
        "     | \n"
        " / ̄ ̄\| \n"
        "< ´・    |\ \n"
        " | 3  | 丶\ \n"
        "< 、・  |  \ \n"
        " \__/∪ _ ∪) \n"
        "      U U\n",
    )