Пример #1
0
     "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█\n")
Y = ("──────▄▀─\n" "─█▀▀▀█▀█─\n" "──▀▄░▄▀──\n" "────█────\n" "──▄▄█▄▄──\n")
U = ("─▄▀▀███═◯\n" "▐▌▄▀▀█▀▀▄\n" "█▐▌─────▐▌\n" "█▐█▄───▄█▌\n" "▀─▀██▄██▀\n")
I = ("───────────▀▄\n"
     "──█▄▄▄▄▄███▀▄─▄▄\n"
     "▄▀──▀▄─▀▀█▀▀▄▀──▀▄\n"
     "▀▄▀▀█▀▀████─▀▄──▄▀\n"
     "──▀▀──────────▀▀\n")
O = ("O────────────────O\n"
     "█▓██▄────────────█\n"
     "█▓▓░▀▄▀░░░░░░░░░░█\n"
     "█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█\n"
     "█────────────────█\n")


@thunderbot.on(admin_cmd(pattern=r"welcome"))
async def nandywelcome(welcome):
    await welcome.edit(T)


@thunderbot.on(admin_cmd(pattern=r"drink"))
async def nandydrink(drink):
    await drink.edit(Y)


@thunderbot.on(admin_cmd(pattern=r"bomb"))
async def nandybomb(bomb):
    await bomb.edit(U)


@thunderbot.on(admin_cmd(pattern=r"bike"))
Пример #2
0
from telethon import events
import asyncio
from thunderbot.utils import admin_cmd
from thunderbot import CMD_HELP


@thunderbot.on(admin_cmd(pattern="dump ?(.*)"))
async def _(message):
    try:
        obj = message.pattern_match.group(1)
        if len(obj) != 3:
            raise IndexError
        inp = ' '.join(obj)
    except IndexError:
        inp = "🌎 📱 ❤️"
    u, t, g, o, s, n = inp.split(), '🗑', '<(^_^ <)', '(> ^_^)>', '⠀ ', '\n'
    h = [(u[0], u[1], u[2]), (u[0], u[1], ''), (u[0], '', '')]
    for something in reversed([
            y for y in ([
                ''.join(x)
                for x in (f + (s, g, s + s * f.count(''), t),
                          f + (g, s * 2 + s * f.count(''), t),
                          f[:i] + (o, f[i], s * 2 + s * f.count(''), t),
                          f[:i] + (s + s * f.count(''), o, f[i], s, t),
                          f[:i] + (s * 2 + s * f.count(''), o, f[i], t),
                          f[:i] + (s * 3 + s * f.count(''), o, t),
                          f[:i] + (s * 3 + s * f.count(''), g, t))
            ] for i, f in enumerate(reversed(h)))
    ]):
        for something_else in something:
            await asyncio.sleep(0.3)
Пример #3
0
import asyncio

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


@thunderbot.on(admin_cmd(outgoing=True, pattern=r"gmute ?(\d+)?"))
@thunderbot.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()
Пример #4
0
from asyncio import sleep

from telethon.errors import rpcbaseerrors

from thunderbot import BOTLOG, BOTLOG_CHATID, CMD_HELP
from thunderbot.thunderbotConfig import Var
from thunderbot.utils import admin_cmd, errors_handler

BOTLOG_CHATID = Var.PRIVATE_GROUP_ID


@thunderbot.on(admin_cmd(outgoing=True, pattern="purge"))
@thunderbot.on(sudo_cmd(allow_sudo=True, pattern="purge"))
@errors_handler
async def fastpurger(purg):
    """ For .purge command, purge all messages starting from the reply. """
    chat = await purg.get_input_chat()
    msgs = []
    count = 0

    async for msg in purg.client.iter_messages(chat,
                                               min_id=purg.reply_to_msg_id):
        msgs.append(msg)
        count = count + 1
        msgs.append(purg.reply_to_msg_id)
        if len(msgs) == 100:
            await purg.client.delete_messages(chat, msgs)
            msgs = []

    if msgs:
        await purg.client.delete_messages(chat, msgs)
