Exemple #1
0
import array

from mayuri import AddHandler, Command, admin
from pyrogram import filters


@admin
async def zombies(client, message):
    chat_id = message.chat.id
    msg = await message.reply_text("Mencari akun terhapus...")
    count = 0
    users = []
    chat_members = client.iter_chat_members(chat_id)
    async for member in chat_members:
        if member.user.is_deleted:
            count = count + 1
            users.append(member.user.id)

    if count == 0:
        await msg.edit("Grup bersih. tidak ada akun terhapus :)")
        return
    else:
        await msg.edit(
            "Ditemukan {} akun terhapus.\nMembersihan...".format(count))
        for user in users:
            await client.kick_chat_member(chat_id, user)
        await msg.edit("Berhasil membersihkan {} akun terhapus".format(count))


AddHandler(zombies, filters.group & filters.command("zombies", Command))
Exemple #2
0
__MODULE__ = "Admin List"
__HELP__ = """
Module ini digunakan untuk menampilkan list admin di dalam grup.
[Admin List]
> `/adminlist`
"""


@disableable
async def adminlist(client, message):
    chat_id = message.chat.id
    bot_id = (await client.get_me()).id
    all = client.iter_chat_members(chat_id, filter="administrators")
    text = "**Daftar Admin di Grup Ini**\n"
    async for admin in all:
        if admin.status == "creator":
            text = text + "Creator : \n • " + admin.user.mention

    all = client.iter_chat_members(chat_id, filter="administrators")
    text = text + "\n\nAdmin : "
    async for a in all:
        if (a.status == "administrator"
                and not a.user.is_bot) or (a.user.is_bot
                                           and a.user.id == bot_id):
            text = text + "\n • " + a.user.mention

    await message.reply_text(text)


AddHandler(adminlist, filters.group & filters.command("adminlist", Command))
Exemple #3
0
from mayuri import AddHandler
from mayuri.modules.anti_ubot import bl_ubot
from mayuri.modules.blacklist import bl
from mayuri.modules.filters import filtr
from mayuri.modules.globals import addchat, check_gban, check_gmute
from pyrogram import filters


async def last(client, message):
    await addchat(client, message)
    await bl_ubot(client, message)
    await check_gban(client, message)
    await check_gmute(client, message)
    await filtr(client, message)
    await bl(client, message)


AddHandler(last, filters.text & filters.group)
Exemple #4
0
from mayuri import AddHandler
from mayuri.modules.disableable import disableable
from pyrogram import filters

__MODULE__ = "Sed"
__HELP__ = """
Modul ini digunakan untuk mengubah kata dalam suatu pesan
[Sed]
> `s/<kata asli>/<kata ganti>`
contoh :
> `s/anu/nganu`
Mengubah semua kata 'anu' menjadi 'nganu' didalam pesan yang dibalas
"""


@disableable
async def sed(client, message):
    text = (message.text).split('/')
    old_word = text[1]
    new_word = text[2]
    old_text = message.reply_to_message.text
    new_text = old_text.replace(old_word, new_word)
    await message.reply_to_message.reply_text(new_text)


AddHandler(sed, filters.reply & filters.regex('^s/(.*?)'))
Exemple #5
0
                                                     fullname=fullname,
                                                     user_id=user_id,
                                                     user_name=user_name,
                                                     mention=mention),
                                         reply_markup=button)
            elif filt.filter_type == 3:
                await message.reply_sticker(filt.document)
            elif filt.filter_type == 4:
                if filt.document_type == 1:
                    await message.reply_audio(audio=filt.document,
                                              caption=text,
                                              reply_markup=button)
                elif filt.document_type == 2:
                    await message.reply_document(document=filt.document,
                                                 caption=text,
                                                 reply_markup=button)
                elif filt.document_type == 3:
                    await message.reply_photo(photo=filt.document,
                                              caption=text,
                                              reply_markup=button)
                elif filt.document_type == 3:
                    await message.reply_video(video=filt.document,
                                              caption=text,
                                              reply_markup=button)
            break


