예제 #1
0
import numpy as np
from colour import Color
from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
from PIL import Image, ImageDraw, ImageFont, ImageOps
from telethon.tl.types import DocumentAttributeFilename

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
from userbot.events import man_cmd

bground = "black"


@bot.on(man_cmd(outgoing=True, pattern=r"(ascii|asciis)$"))
async def ascii(event):
    if not event.reply_to_msg_id:
        await event.edit("`Reply to Any media..`")
        return
    reply_message = await event.get_reply_message()
    if not reply_message.media:
        await event.edit("`reply to a image/sticker/video`")
        return
    await event.edit("`Downloading Media..`")
    if reply_message.photo:
        IMG = await bot.download_media(
            reply_message,
            "ascii.png",
        )
    elif (DocumentAttributeFilename(file_name="AnimatedSticker.tgs")
예제 #2
0
from urllib.parse import unquote_plus

from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
from natsort import os_sorted
from pySmartDL import SmartDL
from telethon.tl.types import DocumentAttributeAudio, DocumentAttributeVideo

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, LOGS, TEMP_DOWNLOAD_DIRECTORY, bot
from userbot.events import man_cmd
from userbot.utils import humanbytes, progress, run_cmd
from userbot.utils.FastTelethon import download_file, upload_file


@bot.on(man_cmd(pattern=r"download(?: |$)(.*)", outgoing=True))
async def download(target_file):
    """For .download command, download files to the userbot's server."""
    await target_file.edit("`Processing...`")
    input_str = target_file.pattern_match.group(1)
    replied = await target_file.get_reply_message()
    if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
        os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
    if input_str:
        url = input_str
        file_name = unquote_plus(os.path.basename(url))
        if "|" in input_str:
            url, file_name = input_str.split("|")
            url = url.strip()
            # https://stackoverflow.com/a/761825/4723940
            file_name = file_name.strip()
예제 #3
0
from userbot import CMD_HELP
from userbot import S_PACK_NAME as custompack
from userbot import bot
from userbot.events import man_cmd
from userbot.utils import edit_or_reply

KANGING_STR = [
    "Colong Sticker dulu yee kan",
    "Ini Sticker aku colong yaa DUARR!",
    "Waw Stickernya Bagus Nih...Colong Dulu Yekan..",
    "ehh, keren nih... gua colong ya stickernya...",
    "Boleh juga ni Sticker Colong ahh~",
]


@bot.on(man_cmd(outgoing=True, pattern=r"(?:tikel|kang)\s?(.)?"))
async def kang(args):
    user = await bot.get_me()
    if not user.username:
        user.username = user.first_name
    message = await args.get_reply_message()
    photo = None
    emojibypass = False
    is_anim = False
    emoji = None

    if not message or not message.media:
        return await args.edit("`Maaf , Saya Gagal Mengambil Sticker Ini!`")

    if isinstance(message.media, MessageMediaPhoto):
        await args.edit(f"`{random.choice(KANGING_STR)}`")
예제 #4
0
    f"**{ALIVE_NAME} Sedang OFF Tunggulah Sampai Online**",
    f"**Maaf {ALIVE_NAME} Sedang OFF!**",
]

global USER_AFK  # pylint:disable=E0602
global afk_time  # pylint:disable=E0602
global afk_start
global afk_end
USER_AFK = {}
afk_time = None
afk_start = {}

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


@bot.on(man_cmd(outgoing=True, pattern=r"off(?: |$)(.*)"))
async def set_afk(afk_e):
    """For .afk command, allows you to inform people that you are afk when they message you"""
    message = afk_e.text  # pylint:disable=E0602
    string = afk_e.pattern_match.group(1)
    global ISAFK
    global AFKREASON
    global USER_AFK  # pylint:disable=E0602
    global afk_time  # pylint:disable=E0602
    global afk_start
    global afk_end
    user = await bot.get_me()  # pylint:disable=E0602
    global reason
    USER_AFK = {}
    afk_time = None
    afk_end = {}
예제 #5
0
import asyncio
import io
import sys
import traceback
from os import remove
from pprint import pprint

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
from userbot.events import man_cmd

p, pp = print, pprint