Пример #5
0
import io
import os
import os.path
import time
from os.path import exists, isdir

from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd, humanbytes

MAX_MESSAGE_SIZE_LIMIT = 4095


@thunderbot.on(admin_cmd(outgoing=True, pattern=r"ls ?(.*)"))
@thunderbot.on(sudo_cmd(allow_sudo=True, pattern=r"ls ?(.*)"))
async def lst(event):
    if event.fwd_from:
        return
    thundrgang = event.pattern_match.group(1)
    if thundrgang:
        path = thundrgang
    else:
        path = os.getcwd()
    if not exists(path):
        await eor(
            event,
            f"There is no such directory or file with the name `{thundrgang}` check again!",
        )
        return
    if isdir(path):
        if thundrgang:
            msg = "Folders and Files in `{}` :\n\n".format(path)
Пример #6
0
"""Plugin made by Thundergang for ThunderUserbot 
and if you will copy it without credits then you are the biggest gay of this universe"""
import asyncio
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins
from platform import uname
from thunderbot import ALIVE_NAME
from thunderbot.utils import admin_cmd

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


#@command(outgoing=True, pattern="^.hacker$")
@thunderbot.on(admin_cmd(pattern=r"hacker"))
async def nandyhacker(hacker):
    await hacker.edit(n + "Anonymous \n"
                      "─────█─▄▀█──█▀▄─█─────\n"
                      "────▐▌──────────▐▌────\n"
                      "────█▌▀▄──▄▄──▄▀▐█────\n"
                      "───▐██──▀▀──▀▀──██▌───\n"
                      "──▄████▄──▐▌──▄████▄──\n")


Q = ("───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───\n"
     "───█▒▒░░░░░░░░░▒▒█───\n"
     "────█░░█░░░░░█░░█────\n"
     "─▄▄──█░░░▀█▀░░░█──▄▄─\n"
     "█░░█─▀▄░░░░░░░▄▀─█░░█\n")
W = ("──────▄▀▄─────▄▀▄\n"
     "─────▄█░░▀▀▀▀▀░░█▄\n"
Пример #7
0
"""
Available Commands:
.update
"""

import asyncio
from telethon import events
from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd("update"))
async def _(event):
    if event.fwd_from:
        return
    animation_interval = 0.1
    animation_ttl = range(0, 2)
    await event.edit("⚡️Thunderuserbot⚡️")
    animation_chars = [
        "⚡️@thunderuserbot⚡️",
        "⚡️**Restart Your Dynos To Automatically Update Your Thunderuserbots**⚡️\nFor More, Get Help From [Here](https://t.me/thunderuserbot)"
    ]

    for i in animation_ttl:

        await asyncio.sleep(animation_interval)
        await event.edit(animation_chars[i % 18])


CMD_HELP.update({"update": ".update\nUse - Update Your Thunderuserbot."})
Пример #8
0
  
import os
import sys
from thunderbot import CMD_HELP, CMD_HNDLR
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern="update"))
async def _(event):
    if event.fwd_from:
        return
    await event.edit(
        f" ⚡️⚡️**Updating Your Thunderuserbot**⚡️⚡️ ... \n\nPlease Wait Until It Starts Again✅\nFor More, Get Help From [Here](https://t.me/thunderuserbot) "
    )
    await thunderbot.disconnect()
    os.execl(sys.executable, sys.executable, *sys.argv)
    quit()

CMD_HELP.update(
    {
        "update": "`.update`\nUse - Updates Your Thunderuserbot."
    }
)
Пример #9
0
from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern=r"shout", outgoing=True))
@thunderbot.on(sudo_cmd(pattern=r"shout", allow_sudo=True))
async def shout(args):
    if args.fwd_from:
        return
    else:
        msg = "```"
        messagestr = args.text
        messagestr = messagestr[7:]
        text = " ".join(messagestr)
        result = []
        result.append(" ".join([s for s in text]))
        for pos, symbol in enumerate(text[1:]):
            result.append(symbol + " " + "  " * pos + symbol)
        result = list("\n".join(result))
        result[0] = text[0]
        result = "".join(result)
        msg = "\n" + result
        await eor(args, "`" + msg + "`")