AddHandler(addfilter, filters.command("filter", Command) & filters.group)
AddHandler(rm_filter, filters.command("stop", Command) & filters.group)
AddHandler(filters_list, filters.command("filters", Command) & filters.group)
Exemple #6
0
            await client.unban_chat_member(chat_id, user_id)
            await message.reply_sticker("https://t.me/CactusID_OOT/116113")
            await message.reply_text(
                "Ditendang! 😝\nUser : {}\nAlasan : Mengatakan <code>{}</code>".
                format(mention, trigger),
                disable_web_page_preview=True)
            #await client.send_message(log_id,"#BLACKLIST_KICK\n{}\nUser : {}\nAlasan : Mengatakan <code>{}</code>".format(chat_title,mention,trigger))
        elif mode == 4:
            await message.delete()
            await client.kick_chat_member(chat_id, user_id, time)
            await message.reply_sticker("https://t.me/CactusID_OOT/116113")
            await message.reply_text(
                "Terbanned untuk {}! 😝\nUser : {}\nAlasan : Mengatakan <code>{}</code>"
                .format(time_raw, mention, trigger),
                disable_web_page_preview=True)
            #await client.send_message(log_id,"#BLACKLIST_TBAN\n{}\nUser : {}\nDurasi : {}\nAlasan : Mengatakan <code>{}</code>".format(chat_title,mention,time_raw,trigger))
        elif mode == 5:
            await message.delete()
            await client.kick_chat_member(chat_id, user_id)
            await message.reply_sticker("https://t.me/CactusID_OOT/116113")
            await message.reply_text(
                "Terbanned! 😝\nUser : {}\nAlasan : Mengatakan <code>{}</code>".
                format(mention, trigger),
                disable_web_page_preview=True)
            #await client.send_message(log_id,"#BLACKLIST_BAN\n{}\nUser : {}\nAlasan : Mengatakan <code>{}</code>".format(chat_title,mention,trigger))


AddHandler(addbl, filters.command("addbl", Command) & filters.group)
AddHandler(rm_bl, filters.command("rmbl", Command) & filters.group)
AddHandler(blacklist, filters.command("blacklist", Command) & filters.group)
Exemple #7
0
    list_disabled = sql.get_disabled(chat_id)
    if list_disabled:
        text = "Daftar Perintah yang didisable di grup ini:"
        for disabled in list_disabled:
            text = text + "\n - {}".format(disabled.command)

        await message.reply_text(text)
    else:
        await message.reply_text(
            "Tidak ada Perintah yang didisable di grup ini!")


async def disableable_list(client, message):
    if message.chat.type == 'group' or message.chat.type == 'supergroup':
        chat_id = message.chat.id
        admin_list = await adminlist(client, chat_id)
        if message.from_user.id not in admin_list:
            return

    DisableAbleLs.sort()
    text = "Daftar Perintah yang dapat didisable:"
    for disableable in DisableAbleLs:
        text = text + "\n - {}".format(disableable)

    await message.reply_text(text)


AddHandler(disablehandler, filters.group & filters.command("disable", Command))
AddHandler(enablehandler, filters.group & filters.command("enable", Command))
AddHandler(disabled_list, filters.group & filters.command("disabled", Command))
AddHandler(disableable_list, filters.command("disableable", Command))
Exemple #8
0

help_button_create = filters.create(help_button_callback)


@bot.on_callback_query(help_button_create)
async def help_button(_client, query):
    mod_match = re.match(r"help_module\((.+?)\)", query.data)
    back_match = re.match(r"help_back", query.data)
    if mod_match:
        module = mod_match.group(1)
        text = "Ini adalah bantuan untuk modul **{}**:\n".format(HELP_COMMANDS[module].__MODULE__) \
            + HELP_COMMANDS[module].__HELP__

        await query.message.edit(text=text,
                                 parse_mode='markdown',
                                 reply_markup=InlineKeyboardMarkup([[
                                     InlineKeyboardButton(
                                         text="Back",
                                         callback_data="help_back")
                                 ]]))

    elif back_match:
        await query.message.edit(text=HELP_STRINGS,
                                 reply_markup=InlineKeyboardMarkup(
                                     paginate_modules(0, HELP_COMMANDS,
                                                      "help")))