@bot.on(man_cmd(outgoing=True, pattern=r"eval(?:\s|$)([\s\S]*)"))
async def _(event):
    expression = event.pattern_match.group(1)
    if not expression:
        return await event.edit("**Berikan Code untuk di eksekusi.**")

    if expression in ("userbot.session", "config.env"):
        return await event.edit(
            "**Itu operasi yang berbahaya! Tidak diperbolehkan!**")

    cmd = "".join(event.message.message.split(maxsplit=1)[1:])
    if not cmd:
        return event.edit("**Apa yang harus saya jalankan?**")
    cmd = (cmd.replace("sendmessage", "send_message").replace(
        "sendfile", "send_file").replace("editmessage", "edit_message"))
    xx = await event.edit("`Processing...`")
예제 #6
0
from telethon.utils import pack_bot_file_id

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, LOGS, bot
from userbot.events import man_cmd
from userbot.utils import edit_delete, edit_or_reply
from userbot.utils.logger import logging

LOGS = logging.getLogger(__name__)


@bot.on(man_cmd(outgoing=True, pattern=r"^\.(get_id|id)(?:\s|$)([\s\S]*)"))
async def _(event):
    "To get id of the group or user."
    input_str = event.pattern_match.group(2)
    if input_str:
        try:
            p = await event.client.get_entity(input_str)
        except Exception as e:
            return await edit_delete(event, f"`{e}`", 5)
        try:
            if p.first_name:
                return await edit_or_reply(
                    event, f"**User ID {input_str} adalah** `{p.id}`")
        except Exception:
            try:
                if p.title:
                    return await edit_or_reply(
                        event, f"**ID {p.title} adalah** `{p.id}`")
            except Exception as e:
                LOGS.info(str(e))
예제 #7
0
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
#
# Ported by @mrismanaziz
# @SharingUserbot

import asyncio

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
from userbot.events import man_cmd


@bot.on(man_cmd(outgoing=True, pattern=r"ftyping(?: |$)(.*)"))
async def _(event):
    t = event.pattern_match.group(1)
    if not (t or t.isdigit()):
        t = 100
    else:
        try:
            t = int(t)
        except BaseException:
            try:
                t = await event.ban_time(t)
            except BaseException:
                return await event.edit("`Masukan jumlah detik yang benar`")
    await event.edit(f"**Memulai Pengetikan Palsu Selama** `{t}` **detik.**")
    await asyncio.sleep(3)
    await event.delete()
예제 #8
0
    send_inline=None,
    embed_links=None,
)
logging.basicConfig(
    format="[%(levelname)s- %(asctime)s]- %(name)s- %(message)s",
    level=logging.INFO,
    datefmt="%H:%M:%S",
)

LOGS = logging.getLogger(__name__)
MUTE_RIGHTS = ChatBannedRights(until_date=None, send_messages=True)
UNMUTE_RIGHTS = ChatBannedRights(until_date=None, send_messages=False)
# ================================================


@bot.on(man_cmd(outgoing=True, pattern="setgpic( -s| -d)$"))
async def set_group_photo(event):
    "For changing Group dp"
    flag = (event.pattern_match.group(1)).strip()
    if flag == "-s":
        replymsg = await event.get_reply_message()
        photo = None
        if replymsg and replymsg.media:
            if isinstance(replymsg.media, MessageMediaPhoto):
                photo = await event.client.download_media(message=replymsg.photo)
            elif "image" in replymsg.media.document.mime_type.split("/"):
                photo = await event.client.download_file(replymsg.media.document)
            else:
                return await edit_delete(event, INVALID_MEDIA)
        if photo:
            try:
예제 #9
0
from bs4 import BeautifulSoup
from PIL import Image

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
from userbot.events import man_cmd
from userbot.utils import googleimagesdownload

opener = urllib.request.build_opener()
useragent = ("Mozilla/5.0 (Linux; Android 10; SM-G975F) "
             "AppleWebKit/537.36 (KHTML, like Gecko) "
             "Chrome/80.0.3987.149 Mobile Safari/537.36")
opener.addheaders = [("User-agent", useragent)]


@bot.on(man_cmd(outgoing=True, pattern=r"reverse(?: |$)(\d*)"))
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 not message or not message.media:
        return await img.edit("`Reply foto atau stiker.`")

    photo = io.BytesIO()
    await bot.download_media(message, photo)
    if not photo:
        return await img.edit("`Gagal mendownload gambar.`")
예제 #10
0
# ====================
async def get_tz(con):
    """Get time zone of the given country."""
    """ Credits: @aragon12 and @zakaryan2004. """
    for c_code in c_n:
        if con == c_n[c_code]:
            return tz(c_tz[c_code][0])
    try:
        if c_n[con]:
            return tz(c_tz[con][0])
    except KeyError:
        return