CMD_HELP.update(
    {"shout": ".shout <message>\nUse - Shout the message word-by-word."})
Пример #10
0
             "https://telegra.ph/file/d0cafe17ecee36c925536.jpg")
PM_WARNS = {}
PREV_REPLY_MESSAGE = {}
myid = bot.uid
MESAG = (str(CUSTOM_PMPERMIT) if CUSTOM_PMPERMIT else
         "`Markbot PM security! Please wait for me to approve you. 😊")
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Markbot User"
USER_BOT_WARN_ZERO = "`I had warned you not to spam. Now you have been blocked and reported until further notice.`\n\n**GoodBye!** "
USER_BOT_NO_WARN = (
    "**PM Security ~ Markbot**\n\nNice to see you here, but  "
    "[{}](tg://user?id={}) is currently unavailable.\nThis is an automated message.\n\n"
    "{}\n\n**You have** `{}/{}` **warnings...**"
    "\n\n   ~ Thank You.")


@thunderbot.on(admin_cmd(pattern="a ?(.*)"))
@thunderbot.on(admin_cmd(pattern="approve ?(.*)"))
async def approve_p_m(event):
    if event.fwd_from:
        return
    replied_user = await event.client(GetFullUserRequest(event.chat_id))
    firstname = replied_user.user.first_name
    reason = event.pattern_match.group(1)
    chat = await event.get_chat()
    if event.is_private:
        if not pmpermit_sql.is_approved(chat.id):
            if chat.id in PM_WARNS:
                del PM_WARNS[chat.id]
            if chat.id in PREV_REPLY_MESSAGE:
                await PREV_REPLY_MESSAGE[chat.id].delete()
                del PREV_REPLY_MESSAGE[chat.id]
Пример #11
0
import logging
import time

from telethon.events import NewMessage
from telethon.tl.custom import Dialog
from telethon.tl.types import Channel, Chat, User

from thunderbot.utils import admin_cmd

logging.basicConfig(
    format="[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s",
    level=logging.WARNING)
logger = logging.getLogger(__name__)


@thunderbot.on(admin_cmd(pattern="stats"))
async def stats(
    event: NewMessage.Event,
) -> None:  # pylint: disable = R0912, R0914, R0915
    """Command to get stats about the account"""
    await event.edit("`Wait few seconds and lemme collect stats`")
    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
Пример #12
0
import re
from requests import get
from bs4 import BeautifulSoup

from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd

GITHUB = 'https://github.com'
DEVICES_DATA = 'https://raw.githubusercontent.com/androidtrackers/' \
               'certified-android-devices/master/devices.json'


@thunderbot.on(admin_cmd(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 (Release)":
        "https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/release.json",
        "Canary (Debug)":
        "https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/debug.json"
    }
    releases = 'Latest Magisk Releases:\n'
    for name, release_url in magisk_dict.items():
        data = get(release_url).json()
        releases += f'{name}: [ZIP v{data["magisk"]["version"]}]({data["magisk"]["link"]}) | ' \
                    f'[APK v{data["app"]["version"]}]({data["app"]["link"]}) | ' \
                    f'[Uninstaller]({data["uninstaller"]["link"]})\n'
Пример #13
0
from telethon import events
import os
import requests
import json
from thunderbot.utils import admin_cmd
from thunderbot import CMD_HELP


@thunderbot.on(admin_cmd("duckduckgo (.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    sample_url = "https://duckduckgo.com/?q={}".format(
        input_str.replace(" ", "+"))
    if sample_url:
        link = sample_url.rstrip()
        await event.edit(
            "Let Me 🦆 DuckDuckGo That For From My Thunderuserbot⚡️:\n🔎 [{}]({})"
            .format(input_str, link))
    else:
        await event.edit("something is wrong. please try again later.")


CMD_HELP.update({
    "duckduckgo":
    ".duckduckgo\nUse - To Get Direct Search Link To Duckduckgo."
})
Пример #14
0
async def on_new_message(event):
    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


@thunderbot.on(admin_cmd(pattern="addblacklist ((.|\n)*)"))
@thunderbot.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)),
    )

