Ejemplo n.º 1
0
from telethon.errors import (
    ChannelInvalidError,
    ChannelPrivateError,
    ChannelPublicGroupNaError,
)
from telethon.tl.functions.channels import GetFullChannelRequest, GetParticipantsRequest
from telethon.tl.functions.messages import GetFullChatRequest, GetHistoryRequest
from telethon.tl.types import ChannelParticipantsAdmins, MessageActionChannelMigrateFrom
from telethon.utils import get_input_location

from ninjadeep import CMD_HELP
from ninjadeep.utils import admin_cmd, sudo_cmd


@ninjadeep.on(admin_cmd(pattern="chatinfo(?: |$)(.*)", outgoing=True))
@ninjadeep.on(sudo_cmd(pattern="chatinfo(?: |$)(.*)"))
async def info(event):
    await eor(event, "`Analysing the chat...`")
    chat = await get_chatinfo(event)
    caption = await fetch_info(chat, event)
    try:
        await eor(event, caption, parse_mode="html")
    except Exception as e:
        print("Exception:", e)
        await eor(event, "`An unexpected error has occurred.`")
    return


async def get_chatinfo(event):
    chat = event.pattern_match.group(1)
    chat_info = None
Ejemplo n.º 2
0
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <https://www.gnu.org/licenses/>.

from telegraph import Telegraph
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError

from ninjadeep.ninjadeepConfig import Var
from ninjadeep.utils import admin_cmd, sudo_cmd

telegraph = Telegraph()
mee = telegraph.create_account(short_name="ninjadeep")