AddHandler(help_command, filters.command("help", Command))
Exemple #9
0
            return

    SUDO.append(user_id)
    sql.add_to_sudo(user_id)
    text = "User {} telah ditambahkan ke SUDO".format(mention)
    await message.reply_text(text)


async def rm_sudo(client, message):
    chat_id = message.chat.id
    if message.reply_to_message:
        user_id = message.reply_to_message.from_user.id
        mention = message.reply_to_message.from_user.mention
    else:
        args = message.text.split(None, 2)
        try:
            user = await client.get_users(args[1])
            user_id = user.id
            mention = user.mention
        except RPCError:
            await message.reply_text("Itu bukan user!")
            return

    sql.rm_from_sudo(user_id)
    text = "User {} telah di hapus dari SUDO".format(mention)
    await message.reply_text(text)


AddHandler(add_sudo, filters.user(OWNER) & filters.command("addsudo", Command))
AddHandler(rm_sudo, filters.user(OWNER) & filters.command("rmsudo", Command))
Exemple #10
0
				#await client.send_message(log_id,"#UBOT_MUTE\n{}\nUser : {}\nAlasan : Mengatakan {}{}".format(chat_title,mention,first,command))
			elif check.mode == 2:
				await message.delete()
				await client.kick_chat_member(chat_id,user_id)
				await client.unban_chat_member(chat_id,user_id)
				await message.reply_sticker("https://t.me/CactusID_OOT/116113")
				await message.reply_text("Ditendang! 😝\nUser : {}\nAlasan : Mengatakan {}{}".format(mention,first,command))
				#await client.send_message(log_id,"#UBOT_TENDANG\n{}\nUser : {}\nAlasan : Mengatakan {}{}".format(chat_title,mention,first,command))
			elif check.mode == 3:
				await message.delete()
				await client.kick_chat_member(chat_id,user_id)
				await message.reply_sticker("https://t.me/CactusID_OOT/116113")
				await message.reply_text("Terbanned! 😝\nUser : {}\nAlasan : Mengatakan {}{}".format(mention,first,command))
				#await client.send_message(log_id,"#UBOT_BAN\n{}\nUser : {}\nAlasan : Mengatakan {}{}".format(chat_title,mention,first,command))
			elif check.mode == 4:
				await message.delete()
				await client.restrict_chat_member(chat_id, user_id, ChatPermissions(), time)
				await message.reply_text("Dibisukan untuk {}\nUser : {}\nAlasan : Mengatakan {}{}".format(time_raw,mention,first,command))
				#await client.send_message(log_id,"#UBOT_TMUTE\n{}\nUser : {}\nDurasi : {}\nAlasan : Mengatakan {}{}".format(chat_title,mention,time_raw,first,command))
			elif check.mode == 5:
				await message.delete()
				await client.kick_chat_member(chat_id,user_id, time)
				await message.reply_sticker("https://t.me/CactusID_OOT/116113")
				await message.reply_text("Terbanned untuk {}! 😝\nUser : {}\nAlasan : Mengatakan {}{}".format(time_raw,mention,first,command))
				#await client.send_message(log_id,"#UBOT_TBAN\n{}\nUser : {}\nDurasi : {}\nAlasan : Mengatakan {}{}".format(chat_title,mention,time_raw,first,command))


