예제 #1
0
"""Count Number of Files in a Chat
Original Module Credits: https://t.me/Unibot/127"""
from userbot import bot
from userbot.util import (admin_cmd, humanbytes, parse_pre, yaml_format)


@bot.on(admin_cmd(pattern="filecount ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    entity = event.chat_id
    input_str = event.pattern_match.group(1)
    if input_str:
        entity = input_str
    status_message = await event.reply("... this might take some time "
                                       "depending on the number of messages "
                                       "in the chat ...")
    mus = 0
    hmm = {}
    async for message in event.client.iter_messages(entity=entity, limit=None):
        if message and message.file:
            if message.file.mime_type not in hmm:
                hmm[message.file.mime_type] = 0
            hmm[message.file.mime_type] += message.file.size
    hnm = {key: humanbytes(hmm[key]) for key in hmm}
    await status_message.edit(yaml_format(hnm), parse_mode=parse_pre)
예제 #2
0
import asyncio
import os
from datetime import datetime

from gtts import gTTS

from sample_config import Config
from userbot import bot
from userbot.util import admin_cmd, run_command


@bot.on(admin_cmd(pattern="tts (.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    start = datetime.now()
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        text = previous_message.message
        lan = input_str
    elif "|" in input_str:
        lan, text = input_str.split("|")
    else:
        await event.edit("Invalid Syntax. Module stopping.")
        return
    text = text.strip()
    lan = lan.strip()
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    required_file_name = Config.TMP_DOWNLOAD_DIRECTORY + "voice.ogg"
예제 #3
0
import asyncio
import logging
import os
import time
import zipfile

from sample_config import Config
from userbot import bot
from userbot.util import admin_cmd, progress

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


@bot.on(admin_cmd(pattern=("zip ?(.*)")))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    mone = await event.edit("Processing ...")
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    if event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        try:
            c_time = time.time()
            downloaded_file_name = await bot.download_media(
                reply_message,
                Config.TMP_DOWNLOAD_DIRECTORY,
                progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
예제 #4
0
import time

from telethon.tl.functions.channels import LeaveChannelRequest

from userbot import bot
from userbot.util import admin_cmd


@bot.on(admin_cmd(pattern="leave", outgoing=True))
async def leave(e):
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        await e.delete()
        time.sleep(3)
        if '-' in str(e.chat_id):
            await bot(LeaveChannelRequest(e.chat_id))
        else:
            await e.edit('`This is Not A Chat`')
예제 #5
0
import time
from datetime import datetime

from sample_config import Config
from userbot import bot
from userbot.util import admin_cmd, progress

FF_MPEG_DOWN_LOAD_MEDIA_PATH = ".media.ffmpeg"

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

logger = logging.getLogger(__name__)


@bot.on(admin_cmd(pattern="ffmpegsave ?(.*)"))
async def ff_mpeg_save_cmd(event):
    if event.fwd_from:
        return
    if not os.path.exists(FF_MPEG_DOWN_LOAD_MEDIA_PATH):
        if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
            os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
        if event.reply_to_msg_id:
            start = datetime.now()
            reply_message = await event.get_reply_message()
            try:
                c_time = time.time()
                downloaded_file_name = await bot.download_media(
                    reply_message,
                    FF_MPEG_DOWN_LOAD_MEDIA_PATH,
                    progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
예제 #6
0
Syntax: .get_admin"""
import logging

from telethon.tl.types import (ChannelParticipantAdmin,
                               ChannelParticipantCreator,
                               ChannelParticipantsAdmins)

from userbot import bot
from userbot.util import admin_cmd

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


@bot.on(admin_cmd(pattern="get_ad(m)?in ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    mentions = "**Admins in this Channel**: \n"
    should_mention_admins = False
    reply_message = None
    pattern_match_str = event.pattern_match.group(1)
    if "m" in pattern_match_str:
        should_mention_admins = True
        if event.reply_to_msg_id:
            reply_message = await event.get_reply_message()
    input_str = event.pattern_match.group(2)
    to_write_chat = await event.get_input_chat()
    chat = None
    if input_str:
예제 #7
0
from sample_config import Config
from userbot import bot
from userbot.database.filtersdb import (add_filter, delete_all_filters,
                                        delete_filter, get_all_filters)
from userbot.util import admin_cmd

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

DELETE_TIMEOUT = 300
last_triggered_filters = {}


@bot.on(admin_cmd(incoming=True))
async def on_snip(event):
    name = event.text
    if (event.chat_id in last_triggered_filters
            and name in last_triggered_filters[event.chat_id]):
        # avoid userbot spam
        # "I demand rights for us bots, we are equal to you humans." -Henri Koivuneva (t.me/UserbotTesting/2698)
        return False
    snips = await get_all_filters(event.chat_id)
    if snips:
        for snip in snips:
            pattern = r"( |^|[^\w])" + \
                re.escape(snip['keyword']) + r"( |$|[^\w])"
            if re.fullmatch(pattern, name, flags=re.IGNORECASE):
                msg_o = await event.client.get_messages(
                    entity=Config.PRIVATE_CHANNEL_BOT_API_ID,
예제 #8
0
            err = response.get("error", None)
            if err is not None and ("rate" in err.get("message").lower()
                                    or resp.status >= 500):
                return await self.retry(
                    self.getFilesByParentId(folder_id, name, limit))
            for file in response.get('files', []):
                if limit and len(files) == limit:
                    return files
                files.append(file)
            page_token = response.get('nextPageToken', None)
            if page_token is None:
                break
        return files


@bot.on(admin_cmd(pattern="drivesearch ?(.*)", allow_sudo=True))
async def drivesch(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1).strip()
    drive = GDriveHelper()
    await drive.authorize(event)
    files = await drive.getFilesByParentId(Config.GDRIVE_FOLDER_ID, input_str,
                                           20)
    msg = f"**G-Drive Search Query**\n`{input_str}`\n**Results**\n"
    for file in files:
        if file.get("mimeType") == drive.G_DRIVE_DIR_MIME_TYPE:
            msg += "⁍ [{}]({}) (folder)".format(
                file.get('name'), drive.formatLink(file.get('id'))) + "\n"
        else:
            msg += "⁍ [{}]({}) ({})".format(
예제 #9
0
.rmblacklist"""

import io
import re

from sample_config import Config
from userbot import bot
from userbot.database.blacklistdb import (add_blacklist, blacklist_check_one,
                                          delete_one_blacklist,
                                          get_chat_blacklist,
                                          num_blacklist_filters,
                                          rm_from_blacklist)
from userbot.util import admin_cmd, is_admin


@bot.on(admin_cmd(incoming=True))
async def on_new_message(event):
    if await is_admin(event.client, event.chat_id, event.sender_id):
        return
    me = await bot.get_me()
    if me.id == event.sender_id:
        return
    name = event.raw_text
    snips = await get_chat_blacklist(event.chat_id)
    for snip in snips:
        pattern = r"( |^|[^\w])" + re.escape(snip['trigger']) + r"( |$|[^\w])"
        if re.search(pattern, name, flags=re.IGNORECASE):
            try:
                await event.delete()
            except Exception:
                await event.reply(
예제 #10
0
import io
import logging

from sample_config import Config
from telethon.tl import types
from userbot import bot
from userbot.database.snipsdb import add, check, check_one, delete_one
from userbot.util import admin_cmd

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


@bot.on(admin_cmd(pattern=r'\#(\S+)', outgoing=True))
async def on_snip(event):
    name = event.pattern_match.group(1)
    snip = await check_one(name)
    reply_message = await event.get_reply_message()
    if snip:
        await event.delete()
        msg_o = await event.client.get_messages(
            entity=Config.PRIVATE_CHANNEL_BOT_API_ID,
            ids=int(snip['Value'])
        )
        if msg_o.media is not None:
            if reply_message:
                await event.client.send_file(
                    event.chat_id,
                    msg_o.media,
예제 #11
0
import logging

import requests
from bs4 import BeautifulSoup
from userbot import bot
from userbot.util import admin_cmd

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


@bot.on(admin_cmd(pattern="hava ?(.*)"))
async def hava(event):
    if event.fwd_from:
        return
    sehir = event.pattern_match.group(1)
    try:
        mesaj = havaDurumu(sehir)
    except Exception as hata:
        mesaj = f"**Uuppss:**\n\n`{hata}`"
    try:
        await event.edit(mesaj)
    except Exception as hata:
        await event.edit(f"**Uuppss:**\n\n`{hata}`")


def havaDurumu(sehir):
    url = f"https://www.google.com/search?&q={sehir}+hava+durumu" + \
        "&lr=lang_tr&hl=tr"
예제 #12
0
to know how many users have seen your message
Syntax: .fwd as reply to any message"""

import logging

from sample_config import Config
from userbot import bot
from userbot.util import admin_cmd

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


@bot.on(admin_cmd(pattern="fwd"))
async def _(event):
    if event.fwd_from:
        return
    if Config.PRIVATE_CHANNEL_BOT_API_ID is None:
        await event.edit(
            "Please set the required environment variable `PRIVATE_CHANNEL_BOT_API_ID` "
            "for this plugin to work")
        return
    try:
        e = await event.client.get_entity(Config.PRIVATE_CHANNEL_BOT_API_ID)
    except Exception as e:
        await event.edit(str(e))
    else:
        re_message = await event.get_reply_message()
        # https://t.me/telethonofftopic/78166
예제 #13
0
from bwb import bwb
import asyncio

bwb = bwb.bwb(331210651)
wrap_users = {
    'c': 504501114,  # Creator of this UserBot 
    't': 79316791,  # Tanner, Creator of BWB
    'j': 172033414,  # Jason
    'o': 358491576,  # Jonas
    'm': 964048273,  # Mini Eule
    'g': 234480941,  # Twit
    'v': 181585055,  # Viktor
}


@bot.on(admin_cmd(pattern='!!+init'))
async def init(event):
    try:
        await event.respond('000000init ' + bwb.init())
    except:
        pass


@bot.on(admin_cmd(pattern=r"!!+add wrap (\S) ?(\d+)?"))
async def addwrap(event):
    try:
        nick = event.pattern_match.group(1)
        reply = await event.get_reply_message()
        if reply == None:
            usrid = event.pattern_match.group(2)
        else:
예제 #14
0
Available Commands:
.gban REASON
.ungban REASON"""
import logging

from sample_config import Config
from userbot import bot
from userbot.util import admin_cmd

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


@bot.on(admin_cmd(pattern="fban ?(.*)"))
async def _(event):
    if Config.G_BAN_LOGGER_GROUP is None:
        await event.edit("ENV VAR is not set. This module will not 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()
        r_from_id = r.forward.sender_id or r.sender_id if r.forward else r.sender_id
        await event.client.send_message(
            Config.G_BAN_LOGGER_GROUP, "!fban {} {}".format(r_from_id, reason))
    else:
        user_id = event.pattern_match.group(1)
        await event.client.send_message(Config.G_BAN_LOGGER_GROUP,
예제 #15
0
import random
import string
import requests
from random import randint
from telethon import events
from userbot.util import admin_cmd


@bot.on(admin_cmd(pattern="enaclk", outgoing=True))
async def enaclk(event):
    await event.edit("K...")

    @bot.on(
        events.NewMessage(pattern="http",
                          incoming=True,
                          func=lambda e: e.is_private))
    async def clkstart(m):
        person = await m.get_sender()
        user = person.first_name
        rantext = ''.join(
            random.choice(string.ascii_lowercase + string.digits)
            for _ in range(7))
        api_token = '32f9105a8194b5596482f0ed9631ab1483ec171e'
        req = requests.get(
            'https://urlshortx.com//api?api={}&url={}&alias={}'.format(
                api_token, m.text, rantext)).json()
        if (req["status"] == 'error'):
            smsg = req["message"]
        else:
            smsg = req["shortenedUrl"]
예제 #16
0
import time

from telethon import events
from telethon.errors import FloodWaitError
from telethon.tl import functions
from userbot import bot
from sample_config import Config
from userbot.util import admin_cmd, humanbytes, progress, time_formatter

DEL_TIME_OUT = 3
logging.basicConfig(
    format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
    level=logging.WARNING)


@bot.on(admin_cmd(pattern=r"ch ?(.*)"))
async def get_media(event):
    # chat = -1001285905728
    chat = await event.client.get_entity('t.me/joinchat/AAAAAEylXUB6ztFxdgHp1w'
                                         )
    mesajlar = []
    print("kanaldan rastgele mesaj seçiliyor.")
    await event.edit("kanaldan rastgele link seçiliyor.")
    async for message in bot.iter_messages(chat):
        mesajlar.append(message.id)

    secim = int(random.choice(mesajlar))
    #     print(secim)
    x = await bot.forward_messages(
        entity=await event.client.get_entity('https://t.me/deryaaq#1'),
        messages=secim,
예제 #17
0
async def _(event):
    if not event.message.is_reply:
        who = await event.get_chat()
    else:
        msg = await event.message.get_reply_message()
        if msg.forward:
            # FIXME forward privacy memes
            who = await bot.get_entity(msg.forward.sender_id
                                       or msg.forward.channel_id)
        else:
            who = await msg.get_sender()

    await event.edit(get_who_string(who), parse_mode='html')


@bot.on(admin_cmd(pattern="members ?(.*)"))
async def _(event):
    members = []
    async for member in bot.iter_participants(event.chat_id):
        if not member.deleted and not member.bot:
            messages = await bot.get_messages(event.chat_id,
                                              from_user=member,
                                              limit=0)
            members.append((messages.total,
                            f"{messages.total} - {get_who_string(member)}\n"))
    members = (m[1] for m in sorted(members, key=lambda m: m[0], reverse=True))
    members = "".join(members)
    try:
        await event.reply(members, parse_mode='html')
    except MessageTooLongError:
        for m in split_message(members):
import logging
import os
from datetime import datetime

from sample_config import Config
from telethon.tl import functions
from userbot import bot
from userbot.util import admin_cmd

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


@bot.on(admin_cmd(pattern="pbio (.*)"))  # pylint:disable=E0602
async def _(event):
    if event.fwd_from:
        return
    bio = event.pattern_match.group(1)
    try:
        await bot(functions.account.UpdateProfileRequest(about=bio))
        await event.edit("Succesfully changed my profile bio")
    except Exception as e:  # pylint:disable=C0103,W0703
        await event.edit(str(e))


@bot.on(admin_cmd(pattern="pname ((.|\n)*)"))  # pylint:disable=E0602,W0703
async def _(event):
    if event.fwd_from:
        return
예제 #19
0
                return z.extract(eleman)
            except zipfile.error as hata:
                return hata

# HACK :)------------------------------------------------


def opened_zip(zip_yolu: str):
    for adres in os.walk(zip_yolu.split('.zip')[0]):
        # 2. İndex Dosyalara Denk Geliyor!
        if adres[2]:
            for dosya in adres[2]:
                return f"{adres[0]}/{dosya}"


@bot.on(admin_cmd(pattern="unzip"))
async def _(event):
    if event.fwd_from:
        return
    mone = await event.edit("Processing ...")
    extracted = Config.TMP_DOWNLOAD_DIRECTORY + "extracted/"
    thumb_image_path = Config.TMP_DOWNLOAD_DIRECTORY + "/thumb_image.jpg"
    if not os.path.isdir(extracted):
        os.makedirs(extracted)
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    if event.reply_to_msg_id:
        start = datetime.now()
        reply_message = await event.get_reply_message()
        try:
            c_time = time.time()
예제 #20
0
"""Evaluate Python Code inside Telegram
Syntax: .eval PythonCode"""
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import io
import sys
import traceback

from sample_config import Config
from userbot import bot
from userbot.util import admin_cmd


@bot.on(admin_cmd(pattern="eval"))
async def _(event):
    if event.fwd_from or event.via_bot_id:
        return
    await event.edit("Processing ...")
    cmd = event.text.split(" ", maxsplit=1)[1]
    reply_to_id = event.message.id
    if event.reply_to_msg_id:
        reply_to_id = event.reply_to_msg_id

    old_stderr = sys.stderr
    old_stdout = sys.stdout
    redirected_output = sys.stdout = io.StringIO()
    redirected_error = sys.stderr = io.StringIO()
    stdout, stderr, exc = None, None, None
예제 #21
0
import aiohttp
import magic
import requests

from sample_config import Config
from userbot import bot
from userbot.util import admin_cmd, progress

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


@bot.on(admin_cmd(pattern="verystream ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    mone = await event.edit("Processing ...")
    if Config.VERY_STREAM_LOGIN is None or Config.VERY_STREAM_KEY is None:
        await mone.edit(
            "This module requires API key from https://verystream.com. Aborting!"
        )
        return False
    input_str = event.pattern_match.group(1)
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    required_file_name = None
    start = datetime.now()
    if event.reply_to_msg_id and not input_str:
    with open('log.txt', 'w') as f:
        f.write(str(msgs))
    for msg in msgs:
        if msg.media is not None:
            await bot.download_media(
                msg, dir)
    ps = subprocess.Popen(('ls', 'temp'), stdout=subprocess.PIPE)
    output = subprocess.check_output(('wc', '-l'), stdin=ps.stdout)
    ps.wait()
    output = str(output)
    output = output.replace("b'", "")
    output = output.replace("\n'", "")
    await event.edit("Downloaded "+output+" files.")


@bot.on(admin_cmd(pattern="geta ?(.*)", allow_sudo=True))
async def get_media(event):
    if event.fwd_from:
        return
    count = 0
    os.makedirs(directory, exist_ok=True)
    channel = event.pattern_match.group(1)
    try:
        channel = int(channel)
    except ValueError:
        pass
    await event.edit("Downloading All Media From this Channel.")
    msgs = await bot.get_messages(channel, limit=3000)
    for msg in msgs:
        if msg.media is not None:
            try:
예제 #23
0
import os
from datetime import datetime

import requests

from sample_config import Config
from userbot import bot
from userbot.util import admin_cmd

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


@bot.on(admin_cmd(pattern="stt (.*)"))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    input_str = event.pattern_match.group(1)
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    await event.edit("Downloading to my local, for analysis 🙇")
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        required_file_name = await bot.download_media(
            previous_message, Config.TMP_DOWNLOAD_DIRECTORY)
        lan = input_str
        if Config.IBM_WATSON_CRED_URL is None or Config.IBM_WATSON_CRED_PASSWORD is None:
            await event.edit(
예제 #24
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(admin_cmd(pattern="weather ?(.*)"))
async def fetch_weather(weather):
    """ For .weather command, gets the current weather of a city. """
    if Config.OPEN_WEATHER_MAP_APPID is None:
        await weather.edit("Please set OPEN_WEATHER_MAP_APPID")
        return

    OpenWeatherAPI = Config.OPEN_WEATHER_MAP_APPID
    saved_props = await get_weather()

    if not weather.pattern_match.group(1):
        if 'weather_city' in saved_props:
            city = saved_props['weather_city']
        else:
            await weather.edit("`Please specify a city or set one as default.`"
                               )
예제 #25
0
async def update_token():
    sptoken = st.start_session(sp_dc, sp_key)
    access_token = sptoken[0]
    environ["spftoken"] = access_token
    environ["errorcheck"] = "1"
    await update_spotify_info()


async def dirtyfix():
    global SPOTIFYCHECK
    SPOTIFYCHECK = True
    await sleep(4)
    await update_spotify_info()


@bot.on(admin_cmd(pattern="enablespotify ?(.*)"))  # pylint:disable=E0602
async def set_biostgraph(setstbio):
    setrecursionlimit(700000)
    if not SPOTIFYCHECK:
        environ["errorcheck"] = "0"
        await setstbio.edit(SPO_BIO_ENABLED)
        await get_spotify_token()
        await dirtyfix()
    else:
        await setstbio.edit(SPO_BIO_RUNNING)


@bot.on(admin_cmd(pattern="disablespotify ?(.*)"))  # pylint:disable=E0602
async def set_biodgraph(setdbio):
    global SPOTIFYCHECK
    global RUNNING
예제 #26
0
import logging
logging.basicConfig(
    format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
    level=logging.WARNING)
from telethon import events
from datetime import datetime
from userbot.util import admin_cmd
from userbot import bot


@bot.on(admin_cmd(pattern="linkler"))
async def _(event):
    await event.delete()
    for a in range(1, 2):
        await bot.send_message(
            event.chat_id,
            "========KANALLARIMIZ========\n1: https://t.me/joinchat/AAAAAEylXUB6ztFxdgHp1w \n2: https://t.me/deryanin_linkleri\n3: https://t.me/joinchat/AAAAAEv_bBx6bl0AEojIJA \n4: https://t.me/joinchat/AAAAAESgf0f1wctsKPJ0cg \n5: https://t.me/joinchat/AAAAAE_oUYlNq2c45oQRlQ\n6: https://t.me/joinchat/AAAAAFebp6PIGgUeAC8DWA\n7: https://t.me/joinchat/AAAAAE9kOnXSwSOitjpjJA\n8: https://t.me/joinchat/AAAAAFO7l8-6EIxXJsRHkg\n9: https://t.me/joinchat/AAAAAEzIWLtq3-pUg9G9fA\n10: https://t.me/joinchat/AAAAAEUnlnmhE4z26NdxvQ\n11: https://t.me/joinchat/AAAAAFehN1YfV3UYs0YsRw \n12: https://t.me/joinchat/AAAAAFgeWypj9goHR6g6bg      \n \n=====SOHBET GRUPLARIMIZ=====\n1: https://t.me/deryanin_mekani \n2: https://t.me/joinchat/PrW4fBcmiV-qpqdtBwdYsQ\n3: https://t.me/joinchat/PrW4fE99MRNqBiUYBKUXLw\n\n=====VİDEO KANALLARIMIZ=====\n1: https://t.me/joinchat/AAAAAFeV963Az-qZVyFvig"
        )
예제 #27
0
import patoolib

from sample_config import Config
from userbot import bot
from userbot.util import admin_cmd, progress

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

extracted = Config.TMP_DOWNLOAD_DIRECTORY + "extracted/"
thumb_image_path = Config.TMP_DOWNLOAD_DIRECTORY + "/thumb_image.jpg"


@bot.on(admin_cmd(pattern=("rar ?(.*)")))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    mone = await event.edit("Processing ...")
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    if event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        try:
            c_time = time.time()
            downloaded_file_name = await bot.download_media(
                reply_message,
                Config.TMP_DOWNLOAD_DIRECTORY,
                progress_callback=lambda d, t: asyncio.get_event_loop().
예제 #28
0
from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
from sample_config import Config
from telethon.tl.types import DocumentAttributeVideo
from userbot import bot
from userbot.util import admin_cmd, progress

logging.basicConfig(
    format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
    level=logging.WARNING)
logger = logging.getLogger(__name__)
# thumb_image_path = Config.TMP_DOWNLOAD_DIRECTORY + "thumb_image.jpg"


@bot.on(admin_cmd(pattern="converttovideo ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    mone = await event.edit("Processing ...")
    input_str = event.pattern_match.group(1)
    thumb = None
    thumb_image_path = Config.TMP_DOWNLOAD_DIRECTORY + "thumb_image.jpg"
    logger.info(thumb_image_path)
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    if event.reply_to_msg_id:
        start = datetime.now()
        reply_message = await event.get_reply_message()
        try:
            c_time = time.time()
예제 #29
0

async def update_requirements():
    reqs = str(requirements_path)
    try:
        process = await asyncio.create_subprocess_shell(
            ' '.join([sys.executable, "-m", "pip", "install", "-r", reqs]),
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE)
        await process.communicate()
        return process.returncode
    except Exception as e:
        return repr(e)


@bot.on(admin_cmd(pattern="update ?(.*)"))
async def upstream(ups):
    "For .update command, check if the bot is up to date, update if specified"
    await ups.edit("`Checking for updates, please wait....`")
    conf = ups.pattern_match.group(1)
    off_repo = Config.UPSTREAM_REPO_URL
    force_update = False

    try:
        txt = "`Oops.. Updater cannot continue due to "
        txt += "some problems occured`\n\n**LOGTRACE:**\n"
        repo = Repo(search_parent_directories=True)
    except NoSuchPathError as error:
        await ups.edit(f'{txt}\n`directory {error} is not found`')
        repo.__del__()
        return
예제 #30
0
built by @r4v4n4 , isse bhi loot lo betichod"""
from userbot import CMD_HELP, BOTLOG, BOTLOG_CHATID,client

from userbot.events import javes05, bot, rekcah05

javes = client = bot
from telethon import events

import asyncio

from userbot.util import admin_cmd
from userbot import tebot as tgbot
from userbot import bot as borg


@borg.on(admin_cmd(pattern=r"fdance"))

async def _(event):

    if event.fwd_from:

        return

    animation_interval = 1

    animation_ttl = range(0, 5)

    #input_str = event.pattern_match.group(1)

  #  if input_str == "isro":