@bot.on(man_cmd(outgoing=True, pattern=r"weather(?: |$)(.*)"))
async def get_weather(weather):
    """For .weather command, gets the current weather of a city."""

    if not OWM_API:
        return await weather.edit(
            "**Get an API key from** https://openweathermap.org **first.**")

    APPID = OWM_API

    anonymous = False

    if not weather.pattern_match.group(1):
        CITY = DEFCITY
    elif weather.pattern_match.group(1).lower() == "anon":
        CITY = DEFCITY
예제 #11
0
        if isinstance(entity, types.MessageEntityBold):
            bold[entity.offset] = entity.offset + entity.length
        elif isinstance(entity, types.MessageEntityItalic):
            italic[entity.offset] = entity.offset + entity.length
        elif isinstance(entity, types.MessageEntityCode):
            mono[entity.offset] = entity.offset + entity.length
        elif isinstance(entity, types.MessageEntityUrl):
            link[entity.offset] = entity.offset + entity.length
        elif isinstance(entity, types.MessageEntityTextUrl):
            link[entity.offset] = entity.offset + entity.length
        elif isinstance(entity, types.MessageEntityMention):
            link[entity.offset] = entity.offset + entity.length
    return bold, mono, italic, link


@bot.on(man_cmd(outgoing=True, pattern=r"stats$"))
async def stats(event):
    stat = await edit_or_reply(event, STAT_INDICATION)
    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
    unread = 0
    dialog: Dialog
    async for dialog in event.client.iter_dialogs():
예제 #12
0
                          MessageEntityMentionName):
                user_id = probable_user_mention_entity.user_id
                user_obj = await event.client.get_entity(user_id)
                return user_obj, extra
        try:
            user_obj = await event.client.get_entity(user)
        except (TypeError, ValueError):
            await edit_delete(
                uevent,
                "**Tidak dapat mengambil user untuk diproses lebih lanjut**",
                5)
            return None, None
    return user_obj, extra


@bot.on(man_cmd(outgoing=True, pattern=r"gban(?: |$)(.*)"))
@register(incoming=True, from_users=DEVS, pattern=r"^\.cgban(?: |$)(.*)")
async def gban(event):
    if event.fwd_from:
        return
    gbun = await edit_or_reply(event, "`Gbanning...`")
    start = datetime.now()
    user, reason = await get_user_from_event(event, gbun)
    if not user:
        return
    if user.id == (await event.client.get_me()).id:
        await gbun.edit("**Ngapain NgeGban diri sendiri Goblok 🐽**")
        return
    if user.id in DEVS:
        await gbun.edit("**Gagal GBAN karena dia adalah Pembuat saya 🗿**")
        return
예제 #13
0
                ):
                    try:
                        approve(event.chat_id)
                    except IntegrityError:
                        return

                if is_approved(event.chat_id) and BOTLOG_CHATID:
                    await event.client.send_message(
                        BOTLOG_CHATID,
                        "**#AUTO_APPROVED**\n"
                        + "👤 **User:** "
                        + f"[{chat.first_name}](tg://user?id={chat.id})",
                    )


@bot.on(man_cmd(outgoing=True, pattern=r"notifoff$"))
async def notifoff(noff_event):
    try:
        from userbot.modules.sql_helper.globals import addgvar
    except AttributeError:
        return await noff_event.edit("`Running on Non-SQL mode!`")
    addgvar("NOTIF_OFF", True)
    await noff_event.edit(
        "**Notifikasi Pesan Pribadi Tidak Disetujui, Telah Dibisukan!**"
    )


@bot.on(man_cmd(outgoing=True, pattern=r"notifon$"))
async def notifon(non_event):
    try:
        from userbot.modules.sql_helper.globals import delgvar
예제 #14
0
import os
from asyncio import sleep

from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.messages import ExportChatInviteRequest
from telethon.tl.types import ChannelParticipantsKicked

from userbot import ALIVE_NAME
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
from userbot.events import man_cmd
from userbot.utils import edit_delete, edit_or_reply