AddHandler(addblubot,filters.command("addblubot", Command) & filters.group)
AddHandler(rm_blubot,filters.command("rmblubot", Command) & filters.group)
AddHandler(blubot,filters.command("blubot", Command) & filters.group)
Exemple #11
0
    except TelegramError as e:
        print(e)
        if e.message == "Sticker set name is already occupied":
            await msg.edit(
                "Your pack can be found [here](t.me/addstickers/%s)" % packname
            )
        elif e.message == "Peer_id_invalid":
            await msg.edit("Contact me in PM first.",
                           reply_markup=InlineKeyboardMarkup([[
                               InlineKeyboardButton(text="Start",
                                                    url=f"t.me/{bot_username}")
                           ]]))
        elif e.message == "Internal Server Error: created sticker set not found (500)":
            await msg.edit(
                "Sticker pack successfully created. Get it [here](t.me/addstickers/%s)"
                % packname)
        return

    if success:
        await msg.edit(
            "Sticker pack successfully created. Get it [here](t.me/addstickers/%s)"
            % packname)
    else:
        await msg.edit(
            "Failed to create sticker pack. Possibly due to blek mejik.")


AddHandler(stickerid, filters.command("stickerid", Command))
AddHandler(getsticker, filters.command("getsticker", Command))
AddHandler(kang, filters.command("kang", Command))
Exemple #12
0
import sys
from mayuri import Command, OWNER, AddHandler
from mayuri.modules.sudo import sudo
from pyrogram import filters, __version__

__MODULE__ = "Alive"
__HELP__ = """
Module ini digunakan untuk menampilkan status bot.
[Alive]
> `/alive`
> `/on`
"""


@sudo
async def alive(client, message):
    alive_text = "Bot services is running...\n----------------------------------\n•  ⚙️ Pyrogram    : v{}\n•  🐍 Python         : v{}\n----------------------------------".format(
        __version__,
        sys.version.split(' ')[0])
    await message.reply_text(alive_text)


AddHandler(
    alive,
    (filters.command("alive", Command) | filters.command("on", Command)))
Exemple #13
0
            await client.send_chat_action(chat_id=message.chat.id,
                                          action="upload_video")
            await message.reply_video(video=file, caption=text)
        except:
            await message.reply_text(
                "`Tidak bisa mengirim preview.`\n{}".format(text))
        os.remove(file_path)
        os.remove("preview.mp4")
    else:
        await message.reply_text("Anda harus membalas pesan gambar/gif/video")


def memory_file(name=None, contents=None, *, bytes=True):
    if isinstance(contents, str) and bytes:
        contents = contents.encode()
    file = BytesIO() if bytes else StringIO()
    if name:
        file.name = name
    if contents:
        file.write(contents)
        file.seek(0)
    return file


AddHandler(sanime, filters.command("sanime", Command))
AddHandler(airing, filters.command("airing", Command))
AddHandler(anime, filters.command("anime", Command))
AddHandler(character, filters.command("character", Command))
AddHandler(manga, filters.command("manga", Command))
AddHandler(whatanime, filters.command("whatanime", Command))
Exemple #14
0

async def check_gmute(client, message):
    user_id = message.from_user.id
    if user_id in SUDO or user_id in OWNER:
        return
    mention = message.from_user.mention
    chat_id = message.chat.id
    check = sql.check_gmute(user_id)
    admin_list = []
    all = client.iter_chat_members(chat_id, filter="administrators")
    admin_list = []
    async for admin in all:
        admin_list.append(admin.user.id)
    if user_id in admin_list:
        return
    if check:
        text = "User {} ada daftar global mute dan telah di bisukan!".format(
            mention)
        if check.reason:
            text += "\nAlasan : {}".format(reason)
        await client.restrict_chat_member(chat.chat_id, user_id,
                                          ChatPermissions())
        await client.send_message(chat_id, text)


AddHandler(gban, filters.group & filters.command("gban", Command))
AddHandler(ungban, filters.group & filters.command("ungban", Command))
AddHandler(gmute, filters.group & filters.command("gmute", Command))
AddHandler(ungmute, filters.group & filters.command("ungmute", Command))