Пример #15
0
from telethon import functions

from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern="invite ?(.*)"))
@thunderbot.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")
        else:
            # https://lonamiwebs.github.io/Telethon/methods/channels/invite_to_channel.html
            for user_id in to_add_users.split(" "):
Пример #16
0
import asyncio
import time

from thunderbot.utils import admin_cmd


@thunderbot.on(
    admin_cmd(
        pattern="webupload ?(.+?|) (?:--)(anonfiles|transfer|filebin|anonymousfiles|megaupload|bayfiles)"
    )
)
@thunderbot.on(
    sudo_cmd(
        pattern="webupload ?(.+?|) (?:--)(anonfiles|transfer|filebin|anonymousfiles|megaupload|bayfiles)",
        allow_sudo=True,
    )
)
async def _(event):
    if event.fwd_from:
        return
    await eor(event, "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, Var.TEMP_DOWNLOAD_DIRECTORY)
    event.message.id
    CMD_WEB = {
Пример #17
0
S = ("▄▄▀█▄───▄───────▄\n"
"▀▀▀██──███─────███\n"
"░▄██▀░█████░░░█████░░\n"
"███▀▄███░███░███░███░▄\n"
"▀█████▀░░░▀███▀░░░▀██▀\n")
D = ("╔══╗░░░░╔╦╗░░╔═════╗\n"
"║╚═╬════╬╣╠═╗║░▀░▀░║\n"
"╠═╗║╔╗╔╗║║║╩╣║╚═══╝║\n"
"╚══╩╝╚╝╚╩╩╩═╝╚═════╝\n")
F = ("───────███\n"
"───────███\n"
"▄█████▄█▀▀\n"
"─▀█████\n"
"──▄████▄\n")

@thunderbot.on(admin_cmd(pattern=r"devil"))
async def nandydevil(devil):
    await devil.edit(P)
@thunderbot.on(admin_cmd(pattern=r"robot"))
async def nandyrobot(robot):
    await robot.edit(A)
@thunderbot.on(admin_cmd(pattern=r"boa"))
async def nandyboa(boa):
    await boa.edit(S)
@thunderbot.on(admin_cmd(pattern=r"smile"))
async def nandysmile(smile):
    await smile.edit(D)
@thunderbot.on(admin_cmd(pattern=r"toilet"))
async def nandytoilet(toilet):
    await toilet.edit(F)
Пример #18
0
"""Emoji
Available Commands:
.support
"""

from telethon import events

import asyncio

from thunderbot.utils import admin_cmd

@thunderbot.on(admin_cmd("support"))
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 == "support":
    await event.edit("for our support group")
    animation_chars = [
            "Click here",
            "[ThunderUserbot Support](https://t.me/thunderuserbot)"
         ]
            

    for i in animation_ttl:
        	
        await asyncio.sleep(animation_interval)
        await event.edit(animation_chars[i % 18])
Пример #19
0
"""Use cmd `.cry` to cry"""
import asyncio

from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern="cry"))
async def _(event):
    if event.fwd_from:
        return

    animation_interval = 1

    animation_ttl = range(0, 103)

    await event.edit("crying")

    animation_chars = [
        ";__",
        ";___",
        ";____",
        ";_____",
        ";______",
        ";_______",
        ";________",
        ";__________",
        ";____________",
        ";______________",
        ";________________",
        ";__________________",
        ";____________________",
Пример #20
0
"""Globally Ban users from all the
Group Administrations bots where you are SUDO
Available Commands:
.gban REASON
.ungban"""

from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern="botgban ?(.*)"))
@thunderbot.on(sudo_cmd(pattern="botgban ?(.*)", allow_sudo=True))
async def _(event):
    if Config.G_BAN_LOGGER_GROUP is None:
        await eor(
            event,
            "Make a group, add all your sudo bots and paste it's id in ENV VAR (G_BAN_LOGGER_GROUP) for this module to work.",
        )
        return
    if event.fwd_from:
        return
    reason = event.pattern_match.group(1)
    if event.reply_to_msg_id:
        r = await event.get_reply_message()
        if r.forward:
            r_from_id = r.forward.from_id or r.from_id
        else:
            r_from_id = r.from_id
        await borg.send_message(
            Config.G_BAN_LOGGER_GROUP,
            "/gban [user](tg://user?id={}) {}".format(r_from_id, reason),
Пример #21
0
from telethon import events, functions, types

from thunderbot import CMD_HELP
from thunderbot.plugins.sql_helper.locks_sql import get_locks, is_locked, update_lock
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern=r"lock( (?P<target>\S+)|$)"))
@thunderbot.on(sudo_cmd(pattern=r"lock( (?P<target>\S+)|$)", allow_sudo=True))
async def _(event):
    # Space weirdness in regex required because argument is optional and other
    # commands start with ".lock"
    if event.fwd_from:
        return
    input_str = event.pattern_match.group("target")
    if input_str == "":
        await eor(
            event,
            "LockTypes -\n➟ bots\n➟ commands\n➟ forward\n➟ url\n➟ msg\n➟ media\n ➟ sticker\n➟ gif\n➟ gamee\n➟ ainline\n ➟ gpoll\n➟ adduser\n➟ cpin\n➟ changeinfo\n\nUse `.lock <locktypes>` to lock it.",
        )
    peer_id = event.chat_id
    if input_str in (("bots", "commands", "email", "forward", "url")):
        update_lock(peer_id, input_str, True)
        await eor(event, "Locked {}".format(input_str))
    else:
        msg = None
        media = None
        sticker = None
        gif = None
        gamee = None
        ainline = None