@bot.on(man_cmd(outgoing=True, pattern=r"open(?: |$)(.*)"))
async def _(event):
    b = await event.client.download_media(await event.get_reply_message())
    with open(b, "r") as a:
        c = a.read()
    a = await event.edit("**Berhasil Membaca Berkas**")
    if len(c) > 4095:
        await a.edit("**File Terlalu Panjang Untuk dibaca**")
    else:
        await event.client.send_message(event.chat_id, f"`{c}`")
        await a.delete()
    os.remove(b)


@bot.on(man_cmd(outgoing=True, pattern=r"sendbot (.*)"))
async def _(event):
예제 #15
0
# @mrismanaziz
# t.me/sharinguserbot

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
from userbot.events import man_cmd


@bot.on(man_cmd(outgoing=True, pattern=r"frog(?: |$)(.*)"))
async def typewriter(typew):
    typew.pattern_match.group(1)
    await typew.edit("⠄⠄⠄⠄⠄⣀⣀⣤⣶⣿⣿⣶⣶⣶⣤⣄⣠⣴⣶⣿⣶⣦⣄⠄\n"
                     "⠄⣠⣴⣾⣿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦\n"
                     "⢠⠾⣋⣭⣄⡀⠄⠙⠻⣿⣿⡿⠛⠋⠉⠉⠉⠙⠛⠿⣿⣿⣿⣿\n"
                     "⡎⡟⢻⣿⣷⠄⠄⠄⠄⡼⣡⣾⣿⣿⣦⠄⠄⠄⠄⠄⠈⠛⢿⣿\n"
                     "⡇⣷⣾⣿⠟⠄⠄⠄⢰⠁⣿⣇⣸⣿⣿⠄⠄⠄⠄⠄⠄⠄⣠⣼\n"
                     "⣦⣭⣭⣄⣤⣤⣴⣶⣿⣧⡘⠻⠛⠛⠁⠄⠄⠄⠄⣀⣴⣿⣿⣿\n"
                     "⢉⣹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣦⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿\n"
                     "⡿⠛⠛⠛⠛⠻⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n"
                     "⡇⠄⠄⢀⣀⣀⠄⠄⠄⠄⠉⠉⠛⠛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿\n"
                     "⠈⣆⠄⠄⢿⣿⣿⣷⣶⣶⣤⣤⣀⣀⡀⠄⠄⠉⢻⣿⣿⣿⣿⣿\n"
                     "⠄⣿⡀⠄⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠂⠄⢠⣿⣿⣿⣿⣿\n"
                     "⠄⣿⡇⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠄⢀⣼⣿⣿⣿⣿⣿\n"
                     "⠄⣿⡇⠄⠠⣿⣿⣿⣿⣿⣿⣿⡿⠋⠄⠄⣠⣾⣿⣿⣿⣿⣿⣿\n"
                     "⠄⣿⠁⠄⠐⠛⠛⠛⠉⠉⠉⠉⠄⠄⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿\n"
                     "⠄⠻⣦⣀⣀⣀⣀⣀⣤⣤⣤⣤⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋\n")


@bot.on(man_cmd(outgoing=True, pattern=r"dfrog(?: |$)(.*)"))
async def typewriter(typew):
    typew.pattern_match.group(1)
예제 #16
0
# Copyright (C) 2021 Catuserbot <https://github.com/sandy1709/catuserbot>
# Ported by @mrismanaziz
# FROM Man-Userbot <https://github.com/mrismanaziz/Man-Userbot>
# t.me/SharingUserbot & t.me/Lunatic0de

import asyncio

from telethon.errors.rpcerrorlist import YouBlockedUserError

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
from userbot.events import man_cmd
from userbot.utils import _format, edit_delete, edit_or_reply


@bot.on(man_cmd(outgoing=True, pattern=r"sg(u)?(?:\s|$)([\s\S]*)"))
async def _(event):
    "To get name/username history."
    input_str = "".join(event.text.split(maxsplit=1)[1:])
    reply_message = await event.get_reply_message()
    if not input_str and not reply_message:
        await edit_delete(event, "**Mohon Reply Ke Pesan Pengguna.**", 90)
    user, rank = await get_user_from_event(event, secondgroup=True)
    if not user:
        return
    uid = user.id
    chat = "@SangMataInfo_bot"
    manevent = await edit_or_reply(event, "`Processing...`")
    async with event.client.conversation(chat) as conv:
        try:
            await conv.send_message(f"/search_id {uid}")
예제 #17
0
# Based Plugins
# Ported For Lord-Userbot By liualvinas/Alvin
# If You Kang It Don't Delete / Warning!! Jangan Hapus Ini!!!
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
from userbot.events import man_cmd


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


