コード例 #1
0
ファイル: modules.py プロジェクト: cheems/BEASTBOT-REBORN
async def _(event):
    if event.fwd_from:
        return
    modules = "**List of available modules({0}):**\n".format(len(MODULE_LIST))
    MODULE_LIST.sort()
    prev = "1"
    for module in MODULE_LIST:
        if prev[0] != module[0]:
            modules += f"\t{module[0].upper()}\t\n"
        modules += f"~ ```{module}```\n"
        prev = module
    modules += "\n\n**Tip --> Use .syntax <module_name> for more info.**"
    await event.edit(modules)
コード例 #2
0
async def _(event):
    if event.fwd_from:
        return
    modules = "**List of available modules:**\n"
    MODULE_LIST.sort()
    prev = "1"
    num = 0
    for module in MODULE_LIST:
        num += 1
        if prev[0] != module[0]:
            modules += f"\n\n\t{module[0].upper()}\n\n"
        modules += f"~ ```{module}```\n"
        prev = module
    modules += f"**\n\nNumber of modules loaded: {num}**\n**Tip: Use .syntax <module_name> for more info.**"
    await event.edit(modules)
コード例 #3
0
# For UniBorg
# Syntax .py <code>
# 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/.

from telethon import events, errors, functions, types
import inspect
import traceback
import asyncio
import sys
import io
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("python")


@borg.on(admin_cmd(pattern="py"))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("Hmm, nice code..")
    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()
コード例 #4
0
ファイル: coinflip.py プロジェクト: suffiny2/The-TG-Bot-2.0
# For UniBorg
# Syntax .coinflip
from telethon import events
import random, re
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("coinflip")