Пример #22
0


import requests
import bs4
import re
from telethon import *
from thunderbot.utils import admin_cmd
from thunderbot import CMD_HELP




@thunderbot.on(admin_cmd(pattern="app (.*)"))

async def apk(e):

    try:

        app_name = e.pattern_match.group(1)

        remove_space = app_name.split(' ')

        final_name = '+'.join(remove_space)

        page = requests.get("https://play.google.com/store/search?q="+final_name+"&c=apps")

        lnk = str(page.status_code)

        soup = bs4.BeautifulSoup(page.content,'lxml', from_encoding='utf-8')
Пример #23
0
import pyfiglet

from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern="figlet ?(.*)", outgoing=True))
@thunderbot.on(sudo_cmd(pattern="figlet ?(.*)", allow_sudo=True))
async def figlet(event):
    if event.fwd_from:
        return
    CMD_FIG = {
        "slant": "slant",
        "3D": "3-d",
        "5line": "5lineoblique",
        "alpha": "alphabet",
        "banner": "banner3-D",
        "doh": "doh",
        "iso": "isometric1",
        "letter": "letters",
        "allig": "alligator",
        "dotm": "dotmatrix",
        "bubble": "bubble",
        "bulb": "bulbhead",
        "digi": "digital",
    }
    input_str = event.pattern_match.group(1)
    if "|" in input_str:
        text, cmd = input_str.split("|", maxsplit=1)
    elif input_str is not None:
        cmd = None
Пример #24
0
from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern="pmto ?(.*)"))
async def pmto(event):
    a = event.pattern_match.group(1)
    b = a.split(" ")
    chat_id = b[0]
    try:
        chat_id = int(chat_id)
    except BaseException:
        pass
    msg = ""
    for i in b[1:]:
        msg += i + " "
    if msg == "":
        return
    try:
        await borg.send_message(chat_id, msg)
        await event.edit("Message sent!")
    except BaseException:
        await event.edit("Something went wrong.")