@ninjadeep.on(admin_cmd(pattern="purl ?(.*)"))
@ninjadeep.on(sudo_cmd(pattern="purl ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if not event.reply_to_msg_id:
        await event.reply("**Reply to any document.**")
        return
    reply_message = await event.get_reply_message()
    chat = "@FiletolinkTGbot"
    reply_message.sender
    await eor(event, "**Making public url...**")
    async with event.client.conversation(chat) as conv:
        try:
            response = conv.wait_event(
                events.NewMessage(incoming=True, from_users=1011636686))
            await event.client.forward_messages(chat, reply_message)
Ejemplo n.º 3
0
                    if admin or creator:
                        try:
                            await client.edit_permissions(
                                tele.chat_id, guser.id, view_messages=False
                            )
                            await tele.reply(
                                f"** Gbanned User Joined!!** \n"
                                f"**Victim Id**: [{guser.id}](tg://user?id={guser.id})\n"
                                f"**Action **  : `Banned`"
                            )
                        except BaseException:
                            return


@ninjadeep.on(admin_cmd(pattern="gban(?: |$)(.*)"))
@ninjadeep.on(sudo_cmd(pattern="gban(?: |$)(.*)", allow_sudo=True))
async def gspider(rk):
    lazy = rk
    sender = await lazy.get_sender()
    me = await lazy.client.get_me()
    if not sender.id == me.id:
        rkp = await lazy.reply("`processing...`")
    else:
        rkp = await lazy.edit("`processing...`")
    me = await rk.client.get_me()
    await rkp.edit(f"**Global Banning User!!**")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await rk.get_chat()
    a = b = 0
    if rk.is_private:
Ejemplo n.º 4
0
# Join @ninjadeepHelp for custom plugins

import asyncio

from ninjadeep.utils import admin_cmd, sudo_cmd


@ninjadeep.on(admin_cmd(pattern="cmds", outgoing=True))
@ninjadeep.on(sudo_cmd(pattern="cmds", allow_sudo=True))
async def install(event):
    if event.fwd_from:
        return
    cmd = "ls userbot/plugins"
    process = await asyncio.create_subprocess_shell(
        cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
    )
    stdout, stderr = await process.communicate()
    o = stdout.decode()
    _o = o.split("\n")
    o = "\n".join(_o)
    OUTPUT = f"**List of Plugins:**\n`{o}`\n\n**TIP:** __If you want to know the commands for a plugin, do:-__ \n `.help <plugin name>` **without the < > brackets.**\n__All plugins might not work directly.\n (c)NinjaDeep."
    await eor(event, OUTPUT)
Ejemplo n.º 5
0
#    it under the terms of the GNU Affero General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.

#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.

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

from ninjadeep.utils import admin_cmd, sudo_cmd


@ninjadeep.on(admin_cmd(pattern=r"echo (.*)"))
@ninjadeep.on(sudo_cmd(pattern=r"echo ( .*)", allow_sudo=True))
async def _(event):
    bxt = Var.TG_BOT_USER_NAME_BF_HER
    try:
        tex = str(event.text[6:])
        await tgbot.send_message(event.chat_id, tex)
        await event.delete()
    except BaseException:
        await event.client.send_message(event.chat_id,
                                        f"Please add @{bxt} here first!")
        await event.delete()
Ejemplo n.º 6
0
# This software is a part of https://github.com/buddhhu/Plus
#
# Ported to ninjadeep by @its_xditya
#

import os

import pygments
from pygments.formatters import ImageFormatter
from pygments.lexers import Python3Lexer

from ninjadeep.utils import admin_cmd, sudo_cmd


@ninjadeep.on(admin_cmd(pattern=r"ncode"))
@ninjadeep.on(sudo_cmd(pattern=r"ncode", allow_sudo=True))
async def coder_print(event):
    a = await event.client.download_media(await event.get_reply_message(),
                                          Var.TEMP_DOWNLOAD_DIRECTORY)
    s = open(a, "r")
    c = s.read()
    s.close()
    pygments.highlight(
        f"{c}",
        Python3Lexer(),
        ImageFormatter(font_name="DejaVu Sans Mono", line_numbers=True),
        "result.png",
    )
    res = await event.client.send_message(
        event.chat_id,
        "**Pasting this code on my page...**",
Ejemplo n.º 7
0
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError

from ninjadeep.utils import admin_cmd, sudo_cmd

# (c)2020 ninjadeep


@ninjadeep.on(admin_cmd(pattern="stickerize(?: |)(.*)"))
@ninjadeep.on(sudo_cmd(allow_sudo=True, pattern="stickerize(?: |$)(.*)"))
async def _(event):
    sender = await event.get_sender()
    me = await event.client.get_me()
    if not sender.id == me.id:
        teletemp = await event.reply("`Processing...`")
    else:
        teletemp = await eor(event, "`Processing...`")
    try:
        reply_message = await event.get_reply_message()
        if reply_message:
            if not reply_message.media:
                return await teletemp.edit(
                    "`Reply to a photo to convert it to a stiker.`")
        if not reply_message:
            return await teletemp.edit(
                "**Syntax:**`.stickerize` reply to a  photo")
        chat = "@stickerator_bot"
        async with event.client.conversation(chat, timeout=7) as conv:
            try:
                test = conv.wait_event(
                    events.NewMessage(incoming=True, from_users=384614990))
Ejemplo n.º 8
0
KANGING_STR = [
    "Using NinjaDeep to kang this sticker...",
    "Plagiarising hehe...",
    "Inviting this sticker over to my pack...",
    "Kanging this sticker...",
    "Hey that's a nice sticker!\nMind if I kang?!..",
    "hehe me stel ur stikér\nhehe.",
    "Ay look over there (☉。☉)!→\nWhile I kang this...",
    "Roses are red violets are blue, kanging this sticker so my pacc looks cool",
    "Imprisoning this sticker...",
    "Mr.Steal Your Sticker is stealing this sticker... ",
]


@ninjadeep.on(admin_cmd(outgoing=True, pattern="kang"))
@ninjadeep.on(sudo_cmd(pattern="kang", allow_sudo=True))
async def kang(args):
    """ For .kang command, kangs stickers or creates new ones. """
    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 message and message.media:
        if isinstance(message.media, MessageMediaPhoto):
            await args.edit(f"`{random.choice(KANGING_STR)}`")
            photo = io.BytesIO()
Ejemplo n.º 9
0
from time import sleep
from urllib.parse import quote_plus

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys

from ninjadeep import CHROME_DRIVER, GOOGLE_CHROME_BIN
from ninjadeep.utils import admin_cmd, sudo_cmd

CARBONLANG = "auto"
LANG = "en"


@ninjadeep.on(admin_cmd(outgoing=True, pattern="carbon"))
@ninjadeep.on(sudo_cmd(incoming=True, pattern="carbon"))
async def carbon_api(e):
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        """ A Wrapper for carbon.now.sh """
        await eor(e, "`Processing..`")
        CARBON = "https://carbon.now.sh/?l={lang}&code={code}"
        global CARBONLANG
        textx = await e.get_reply_message()
        pcode = e.text
        if pcode[8:]:
            pcodee = str(pcode[8:])
            if "|" in pcodee:
                pcode, skeme = pcodee.split("|")
            else:
                pcode = pcodee
                skeme = None
Ejemplo n.º 10
0
#  (c)2020 ninjadeep
#
# You may not use this plugin without proper authorship and consent from @ninjadeepSupport
#
# Creted by @buddhhu, @itzsjdude
#
import asyncio
import os

from ninjadeep.utils import admin_cmd, sudo_cmd


@ninjadeep.on(admin_cmd(pattern="repack ?(.*)", outgoing=True))
@ninjadeep.on(sudo_cmd(pattern="repack ?(.*)", allow_sudo=True))
async def _(event):
    a = await event.get_reply_message()
    input_str = event.pattern_match.group(1)
    b = open(input_str, "w")
    b.write(str(a.message))
    b.close()
    a = await event.reply(f"**Packing into** `{input_str}`")
    await asyncio.sleep(2)
    await a.edit(f"**Uploading** `{input_str}`")
    await asyncio.sleep(2)
    await event.client.send_file(event.chat_id, input_str)
    await a.delete()
    os.remove(input_str)
Ejemplo n.º 11
0
    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


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


@ninjadeep.on(admin_cmd(outgoing=True, pattern="alive"))
@ninjadeep.on(sudo_cmd(outgoing=True, pattern="alive", allow_sudo=True))
async def amireallyalive(alive):
    start = datetime.now()
    myid = bot.uid
    """ For .alive command, check if the bot is running.  """
    end = datetime.now()
    (end - start).microseconds / 1000
    uptime = get_readable_time((time.time() - StartTime))
    if ALV_PIC:
        tele = f"**Welcome To NinjaDeep **\n\n"
        tele += (
            "`➥🔹NinjaDeep **Alive** ||All systems online and functioning normally!`\n\n"
        )
        tele += "` ➥🔸 Telethon version:` **1.17**\n` ➥🔹 Python:` **3.8.3**\n"
        tele += f"` ➥🔸 NinjaDeep Version:` **{ninja_version}**\n"
        tele += "` ➥🔹 More Info:` **@NinjaDeepSUPPORT**\n"
Ejemplo n.º 12
0
from datetime import datetime

import requests
from bs4 import BeautifulSoup
from google_images_download import google_images_download

from ninjadeep.utils import admin_cmd, edit_or_reply, sudo_cmd


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


@ninjadeep.on(admin_cmd(pattern="go (.*)"))
@ninjadeep.on(sudo_cmd(pattern="go (.*)"))
async def _(event):
    lool = await edit_or_reply(event, "`Processing Your Request`")
    if event.fwd_from:
        return
    start = datetime.now()
    x = await eor(lool, "`Connecting...`")
    # SHOW_DESCRIPTION = False
    # + " -inurl:(htm|html|php|pls|txt) intitle:index.of \"last modified\" (mkv|mp4|avi|epub|pdf|mp3)"
    input_str = event.pattern_match.group(1)
    input_url = "https://bots.shrimadhavuk.me/search/?q={}".format(input_str)
    headers = {"USER-AGENT": "UniBorg"}
    response = requests.get(input_url, headers=headers).json()
    output_str = " "
    for result in response["results"]:
        text = result.get("title")
Ejemplo n.º 13
0
    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


@ninjadeep.on(admin_cmd(outgoing=True, pattern="setgpic"))
@ninjadeep.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)
        return
Ejemplo n.º 14
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


# @command(pattern="^.ping$")


@ninjadeep.on(admin_cmd(pattern="ping$"))
@ninjadeep.on(sudo_cmd(pattern="ping$", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    x = await eor(event, "�NinjaDeep Pong!")
    end = datetime.now()
    ms = (end - start).microseconds / 1000
    uptime = get_readable_time((time.time() - StartTime))
    await x.edit(
        f"█▀█ █▀█ █▄░█ █▀▀ █ \n█▀▀ █▄█ █░▀█ █▄█ ▄**\n ➲ `{ms}` \n ➲ `{uptime}`"
    )
Ejemplo n.º 15
0
#  (c)2020 ninjadeep
#
# You may not use this plugin without proper authorship and consent from @ninjadeepSupport
#
# By @buddhhu, @Itzsjdude
#
import os

from ninjadeep.utils import admin_cmd, sudo_cmd


@ninjadeep.on(admin_cmd(pattern=r"reveal", outgoing=True))
@ninjadeep.on(sudo_cmd(pattern=r"reveal"))
async def _(event):
    b = await event.client.download_media(await event.get_reply_message())
    a = open(b, "r")
    c = a.read()
    a.close()
    a = await event.reply("**Reading file...**")
    if len(c) > 4095:
        await a.edit(
            "`The Total words in this file is more than telegram limits.`")
    else:
        await event.client.send_message(event.chat_id, f"```{c}```")
        await a.delete()
    os.remove(b)