@borg.on(admin_cmd("coinflip ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    r = random.randint(1, 100)
    input_str = event.pattern_match.group(1)
    if input_str:
        input_str = input_str.lower()
    if r % 2 == 1:
        if input_str == "heads":
            await event.edit("**Heads**. \n You were correct.")
        elif input_str == "tails":
            await event.edit("**Heads**. \n Better luck next time!...")
        else:
            await event.edit("**Heads**.")
    elif r % 2 == 0:
        if input_str == "tails":
            await event.edit("**Tails**. \n You were correct.")
        elif input_str == "heads":
            await event.edit("**Tails**. \n Better luck next time!...")
        else:
コード例 #5
0
ファイル: speedtest.py プロジェクト: cheems/BEASTBOT-REBORN
"""Check your internet speed powered by speedtest.net
Syntax: .speedtest
Available Options: image, file, text"""
from telethon import events
from datetime import datetime
import io
import speedtest
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("speedtest")


@borg.on(admin_cmd("speedtest ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    as_text = True
    as_document = False
    if input_str == "image":
        as_document = False
    elif input_str == "file":
        as_document = True
    elif input_str == "text":
        as_text = True
    await event.edit("`Calculating my internet speed. Please wait!`")
    start = datetime.now()
    s = speedtest.Speedtest()
    s.get_best_server()
    s.download()
コード例 #6
0
# For UniBorg
# Syntax .restart
# This Source Code Form is subject to the terms of the GNU
# General Public License, v.3.0. If a copy of the GPL was not distributed with this
# file, You can obtain one at https://www.gnu.org/licenses/gpl-3.0.en.html
from telethon import events
import asyncio
import os
import sys
from uniborg.util import admin_cmd
import time
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("restart")


@borg.on(admin_cmd("restart"))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("Restarting...\n█████░░░")
    time.sleep(1)
    await event.edit("Restarting...\n████████")
    time.sleep(1)
    await event.edit("Restart Complete!\nSend .alive or .ping to check if i am online.")
    await borg.disconnect()
    # https://archive.is/im3rt
    os.execl(sys.executable, sys.executable, *sys.argv)
    # You probably don't need it but whatever
    quit()
コード例 #7
0
ファイル: report.py プロジェクト: cheems/BEASTBOT-REBORN
# For UniBorg
# Syntax .admins
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins, ChannelParticipantAdmin, ChannelParticipantCreator
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("report")


@borg.on(admin_cmd("admins ?(.*)"))
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 not input_str:
        chat = to_write_chat
    else:
        mentions_heading = "Admins in {} channel: \n".format(input_str)
        mentions = mentions_heading
        try:
コード例 #8
0
ファイル: type.py プロジェクト: suffiny2/The-TG-Bot-2.0
# For UniBorg
# Syntax .type <text>

from telethon import events
import asyncio
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST


MODULE_LIST.append("type")

@borg.on(events.NewMessage(pattern=r"\.type (.*)", outgoing=True))
async def _(event):
    if event.fwd_from:
        return
    # https://t.me/AnotherGroup/176551
    input_str = event.pattern_match.group(1)
    typing_symbol = "|"
    DELAY_BETWEEN_EDITS = 0.3
    previous_text = ""
    await event.edit(typing_symbol)
    await asyncio.sleep(DELAY_BETWEEN_EDITS)
    for character in input_str:
        previous_text = previous_text + "" + character
        typing_text = previous_text + "" + typing_symbol
        await event.edit(typing_text)
        await asyncio.sleep(DELAY_BETWEEN_EDITS)
        await event.edit(previous_text)
        await asyncio.sleep(DELAY_BETWEEN_EDITS)


コード例 #9
0
# For UniBorg
# Syntax (.afk <optional reason>)"
import asyncio
import datetime
from telethon import events
from telethon.tl import functions, types
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

borg.storage.USER_AFK = {}  # pylint:disable=E0602
borg.storage.afk_time = None  # pylint:disable=E0602
borg.storage.last_afk_message = {}  # pylint:disable=E0602

MODULE_LIST.append("afk")


@borg.on(events.NewMessage(outgoing=True))  # pylint:disable=E0602
async def set_not_afk(event):
    current_message = event.message.message
    if ".afk" not in current_message and "yes" in borg.storage.USER_AFK:  # pylint:disable=E0602
        try:
            status = "Set AFK mode to False"
            await log(status)
        except Exception as e:  # pylint:disable=C0103,W0703
            await borg.send_message(  # pylint:disable=E0602
                event.chat_id,
                "Please set `PRIVATE_GROUP_BOT_API_ID` " + \
                "for the proper functioning of afk functionality " + \
                "in @UniBorg\n\n `{}`".format(str(e)),
                reply_to=event.message.id,
                silent=True
            )
コード例 #10
0
ファイル: dagd.py プロジェクト: pravinprvs/The-TG-Bot-2.0
# For UniBorg
# Syntax shorten, unshorten

from telethon import events
import os
import requests
import json
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("dgad")


@borg.on(admin_cmd(pattern="shorten (.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    sample_url = "https://da.gd/s?url={}".format(input_str)
    response_api = requests.get(sample_url).text
    if response_api:
        await event.edit("Generated {} for {}.".format(response_api,
                                                       input_str))
    else:
        await event.edit("Error! Please try again later")


@borg.on(admin_cmd(pattern="unshorten (.*)"))
async def _(event):
    if event.fwd_from:
        return
コード例 #11
0
ファイル: gali.py プロジェクト: kumarvincent/PM
# For UniBorg
# By authoritydmc
# Based on the insult module made by Hackintosh for friendly telegram bot (https://da.gd/RG2hfe)
# Syntax (.gali <no_of_times_to_insult>)
from telethon import events
from uniborg.util import admin_cmd
import asyncio
from telethon.tl import functions, types
import random
from sql_helpers.global_variables_sql import LOGGER, SUDO_USERS, SYNTAX, MODULE_LIST
import sys
import time

MODULE_LIST.append("gali")

@borg.on(admin_cmd(pattern="gali ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    args = event.pattern_match.group(1)
    animal = ["मच्छर ","\
हाथी","गिरगिट", "गैंडा","खरगोश","बंदर ","लंगूर","सॉढ","सियार","बतख","गोरिल्ला"," नेवला","खटमल","घोंघा","छछून्‍दर"]
    parts=["लुंड ","झाट","चुत","गांड ","गांड का कीड़ा","औलाद","दामाद","भाई"]
    man_slang=["बहनचोद","मादरचोद","बहिन के लौड़े","बहिन के टक्के","बेटीचोद "]
    starts = ["क्या रे", "तुम", "अबे सुन चूतिये ", "साले ",
              "वो उलटी दिमाग के पैदाइश साले "]
    ends = ["!!!!", "!", ""]
    log_insults = ""
    insults=""
    if args:
        pass
コード例 #12
0
# .listai // Outputs List Of Currently added Users in AI Auto-Chat.
# Credits:
# @Hackintosh5 (for inspiring me to write this module)
# @Zero_cool7870 (For Writing The Original Module)
# Zi Xing (For CoffeeHouse API)

import coffeehouse as cf

import asyncio
import io
from sql_helpers.lydia_ai_sql import get_s, get_all_s, add_s, remove_s
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST
from time import time
from uniborg.util import admin_cmd

MODULE_LIST.append("lydia")

if Config.LYDIA_API is not None:
    api_key = Config.LYDIA_API
    # Initialise client
    api_client = cf.API(api_key)


@borg.on(admin_cmd(pattern="(enable|disable|list)ai", allow_sudo=True))
async def lydia_disable_enable(event):
    if event.fwd_from:
        return
    if Config.LYDIA_API is None:
        await event.edit("please add required `LYDIA_API` env var")
        return
    if event.reply_to_msg_id is not None:
コード例 #13
0
import asyncio
from datetime import datetime
from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
import json
import os
import requests
import subprocess
from telethon import events
from telethon.tl.types import DocumentAttributeVideo
from telethon.errors import MessageNotModifiedError
import time
from uniborg.util import progress, humanbytes, time_formatter, admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("rename")


@borg.on(admin_cmd("rename (.*)"))
async def _(event):
    if event.fwd_from:
        return
    thumb = None
    await event.edit(f"Downloading file to local machine..\nThis may take a while depending on the file size.")
    time.sleep(1)
    input_str = event.pattern_match.group(1)
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    if event.reply_to_msg_id:
        start = datetime.now()
        file_name = input_str
コード例 #14
0
ファイル: ping.py プロジェクト: suffiny2/The-TG-Bot-2.0
from telethon import events
from datetime import datetime
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("ping")


@borg.on(admin_cmd("ping"))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    await event.edit("Pong!")
    end = datetime.now()
    ms = (end - start).microseconds / 1000
    await event.edit("Pong!\n{}".format(ms))


SYNTAX.update({
    "ping":
    "\
**Requested Module --> ping**\
\n\n**Detailed usage of fuction(s):**\
\n\n```.ping```\
\nUsage: Check your internet connection's ping speed.\
"
})
コード例 #15
0
# For UniBorg
# By Priyam Kalra
# Based on the insult module made by Hackintosh for friendly telegram bot (https://da.gd/RG2hfe)
# Syntax (.insult <no_of_times_to_insult>)
from telethon import events
from uniborg.util import admin_cmd
import asyncio
from telethon.tl import functions, types
import random
from sql_helpers.global_variables_sql import SUDO_USERS, SYNTAX, MODULE_LIST
import sys
import time

MODULE_LIST.append("insult")


@borg.on(admin_cmd(pattern="insult ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    args = event.pattern_match.group(1)
    adjectives_start = [
        "salty", "fat", "f*****g", "shitty", "stupid", "retarded",
        "self conscious", "tiny"
    ]
    adjectives_mid = [
        "little", "vitamin D deficient", "idiotic", "incredibly stupid"
    ]
    nouns = [
        "c**t", "pig", "pedophile", "beta male", "bottom", "retard",
        "ass licker", "c**t nugget", "PENIS", "dickhead", "flute", "idiot",
コード例 #16
0
from telethon import events
import subprocess
from telethon.errors import MessageEmptyError, MessageTooLongError, MessageNotModifiedError
import io
import asyncio
import time
from uniborg.util import admin_cmd
import glob
import os
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST
try:
    import instantmusic, subprocess
except:
    os.system("pip install instantmusic")

MODULE_LIST.append("song")

os.system("rm -rf *.mp3")


def bruh(name):

    os.system("instantmusic -q -s " + name)


@borg.on(admin_cmd(pattern="song ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    DELAY_BETWEEN_EDITS = 0.3
    PROCESS_RUN_TIME = 100
コード例 #17
0
ファイル: bots.py プロジェクト: suffiny2/The-TG-Bot-2.0
# For UniBorg
# Syntax .bots
from telethon import events
from telethon.tl.types import ChannelParticipantAdmin, ChannelParticipantsBots
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("bots")


@borg.on(admin_cmd("bots ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    mentions = "**Bots in this Channel**: \n"
    input_str = event.pattern_match.group(1)
    to_write_chat = await event.get_input_chat()
    chat = None
    if not input_str:
        chat = to_write_chat
    else:
        mentions = "Bots in {} channel: \n".format(input_str)
        try:
            chat = await borg.get_entity(input_str)
        except Exception as e:
            await event.edit(str(e))
            return None
    try:
        async for x in borg.iter_participants(chat,
                                              filter=ChannelParticipantsBots):
            if isinstance(x.participant, ChannelParticipantAdmin):
コード例 #18
0
from datetime import datetime
from telethon import events
from uniborg.util import admin_cmd, progress, humanbytes
from mimetypes import guess_type
from apiclient.discovery import build
from apiclient.http import MediaFileUpload
from apiclient.errors import ResumableUploadError
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.file import Storage
from oauth2client import file, client, tools
from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
from telethon.tl.types import DocumentAttributeVideo, DocumentAttributeAudio
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("leech")
MODULE_LIST.append("leech2drive")
MODULE_LIST.append("leech2tg")

cmd = "aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800  --max-connection-per-server=10 --rpc-max-request-size=1024M --seed-time=0.01 --min-split-size=10M --follow-torrent=mem --split=10 --daemon=true"

aria2_is_running = os.system(cmd)

aria2 = aria2p.API(aria2p.Client(
    host="http://localhost", port=6800, secret=""))

EDIT_SLEEP_TIME_OUT = 10

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

if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
コード例 #19
0
# For UniBorg
# By Priyam Kalra
# Syntax (.syntax <module_name>)
from telethon import events
from uniborg.util import admin_cmd
import asyncio
from telethon.tl import functions, types
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("syntax")


@borg.on(admin_cmd(pattern="syntax ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    module = event.pattern_match.group(1)
    if module:
        if module in SYNTAX:
            await event.edit(SYNTAX[module])
        else:
            await event.edit("Please specify a valid module.")
    else:
        await event.edit(
            "Please specify a module.\n**Tip: Get a list of all modules using .modules**"
        )
コード例 #20
0
# For UniBorg
# By Priyam Kalra
# Based on the note module made by RaphielGang (https://da.gd/X4Mnf)
# Syntax (.save <notename>, .get <notename>, .clear <notename>, .clearall)

from sql_helpers.global_variables_sql import LOGGER, SYNTAX, MODULE_LIST
from sql_helpers.notes_sql import get_notes, rm_note, add_note, rm_all_notes
from telethon import events
from uniborg.util import admin_cmd
import asyncio, time
from telethon.tl import functions, types

MODULE_LIST.append("notes")


@borg.on(admin_cmd(pattern="notes ?(.*)"))
async def _(svd):
    if svd.fwd_from:
        return
    notes = get_notes(svd.chat_id)
    message = "**There are no saved notes in this chat.**"
    if notes:
        message = "**Notes saved in this chat:** \n\n"
        for note in notes:
            message = message + "**~** " + note.keyword + "\n"
    await svd.edit(message)


@borg.on(admin_cmd(pattern="clear ?(.*)"))
async def _(clr):
    if clr.fwd_from:
コード例 #21
0
ファイル: pmpermit.py プロジェクト: kumarvincent/GoodOne
# For UniBorg
# Syntax (.approve, .block)

import asyncio
import json
from telethon import events
from telethon.tl import functions, types
from sql_helpers.pmpermit_sql import is_approved, approve, disapprove, get_all_approved
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST, SUDO_USERS
from uniborg.util import admin_cmd

MODULE_LIST.append("pmpermit")
borg.storage.PM_WARNS = {}
borg.storage.PREV_REPLY_MESSAGE = {}
CONTINOUS_MSG_COUNT = 0  #for bot and spam protection
#for bot verification
UNIBORG_USER_BOT_WARN_ZERO = "```Blocked! Thanks for the spam.```"
UNIBORG_USER_BOT_NO_WARN = """```
Hee HAA! This is a bot. Don't fret.\nMy Boss Shiv hasn't approved you to PM.\nPlease
 wait for my Boss Shiv to look in, he mostly approves PMs.\n
Wait some Time ,until Shiv approves you!!!
```\n

"""


@borg.on(events.NewMessage(incoming=True, func=lambda e: e.is_private))
async def monito_p_m_s(event):
    sender = await event.get_sender()
    current_message_text = event.message.message.lower()
    PREVIOUS_MSG = current_message_text
コード例 #22
0
""" Powered by @Google
Available Commands:
.google search <query>
.google image <query>
.google reverse search"""

import asyncio
import os
import requests
from bs4 import BeautifulSoup
from datetime import datetime
from google_images_download import google_images_download
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST
MODULE_LIST.append("go(google search)")


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


@borg.on(admin_cmd(pattern="go (.*)"))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    await event.edit("Processing ...")
    # SHOW_DESCRIPTION = False
    input_str = event.pattern_match.group(
        1
コード例 #23
0
ファイル: kang.py プロジェクト: suffiny2/The-TG-Bot-2.0
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from telethon.tl.functions.messages import GetStickerSetRequest
from telethon.tl.types import (
    DocumentAttributeFilename,
    DocumentAttributeSticker,
    InputMediaUploadedDocument,
    InputPeerNotifySettings,
    InputStickerSetID,
    InputStickerSetShortName,
    MessageMediaPhoto
)
from uniborg.util import admin_cmd



MODULE_LIST.append("kang")

@borg.on(admin_cmd(pattern="kang ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    if not event.is_reply:
        await event.edit("Reply to a photo to add to my personal sticker pack.")
        return
    reply_message = await event.get_reply_message()
    sticker_emoji = "🔥"
    input_str = event.pattern_match.group(1)
    if input_str:
        sticker_emoji = input_str

    me = borg.me
コード例 #24
0
import aiohttp
import asyncio
import math
import os
import time
import requests
from datetime import datetime
from pySmartDL import SmartDL
from telethon import events
from telethon.tl.types import DocumentAttributeVideo
from uniborg.util import admin_cmd, humanbytes, progress, time_formatter
from telethon.errors.rpcerrorlist import MessageNotModifiedError
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST, DL

MODULE_LIST.append("download")


@borg.on(admin_cmd(pattern="directdl ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    args = event.pattern_match.group(1)
    args_split = args.split("/")
    name = args_split[-1]
    await event.edit(f"Trying to download {name} from {args}..\nThere is no progress bar to ensure fastest downloaded speeds & no telegram account limitations\nYou can run a speedtest and estimate the download time.")
    request = requests.get(args)
    path = DL + name
    with open(path, "wb") as f:
        f.write(request.content)
        await event.edit(f"Downloaded {name} to {path}.")
コード例 #25
0
# For UniBorg
# By Priyam Kalra
# Syntax (.rmota <device_model>)
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST
from telethon import events
from telethon.tl import functions, types
from uniborg.util import admin_cmd

MODULE_LIST.append("rmota")


@borg.on(admin_cmd(pattern="rmota ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    if input_str:
        if input_str.startswith("RM") or input_str.startswith("CPH"):
            model = input_str
        else:
            await event.edit(
                "**ERROR: Please enter a valid device model name!**")
            return
    else:
        await event.edit("**ERROR: Please enter a valid device model name!**")
        return
    bot = "@realmeupdaterbot"
    await event.edit(f"```Looking for latest OTA for {model}...```")

    async with borg.conversation(bot) as bot_conv:
        if True:
コード例 #26
0
ファイル: share.py プロジェクト: shyam1162/The-TG-Bot-2.0
# For UniBorg
# Syntax .file <location>, .dir <location>
import asyncio
import os
import subprocess
import time
from datetime import datetime
from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
from telethon import events
from telethon.tl.types import DocumentAttributeVideo
from telethon.tl.types import DocumentAttributeAudio
from uniborg.util import progress, admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("share")

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


def get_lst_of_files(input_directory, output_lst):
    filesinfolder = os.listdir(input_directory)
    for file_name in filesinfolder:
        current_file_name = os.path.join(input_directory, file_name)
        if os.path.isdir(current_file_name):
            return get_lst_of_files(current_file_name, output_lst)
        output_lst.append(current_file_name)
    return output_lst


@borg.on(admin_cmd(pattern="share (.*)", allow_sudo=True))
コード例 #27
0
# For UniBorg
# Syntax .alive
import sys
from telethon import events, functions, __version__, utils
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST
import platform
import psutil
import os

MODULE_LIST.append("alive")

BUILD = "-70x05"


@borg.on(admin_cmd(pattern="alive ?(.*)", allow_sudo=True))  # pylint:disable=E0602
async def _(event):
    if event.fwd_from:
        return
    user_first_name = "set Firstname in your Profile"
    user_last_name = "set lastName in your profile"
    userobj = None
    user_name = ""
    try:
        userobj = await borg.get_me()
    except:
        userobj = None
    try:
        user_name = userobj.username
        user_first_name = userobj.first_name
        if user_first_name is None:
コード例 #28
0
# For UniBorg
# Syntax .bash <code>
# 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/.
from telethon import events
import subprocess
from telethon.errors import MessageEmptyError, MessageTooLongError, MessageNotModifiedError
import io
import asyncio
import time
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("bash")


@borg.on(admin_cmd(pattern="bash ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    DELAY_BETWEEN_EDITS = 0.3
    PROCESS_RUN_TIME = 100
    arg = event.pattern_match.group(1)
    if not arg:
        arg = "@@@"
    abe = await event.get_reply_message()
    cmd = abe.text
    if "f" in arg:
        arg = True
    else:
コード例 #29
0
# For UniBorg
# Syntax (.promote <optional_rank>, .demote, .ban, .unban, .mute, .unmute, .kick as a reply to a user's msg)
from telethon import events
from telethon.tl import functions, types
from telethon.tl.functions.channels import EditAdminRequest, EditBannedRequest
from telethon.tl.types import ChatAdminRights, ChatBannedRights
import asyncio
from datetime import datetime
from uniborg.util import admin_cmd
from sql_helpers.global_variables_sql import SUDO_USERS, SYNTAX, MODULE_LIST
import sys

MODULE_LIST.append("admin")

@borg.on(admin_cmd(pattern="promote ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    if input_str != "":
        admin_rank = input_str
    else:
        admin_rank = ""
    start = datetime.now()
    to_promote_id = None
    rights = ChatAdminRights(
        change_info=True,
        post_messages=True,
        edit_messages=True,
        delete_messages=True,
        ban_users=False,
コード例 #30
0
ファイル: upload.py プロジェクト: suffiny2/The-TG-Bot-2.0
# For UniBorg
# Syntax .file <location>, .dir <location>
import asyncio
import os
import subprocess
import time
from datetime import datetime
from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
from telethon import events
from telethon.tl.types import DocumentAttributeVideo
from telethon.tl.types import DocumentAttributeAudio
from uniborg.util import progress, admin_cmd
from sql_helpers.global_variables_sql import SYNTAX, MODULE_LIST

MODULE_LIST.append("upload")

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


def get_lst_of_files(input_directory, output_lst):
    filesinfolder = os.listdir(input_directory)
    for file_name in filesinfolder:
        current_file_name = os.path.join(input_directory, file_name)
        if os.path.isdir(current_file_name):
            return get_lst_of_files(current_file_name, output_lst)
        output_lst.append(current_file_name)
    return output_lst


@borg.on(admin_cmd("dir (.*)"))