CMD_HELP.update({"pmto": ".pmto <username> <message>"})
Пример #25
0
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern="frwd"))
@thunderbot.on(sudo_cmd(pattern="frwd", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if Config.CHANNEL_ID is None:
        await eor(
            event,
            "Please set the required environment variable `CHANNEL_ID` for this plugin to work",
        )
        return
    try:
        e = await borg.get_entity(Config.CHANNEL_ID)
    except Exception as e:
        await eor(event, str(e))
    else:
        re_message = await event.get_reply_message()
        fwd_message = await borg.forward_messages(e, re_message, silent=True)
        await borg.forward_messages(event.chat_id, fwd_message)
        await fwd_message.delete()
        await event.delete()
Пример #26
0
from geopy.geocoders import Nominatim
from telethon.tl import types

from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern="gps ?(.*)"))
@thunderbot.on(sudo_cmd(pattern="gps ?(.*)", allow_sudo=True))
async def gps(event):
    if event.fwd_from:
        return
    reply_to_id = event.message
    if event.reply_to_msg_id:
        reply_to_id = await event.get_reply_message()
    input_str = event.pattern_match.group(1)

    if not input_str:
        return await eor(event, "Please give me a location to find.")

    await eor(event, "Finding...")

    geolocator = Nominatim(user_agent="thunderbot")
    geoloc = geolocator.geocode(input_str)

    if geoloc:
        lon = geoloc.longitude
        lat = geoloc.latitude
        await reply_to_id.reply(input_str,
                                file=types.InputMediaGeoPoint(
                                    types.InputGeoPoint(lat, lon)))
Пример #27
0
import asyncurban

from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern="ud (.*)"))
@thunderbot.on(sudo_cmd(pattern="ud (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    await eor(event, "Processing...")
    word = event.pattern_match.group(1)
    urban = asyncurban.UrbanDictionary()
    try:
        mean = await urban.get_word(word)
        await eor(
            event,
            "Text: **{}**\n\nMeaning: **{}**\n\nExample: __{}__".format(
                mean.word, mean.definition, mean.example),
        )
    except asyncurban.WordNotFoundError:
        await eor(event, "No result found for **" + word + "**")
Пример #28
0
import os
import subprocess

from thunderbot.utils import admin_cmd

from thunderbot import CMD_HELP


@thunderbot.on(admin_cmd(pattern=r"getc"))
@thunderbot.on(sudo_cmd(pattern=r"getc", allow_sudo=True))
async def get_media(event):
    if event.fwd_from:
        return
    dir = "./temp/"
    try:
        os.makedirs("./temp/")
    except BaseException:
        pass
    channel_username = event.text
    limit = channel_username[6:9]
    print(limit)
    channel_username = channel_username[11:]
    print(channel_username)
    await eor(event, "Downloading Media From this Channel.")
    msgs = await borg.get_messages(channel_username, limit=int(limit))
    with open("log.txt", "w") as f:
        f.write(str(msgs))
    for msg in msgs:
        if msg.media is not None:
            await borg.download_media(msg, dir)
    ps = subprocess.Popen(("ls", "temp"), stdout=subprocess.PIPE)
Пример #29
0
import json
import os
import subprocess

import requests

from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern="labstack ?(.*)"))
@thunderbot.on(sudo_cmd(pattern="labstack ?(.*)", allow_sudo=True))
async def labstack(event):
    if event.fwd_from:
        return
    await eor(event, "Processing...")
    input_str = event.pattern_match.group(1)
    reply = await event.get_reply_message()
    if input_str:
        filebase = input_str
    elif reply:
        filebase = await event.client.download_media(
            reply.media, Var.TEMP_DOWNLOAD_DIRECTORY)
    else:
        await eor(
            event,
            "Reply to a media file or provide a directory to upload the file to labstack",
        )
        return
    filesize = os.path.getsize(filebase)
    filename = os.path.basename(filebase)
Пример #30
0
from telethon import functions

from thunderbot import CMD_HELP
from thunderbot.utils import admin_cmd


@thunderbot.on(admin_cmd(pattern=r"listmyusernames", outgoing=True))
async def _(event):
    if event.fwd_from:
        return
    result = await borg(functions.channels.GetAdminedPublicChannelsRequest())
    output_str = ""
    for channel_obj in result.chats:
        output_str += f"- {channel_obj.title} @{channel_obj.username} \n"
    await event.edit(output_str)


CMD_HELP.update(
    {
          "listmyreserved_usernames": ".listmyusernames\nUse - Shows all usernames you have reserved."
    }
)