# Alvin Gans


@bot.on(man_cmd(outgoing=True, pattern=r"wp(?: |$)(.*)"))
async def _(event):
    if event.fwd_from:
        return
    wwwspr = event.pattern_match.group(1)
    botusername = "******"
    if event.reply_to_msg_id:
예제 #18
0
            reply_to=event.message.id,
        )
        await asyncio.sleep(10)
        await no_admin_privilege_message.edit(
            "Sadly u don't have admin privilege")
    else:
        await event.client.send_message(
            entity=event.chat_id,
            message="""**Automatic AntiFlooder**
[User](tg://user?id={}) Membanjiri obrolan.
**Aksi:** Saya membisukan dia 🔇""".format(event.message.from_id),
            reply_to=event.message.id,
        )


@bot.on(man_cmd(outgoing=True, pattern=r"setflood(?: |$)(.*)"))
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 event.edit(
            "**Antiflood diperbarui menjadi** `{}` **dalam obrolan saat ini**".
            format(input_str))
    except Exception as e:  # pylint:disable=C0103,W0703
        await event.edit(str(e))


CMD_HELP.update({
예제 #19
0
            )
            await event.client.send_message(
                event.chat_id,
                msg_o.message,
                reply_to=message_id_to_reply,
                file=msg_o.media,
            )
            await event.delete()
        elif snip.reply:
            await event.client.send_message(
                event.chat_id, snip.reply, reply_to=message_id_to_reply
            )
            await event.delete()


@bot.on(man_cmd(outgoing=True, pattern=r"costum (\w*)"))
async def on_snip_save(event):
    """For .costum command, saves costums for future use."""
    try:
        from userbot.modules.sql_helper.snips_sql import add_snip
    except AtrributeError:
        await event.edit("**Berjalan pada mode Non-SQL!**")
        return
    keyword = event.pattern_match.group(1)
    string = event.text.partition(keyword)[2]
    msg = await event.get_reply_message()
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await event.client.send_message(
                BOTLOG_CHATID,
예제 #20
0
            break
        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:
        up_time += time_list.pop() + ", "

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

    return up_time


@bot.on(man_cmd(outgoing=True, pattern=r"ping$"))
async def _(ping):
    """For .ping command, ping the userbot from any chat."""
    uptime = await get_readable_time((time.time() - StartTime))
    start = datetime.now()
    await ping.edit("**✣**")
    await ping.edit("**✣✣**")
    await ping.edit("**✣✣✣**")
    await ping.edit("**✣✣✣✣**")
    end = datetime.now()
    duration = (end - start).microseconds / 1000
    user = await bot.get_me()
    await ping.edit(
        f"**PONG!!🏓**\n"
        f"✣ **Pinger** - `%sms`\n"
        f"✣ **Uptime -** `{uptime}` \n"
예제 #21
0
    "["
    "\U0001F1E0-\U0001F1FF"  # flags (iOS)
    "\U0001F300-\U0001F5FF"  # symbols & pictographs
    "\U0001F600-\U0001F64F"  # emoticons
    "\U0001F680-\U0001F6FF"  # transport & map symbols
    "\U0001F700-\U0001F77F"  # alchemical symbols
    "\U0001F780-\U0001F7FF"  # Geometric Shapes Extended
    "\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
    "]+")


@bot.on(man_cmd(outgoing=True, pattern=r"glitch(?: |$)(.*)"))
async def glitch(event):
    if not event.reply_to_msg_id:
        await event.edit("`Aku Mau Glitch Sebuah Hantu!`")
        return
    reply_message = await event.get_reply_message()
    if not reply_message.media:
        await event.edit("`Bales Ke Gambar/Sticker`")
        return
    await bot.download_file(reply_message.media)
    await event.edit("`Sedang Mendownload Media....`")
    if event.is_reply:
        data = await check_media(reply_message)
        if isinstance(data, bool):
            await event.edit("`File Tidak Di Dukung...`")
            return
예제 #22
0
# @SharingUserbot

import base64
from asyncio import sleep

from telethon.tl.functions.messages import ImportChatInviteRequest as Get

from userbot import BOTLOG, BOTLOG_CHATID
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, LOGS, bot
from userbot.events import man_cmd
from userbot.modules.sql_helper import broadcast_sql as sql
from userbot.utils import parse_pre


@bot.on(man_cmd(outgoing=True, pattern=r"sendto ?(.*)"))
async def catbroadcast_send(event):
    if event.fwd_from:
        return
    catinput_str = event.pattern_match.group(1)
    if not catinput_str:
        return await event.edit(
            "**Ke kategori mana saya harus mengirim pesan ini?**",
            parse_mode=parse_pre)
    reply = await event.get_reply_message()
    cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
    if not reply:
        return await event.edit(
            "**apa yang harus saya kirim ke kategori ini?**",
            parse_mode=parse_pre)
    keyword = catinput_str.lower()
예제 #23
0
from userbot.events import man_cmd

PRINTABLE_ASCII = range(0x21, 0x7F)


def aesthetify(string):
    for c in string:
        c = ord(c)
        if c in PRINTABLE_ASCII:
            c += 0xFF00 - 0x20
        elif c == ord(" "):
            c = 0x3000
        yield chr(c)


@bot.on(man_cmd(outgoing=True, pattern="ae(?: |$)(.*)"))
async def _(event):
    if event.fwd_from:
        return
    text = event.pattern_match.group(1)
    text = "".join(aesthetify(text))
    await event.edit(text=text, parse_mode=None, link_preview=False)
    raise events.StopPropagation


CMD_HELP.update(
    {
        "aeshtetic": f"**Plugin : **`aeshtetic`\
        \n\n  •  **Syntax :** `{cmd}ae <teks>`\
        \n  •  **Function : **Mengubah font teks Menjadi aeshtetic.\
    "
예제 #24
0
                    last=last,
                    fullname=fullname,
                    username=username,
                    userid=userid,
                    my_first=my_first,
                    my_last=my_last,
                    my_fullname=my_fullname,
                    my_username=my_username,
                    my_mention=my_mention,
                ),
                file=file_media,
            )
            update_previous_welcome(event.chat_id, current_message.id)


@bot.on(man_cmd(outgoing=True, pattern=r"setwelcome(?: |$)(.*)"))
async def save_welcome(event):
    if event.chat_id in BLACKLIST_CHAT:
        return await event.edit(
            "**Perintah ini Dilarang digunakan di Group ini**")
    try:
        from userbot.modules.sql_helper.welcome_sql import add_welcome_setting
    except AttributeError:
        return await event.edit("**Berjalan Pada Mode Non-SQL!**")
    msg = await event.get_reply_message()
    string = event.pattern_match.group(1)
    msg_id = None
    if msg and msg.media and not string:
        if BOTLOG_CHATID:
            await event.client.send_message(
                BOTLOG_CHATID,
예제 #25
0
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, HEROKU_API_KEY, HEROKU_APP_NAME, UPSTREAM_REPO_BRANCH, bot
from userbot.events import man_cmd
from userbot.utils import time_formatter

# ================= CONSTANT =================
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node
HEROKU_APP = from_key(HEROKU_API_KEY).apps()[HEROKU_APP_NAME]
# ============================================

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/78.0.3904.70 Mobile Safari/537.36"
opener.addheaders = [("User-agent", useragent)]


@bot.on(man_cmd(outgoing=True, pattern=r"sleep ([0-9]+)$"))
async def sleepybot(time):
    """For .sleep command, let the userbot snooze for a few second."""
    counter = int(time.pattern_match.group(1))
    await time.edit("`Saya mengantuk dan tertidur...`")
    if BOTLOG:
        str_counter = time_formatter(counter)
        await time.client.send_message(
            BOTLOG_CHATID,
            f"Anda menyuruh bot untuk tidur {str_counter}.",
        )
    sleep(counter)
    await time.edit("**Oke, saya sudah bangun sekarang.**")


@bot.on(man_cmd(outgoing=True, pattern=r"shutdown$"))
예제 #26
0
# Copyright (C) 2021 @mrismanaziz
# FROM Man-Userbot <https://github.com/mrismanaziz/Man-Userbot>
# t.me/SharingUserbot & t.me/Lunatic0de

from telethon.errors.rpcerrorlist import YouBlockedUserError

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
from userbot.events import man_cmd


@bot.on(man_cmd(outgoing=True, pattern=r"shazam(?: |$)(.*)"))
async def _(event):
    if not event.reply_to_msg_id:
        return await event.edit("**Mohon balas ke pesan audio**")
    reply_message = await event.get_reply_message()
    chat = "@auddbot"
    try:
        async with event.client.conversation(chat) as conv:
            try:
                await event.edit("`Mengidentifikasi lagu...`")
                start_msg = await conv.send_message("/start")
                await conv.get_response()
                send_audio = await conv.send_message(reply_message)
                check = await conv.get_response()
                if not check.text.startswith("Audio received"):
                    return await event.edit(
                        "Terjadi Error saat mengidentifikasi lagu. Coba gunakan pesan audio yang panjangnya 5-10 detik."
                    )
                await event.edit("`Tunggu sebentar...`")
                result = await conv.get_response()
예제 #27
0
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#

import os

from telethon.errors.rpcerrorlist import YouBlockedUserError

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
from userbot.events import man_cmd


@bot.on(man_cmd(outgoing=True, pattern=r"kamuii(:? |$)([1-8])?"))
async def _(fry):
    await fry.edit("`Mengaktifkan Kekuatan Supersaya...`")
    level = fry.pattern_match.group(2)
    if fry.fwd_from:
        return
    if not fry.reply_to_msg_id:
        await fry.edit("`Balas Di Sticker`")
        return
    reply_message = await fry.get_reply_message()
    if not reply_message.media:
        await fry.edit("`Gambar tidak di dukung`")
        return
    if reply_message.sender.bot:
        await fry.edit("`Mohon Balas Di Sticker`")
        return
예제 #28
0
from aiohttp import ClientSession
from bs4 import BeautifulSoup
from requests import get

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
from userbot.events import man_cmd
from userbot.utils import chrome, human_to_bytes, humanbytes, md5, time_formatter

GITHUB = "https://github.com"
DEVICES_DATA = ("https://raw.githubusercontent.com/androidtrackers/"
                "certified-android-devices/master/by_device.json")


@bot.on(man_cmd(outgoing=True, pattern="magisk$"))
async def magisk(request):
    """magisk latest releases"""
    magisk_dict = {
        "Stable":
        "https://raw.githubusercontent.com/topjohnwu/magisk-files/master/stable.json",
        "Beta":
        "https://raw.githubusercontent.com/topjohnwu/magisk-files/master/beta.json",
        "Canary":
        "https://raw.githubusercontent.com/topjohnwu/magisk-files/master/canary.json",
    }
    releases = "**Latest Magisk Releases :**\n"
    async with ClientSession() as ses:
        for name, release_url in magisk_dict.items():
            async with ses.get(release_url) as resp:
                data = await resp.json(content_type="text/plain")
예제 #29
0
from deezloader import Login
from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
from requests import get
from telethon.tl.types import DocumentAttributeAudio

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, DEEZER_ARL_TOKEN, TEMP_DOWNLOAD_DIRECTORY, bot
from userbot.events import man_cmd

if not TEMP_DOWNLOAD_DIRECTORY.endswith("/"):
    TEMP_DOWNLOAD_DIRECTORY += "/"


@bot.on(man_cmd(outgoing=True, pattern=r"deezloader (.*) (flac|320|256|128)"))
async def deeznuts(event):
    if DEEZER_ARL_TOKEN is None:
        return await event.edit("**Set** `DEEZER_ARL_TOKEN` **first.**")

    try:
        loader = Login(DEEZER_ARL_TOKEN)
    except Exception as e:
        return await event.edit(f"**Error:** `{e}`")

    try:
        link = get(event.pattern_match.group(1)).url
    except BaseException:
        return await event.edit("**Error: Invalid link provided.**")

    quality = {"flac": "FLAC", "320": "MP3_320", "256": "MP3_256", "128": "MP3_128"}
예제 #30
0
# credits: SNAPDRAGON (@s_n_a_p_s)
# originally from xtra-telegram
# ported by @heyworld

import asyncio
import time

from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
from userbot.events import man_cmd


@bot.on(
    man_cmd(
        outgoing=True,
        pattern=
        r"webupload ?(.+?|) (?:--)(anonfiles|transfer|filebin|anonymousfiles|megaupload|bayfiles)",
    ))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("`Processing ...`")
    PROCESS_RUN_TIME = 100
    input_str = event.pattern_match.group(1)
    selected_transfer = event.pattern_match.group(2)
    if input_str:
        file_name = input_str
    else:
        reply = await event.get_reply_message()
        file_name = await bot.download_media(reply.media,
                                             TEMP_DOWNLOAD_DIRECTORY)