Beispiel #1
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 telebot.utils import admin_cmd, sudo_cmd


@telebot.on(admin_cmd(pattern=r"echo (.*)"))
@telebot.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()
Beispiel #2
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


@telebot.on(admin_cmd(pattern="gban(?: |$)(.*)"))
@telebot.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:
Beispiel #3
0
# Join @TeleBotHelp for custom plugins

import asyncio

from telebot.utils import admin_cmd, sudo_cmd


@telebot.on(admin_cmd(pattern="cmds", outgoing=True))
@telebot.on(sudo_cmd(pattern="cmds", allow_sudo=True))
async def install(event):
    if event.fwd_from:
        return
    cmd = "ls telebot/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)TeleBot."
    await eor(event, OUTPUT)
Beispiel #4
0
#
# Ported to TeleBot by @its_xditya
#

import os

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

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


@telebot.on(admin_cmd(pattern=r"ncode"))
@telebot.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...**",
Beispiel #5
0
#  (c)2020 TeleBot
#
# You may not use this plugin without proper authorship and consent from @TeleBotSupport
#
# Creted by @buddhhu, @itzsjdude
#
import asyncio
import os

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


@telebot.on(admin_cmd(pattern="repack ?(.*)", outgoing=True))
@telebot.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)


CMD_HELP.update({
Beispiel #6
0
#    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 telebot import CMD_HELP
from telebot.telebotConfig import Var
from telebot.utils import admin_cmd, sudo_cmd

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


@telebot.on(admin_cmd(pattern="purl ?(.*)"))
@telebot.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)
Beispiel #7
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 telebot import CMD_HELP
from telebot.utils import admin_cmd, sudo_cmd


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


async def get_chatinfo(event):
    chat = event.pattern_match.group(1)
    chat_info = None
Beispiel #8
0
KANGING_STR = [
    "Using Witchery 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... ",
]


@telebot.on(admin_cmd(outgoing=True, pattern="kang"))
@telebot.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()
Beispiel #9
0
#  (c)2020 TeleBot
#
# You may not use this plugin without proper authorship and consent from @TeleBotSupport
#
# By @buddhhu, @Itzsjdude
#
import os

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


@telebot.on(admin_cmd(pattern=r"reveal", outgoing=True))
@telebot.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)


CMD_HELP.update({
    "reveal":
Beispiel #10
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


@telebot.on(admin_cmd(outgoing=True, pattern="setgpic"))
@telebot.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
Beispiel #11
0
from datetime import datetime

import requests
from bs4 import BeautifulSoup
from google_images_download import google_images_download

from telebot.utils import admin_cmd, edit_or_reply, sudo_cmd


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


@telebot.on(admin_cmd(pattern="go (.*)"))
@telebot.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")
Beispiel #12
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 "@TeleBotSupport"


@telebot.on(admin_cmd(outgoing=True, pattern="alive"))
@telebot.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 TeleBot **\n\n"
        tele += "`Hey! I'm alive. All systems online and functioning normally!`\n\n"
        tele += "` 🔸 Telethon version:` **1.17**\n` 🔹 Python:` **3.8.3**\n"
        tele += f"` 🔸 TeleBot Version:` **{telever}**\n"
        tele += "` 🔹 More Info:` **@TeleBotSupport**\n"
        tele += f"` 🔸 Sudo :` **{sudo}**\n"
        tele += f"` 🔹 TeleBot Uptime:` **{uptime}**\n"
Beispiel #13
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 telebot import CHROME_DRIVER, GOOGLE_CHROME_BIN
from telebot.utils import admin_cmd, sudo_cmd

CARBONLANG = "auto"
LANG = "en"


@telebot.on(admin_cmd(outgoing=True, pattern="carbon"))
@telebot.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
Beispiel #14
0
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError

from telebot.utils import admin_cmd, sudo_cmd

# (c)2020 TeleBot


@telebot.on(admin_cmd(pattern="stickerize(?: |)(.*)"))
@telebot.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))
Beispiel #15
0
        if seconds == 0 and remainder == 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:
        ping_time += time_list.pop() + ", "

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

    return ping_time


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


@telebot.on(admin_cmd(pattern="ping$"))
@telebot.on(sudo_cmd(pattern="ping$", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    x = await eor(event, "� Pong!")
    end = datetime.now()
    ms = (end - start).microseconds / 1000
    uptime = get_readable_time((time.time() - StartTime))
    await x.edit(f"�Ping speed: {ms}\n🤖TeleBot Uptime: {uptime}")