Example #1
0
"""Upload local Files to Mirrorace
Syntax:
.ma"""

import asyncio
import os
import time
from datetime import datetime

import aiohttp
import requests
from uniborg.util import Freaky_on_cmd, progress


@Freaky.on(Freaky_on_cmd(pattern="ma ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    mone = await event.reply("Processing ...")
    if Config.MIRROR_ACE_API_KEY is None or Config.MIRROR_ACE_API_TOKEN is None:
        await mone.edit(
            "This module requires API key from https://ouo.io/My1jdU. 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:
        reply_message = await event.get_reply_message()
Example #2
0
"""Auto Profile Updation Commands
.autoname"""
import asyncio
import time

from telethon.errors import FloodWaitError
from telethon.tl import functions
from uniborg.util import Freaky_on_cmd, edit_or_reply, sudo_cmd

from FreakyUserbot import ALIVE_NAME, CMD_HELP

DEL_TIME_OUT = 60
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "FreakyUserbot"


@Freaky.on(Freaky_on_cmd(pattern="autoname"))  # pylint:disable=E0602
@Freaky.on(sudo_cmd(pattern="autoname", allow_sudo=True))
async def _(event):
    sed = await edit_or_reply(event, "`Starting AutoName Please Wait`")
    if event.fwd_from:
        return

    while True:

        DM = time.strftime("%d-%m-%y")

        HM = time.strftime("%H:%M")

        name = f"🕒{HM} ⚡{DEFAULTUSER}⚡ 📅{DM}"

        logger.info(name)
Example #3
0
# created by @Mr_Hops
"""
video meme mashup:
Syntax: .mashup <text>
"""
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from uniborg.util import Freaky_on_cmd

from FreakyUserbot import CMD_HELP


@Freaky.on(Freaky_on_cmd(pattern="mashup ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    reply_to_id = event.message
    if event.reply_to_msg_id:
        reply_to_id = await event.get_reply_message()
    chat = "@vixtbot"
    await event.edit("```Checking...```")
    async with event.client.conversation(chat) as conv:
        try:
            response = conv.wait_event(
                events.NewMessage(incoming=True, from_users=285336877))
            await event.client.send_message(chat, "{}".format(input_str))
            response = await response
        except YouBlockedUserError:
            await event.reply("Unblock @vixtbot")
            return
Example #4
0
import random

import requests
from uniborg.util import Freaky_on_cmd


@Freaky.on(Freaky_on_cmd(pattern="quote ?(.*)"))
async def quote_search(event):
    if event.fwd_from:
        return
    await event.edit("Processing...")
    search_string = event.pattern_match.group(1)
    input_url = "https://bots.shrimadhavuk.me/Telegram/GoodReadsQuotesBot/?q={}".format(
        search_string)
    headers = {"USER-AGENT": "UniBorg"}
    try:
        response = requests.get(input_url, headers=headers).json()
    except:
        response = None
    if response is not None:
        result = (random.choice(response).get("input_message_content").get(
            "message_text"))
    else:
        result = None
    if result:
        await event.edit(result.replace("<code>", "`").replace("</code>", "`"))
    else:
        await event.edit("Zero results found")
Example #5
0
from uniborg.util import Freaky_on_cmd


@Freaky.on(Freaky_on_cmd(pattern="ftext ?(.*)"))
async def payf(event):
    input_str = event.pattern_match.group(1)
    if input_str:
        paytext = input_str
        pay = "{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}".format(
            paytext * 8,
            paytext * 8,
            paytext * 2,
            paytext * 2,
            paytext * 2,
            paytext * 6,
            paytext * 6,
            paytext * 2,
            paytext * 2,
            paytext * 2,
            paytext * 2,
            paytext * 2,
        )
    else:
        pay = "╭━━━╮\n┃╭━━╯\n┃╰━━╮\n┃╭━━╯\n┃┃\n╰╯\n"
    # pay = "{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}".format(paytext*8, paytext*8, paytext*2, paytext*2, paytext*2, paytext*6, paytext*6, paytext*2, paytext*2, paytext*2, paytext*2, paytext*2)
    await event.edit(pay)
Example #6
0
""".admin Plugin for @UniBorg"""
from telethon.tl.types import ChannelParticipantsAdmins
from uniborg.util import Freaky_on_cmd

from FreakyUserbot import CMD_HELP


@Freaky.on(Freaky_on_cmd(pattern="admins"))
async def _(event):
    if event.fwd_from:
        return
    mentions = "@admin: **Spam Spotted**"
    chat = await event.get_input_chat()
    async for x in borg.iter_participants(chat,
                                          filter=ChannelParticipantsAdmins):
        mentions += f"[\u2063](tg://user?id={x.id})"
    reply_message = None
    if event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        await reply_message.reply(mentions)
    else:
        await event.reply(mentions)
    await event.delete()


CMD_HELP.update({
    "calladmin":
    "**Calladmin**\
\n\n**Syntax : **`.admins`\
\n**Usage :** use this plugin to mention all the admins in a group."
})
Example #7
0
RUNSREACTS = [
    "`Congratulations and BRAVO!`",
    "`You did it! So proud of you!`",
    "`This calls for celebrating! Congratulations!`",
    "`I knew it was only a matter of time. Well done!`",
    "`Congratulations on your well-deserved success.`",
    "`Heartfelt congratulations to you.`",
    "`Warmest congratulations on your achievement.`",
    "`Congratulations and best wishes for your next adventure!”`",
    "`So pleased to see you accomplishing great things.`",
    "`Feeling so much joy for you today. What an impressive achievement!`",
]


@Freaky.on(Freaky_on_cmd(pattern="congo"))
@Freaky.on(sudo_cmd(pattern="congo", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    bro = random.randint(0, len(RUNSREACTS) - 1)
    reply_text = RUNSREACTS[bro]
    await edit_or_reply(event, reply_text)


CMD_HELP.update({
    "congratulations":
    "**Congratulations**\
\n\n**Syntax : **`.congo`\
\n**Usage :** This plugin is used to congratulate someone."
})
Example #8
0
"""CoinFlip for @UniBorg
Syntax: .coinflip [optional_choice]"""
import random

from uniborg.util import Freaky_on_cmd

from FreakyUserbot import CMD_HELP


@Freaky.on(Freaky_on_cmd(pattern="coin ?(.*)"))
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("The coin landed on: **Heads**. \n You were correct.")
        elif input_str == "tails":
            await event.edit(
                "The coin landed on: **Heads**. \n You weren't correct, try again ..."
            )
        else:
            await event.edit("The coin landed on: **Heads**.")
    elif r % 2 == 0:
        if input_str == "tails":
            await event.edit("The coin landed on: **Tails**. \n You were correct.")
        elif input_str == "heads":
            await event.edit(
Example #9
0
# For @UniBorg
# (c) Shrimadhav U K

from telethon.tl.functions.channels import GetAdminedPublicChannelsRequest
from uniborg.util import Freaky_on_cmd

from FreakyUserbot import CMD_HELP


@Freaky.on(Freaky_on_cmd("reserved"))
async def mine(event):
    """ For .reserved command, get a list of your reserved usernames. """
    result = await bot(GetAdminedPublicChannelsRequest())
    output_str = ""
    for channel_obj in result.chats:
        output_str += f"{channel_obj.title}\n@{channel_obj.username}\n\n"
    await event.edit(output_str)


CMD_HELP.update({
    "Reserved Usernames":
    "**List my reserved usernames**\
\n\n**Syntax : **`.reserved`\
\n**Usage :** it lists all your usernames you are holding"
})
Example #10
0
# 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/.
""" Command: .fpost word

credit: @pureindialover"""

import string

from uniborg.util import Freaky_on_cmd

msg_cache = {}


@Freaky.on(Freaky_on_cmd(pattern=r"fpost\s+(.*)"))
async def _(event):
    await event.delete()
    text = event.pattern_match.group(1)
    destination = await event.get_input_chat()

    for c in text.lower():
        if c not in string.ascii_lowercase:
            continue
        if c not in msg_cache:
            async for msg in borg.iter_messages(None, search=c):
                if msg.raw_text.lower() == c and msg.media is None:
                    msg_cache[c] = msg
                    break
        await borg.forward_messages(destination, msg_cache[c])
Example #11
0
"""Get Poll Info on non supported clients
Syntax: .get_poll"""
from uniborg.util import Freaky_on_cmd


@Freaky.on(Freaky_on_cmd(pattern="get_poll"))
async def _(event):
    reply_message = await event.get_reply_message()
    if reply_message.media is None:
        await event.edit(
            "Please reply to a media_type == @gPoll to view the questions and answers"
        )
    elif reply_message.media.poll is None:
        await event.edit(
            "Please reply to a media_type == @gPoll to view the questions and answers"
        )
    else:
        media = reply_message.media
        poll = media.poll
        closed_status = poll.closed
        answers = poll.answers
        question = poll.question
        edit_caption = """Poll is Closed: {}
Question: {}
Answers: \n""".format(
            closed_status, question
        )
        if closed_status:
            results = media.results
            i = 0
            for result in results.results:
Example #12
0
"""Use cmd `.cry` to cry"""

import asyncio

from uniborg.util import Freaky_on_cmd


@Freaky.on(Freaky_on_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 = [
        ";__",
        ";___",
        ";____",
        ";_____",
        ";______",
        ";_______",
        ";________",
        ";__________",
        ";____________",
        ";______________",
Example #13
0
base by: @r4v4n4
created by: @A_Dark_Princ3
"""

import asyncio

from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.types import MessageMediaPhoto
from uniborg.util import Freaky_on_cmd

from FreakyUserbot import CMD_HELP

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


@Freaky.on(Freaky_on_cmd("mmf ?(.*)"))
async def _(event):
    hmm = event.chat_id
    if event.fwd_from:
        return
    if not event.reply_to_msg_id:
        await event.edit("`Syntax: reply to an image with .mmf And Text `")
        return
    reply_message = await event.get_reply_message()
    if not reply_message.media:
        await event.edit("```reply to a image/sticker/gif```")
        return
    reply_message.sender
    if reply_message.sender.bot:
        await event.edit("```Reply to actual users message.```")
        return
Example #14
0
        "http://api.antiddos.systems",
        "username_colors": [
            "#fb6169",
            "#faa357",
            "#b48bf2",
            "#85de85",
            "#62d4e3",
            "#65bdf3",
            "#ff5694",
        ],
        "default_username_color":
        "#b48bf2",
    })
    client = borg

    @Freaky.on(Freaky_on_cmd(pattern="chat(.*)"))
    async def quotecmd(message):  # noqa: C901
        """Quote a message.
        Usage: .quote [template]
        If template is missing, possible templates are fetched."""
        await message.delete()
        args = message.raw_text.split(" ")[1:]
        if args == []:
            args = ["default"]
        reply = await message.get_reply_message()

        if not reply:
            return await message.respond(strings["no_reply"])

        if not args:
            return await message.respond(strings["no_template"])
Example #15
0
"""Create Button Posts
"""

import re

from telethon import custom
from uniborg.util import Freaky_on_cmd

# regex obtained from: https://github.com/PaulSonOfLars/freakybot/blob/master/tg_bot/modules/helper_funcs/string_handling.py#L23
BTN_URL_REGEX = re.compile(
    r"(\{([^\[]+?)\}\<buttonurl:(?:/{0,2})(.+?)(:same)?\>)")


@Freaky.on(Freaky_on_cmd(pattern="cbutton"))  # pylint:disable=E0602
async def _(event):
    if Config.TG_BOT_USER_NAME_BF_HER is None or freakybot is None:
        await event.edit(
            "need to set up a @BotFather bot for this module to work")
        return

    if Config.PRIVATE_CHANNEL_BOT_API_ID is None:
        await event.edit(
            "need to have a `PRIVATE_CHANNEL_BOT_API_ID` for this module to work"
        )
        return

    reply_message = await event.get_reply_message()
    if reply_message is None:
        await event.edit("reply to a message that I need to parse the magic on"
                         )
        return
Example #16
0
"""Get info about a File Extension
Syntax: .filext EXTENSION"""
import requests
from bs4 import BeautifulSoup
from uniborg.util import Freaky_on_cmd


@Freaky.on(Freaky_on_cmd(pattern="filext (.*)"))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("Processing ...")
    sample_url = "https://www.fileext.com/file-extension/{}.html"
    input_str = event.pattern_match.group(1).lower()
    response_api = requests.get(sample_url.format(input_str))
    status_code = response_api.status_code
    if status_code == 200:
        raw_html = response_api.content
        soup = BeautifulSoup(raw_html, "html.parser")
        ext_details = soup.find_all("td", {"colspan": "3"})[-1].text
        await event.edit(
            "**File Extension**: `{}`\n**Description**: `{}`".format(
                input_str, ext_details))
    else:
        await event.edit(
            "https://www.fileext.com/ responded with {} for query: {}".format(
                status_code, input_str))
Example #17
0
.verystream"""

import asyncio
import hashlib
import json
import os
import time
from datetime import datetime

import aiohttp
import magic
import requests
from uniborg.util import Freaky_on_cmd, progress


@Freaky.on(Freaky_on_cmd(pattern="verystream ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    mone = await event.reply("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:
Example #18
0
"""COMMAND : .cd, .scd, .padmin"""

import asyncio

from telethon import events
from uniborg.util import Freaky_on_cmd


@Freaky.on(Freaky_on_cmd(pattern="(f?c)d "))
async def timer_blankx(e):

    txt = e.text[4:] + "\nDeleting in "

    j = 86400

    k = j

    for j in range(j):

        await e.edit(txt + str(k))

        k = k - 50

        await asyncio.sleep(50)

    if e.pattern_match.group(1) == "c":

        await e.delete()

    else:
Example #19
0
    "口",
    "尸",
    "㔿",
    "尺",
    "丂",
    "丅",
    "凵",
    "リ",
    "山",
    "乂",
    "丫",
    "乙",
]


@Freaky.on(Freaky_on_cmd(pattern="weeb ?(.*)"))
async def weebify(event):

    args = event.pattern_match.group(1)
    if not args:
        get = await event.get_reply_message()
        args = get.text
    if not args:
        await event.edit("`What I am Supposed to Weebify U Dumb`")
        return
    string = "  ".join(args).lower()
    for normiecharacter in string:
        if normiecharacter in normiefont:
            weebycharacter = weebyfont[normiefont.index(normiecharacter)]
            string = string.replace(normiecharacter, weebycharacter)
    await event.edit(string)
Example #20
0
# Path to token json file, it should be in same directory as script
G_DRIVE_TOKEN_FILE = Var.TEMP_DOWNLOAD_DIRECTORY + "/auth_token.txt"
# Copy your credentials from the APIs Console
CLIENT_ID = Var.G_DRIVE_CLIENT_ID
CLIENT_SECRET = Var.G_DRIVE_CLIENT_SECRET
# Check https://developers.google.com/drive/scopes for all available scopes
OAUTH_SCOPE = "https://www.googleapis.com/auth/drive.file"
# Redirect URI for installed apps, can be left as is
REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob"
parent_id = Var.GDRIVE_FOLDER_ID
G_DRIVE_DIR_MIME_TYPE = "application/vnd.google-apps.folder"


# @command(pattern="^.ugdrive ?(.*)")
@Freaky.on(Freaky_on_cmd(pattern=r"ugdrive ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    mone = await event.reply("Processing ...")
    if CLIENT_ID is None or CLIENT_SECRET is None:
        await mone.edit(
            "This module requires credentials from https://da.gd/so63O. Aborting!"
        )
        return False
    input_str = event.pattern_match.group(1)
    if not os.path.isdir(Var.TEMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Var.TEMP_DOWNLOAD_DIRECTORY)
    required_file_name = None
    start = datetime.now()
    if event.reply_to_msg_id and not input_str:
Example #21
0
"""use command .ducduckgo"""

from uniborg.util import Freaky_on_cmd

from FreakyUserbot import CMD_HELP


@Freaky.on(Freaky_on_cmd("ducduckgo (.*)"))
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 you:\n🔎 [{}]({})".format(input_str, link)
        )
    else:
        await event.edit("something is wrong. please try again later.")


CMD_HELP.update(
    {
        "duckduckgo": "**Duckduckgo**\
\n\n**Syntax : **`.ducduckgo <query>`\
\n**Usage :** get duckduckgo search query link"
    }
)
Example #22
0
Command .barcode (your text)
By @snappy101
"""

import asyncio
import os
from datetime import datetime

import barcode
from barcode.writer import ImageWriter
from uniborg.util import Freaky_on_cmd, edit_or_reply, sudo_cmd

from FreakyUserbot import CMD_HELP


@Freaky.on(Freaky_on_cmd(pattern="barcode ?(.*)"))
@Freaky.on(sudo_cmd(pattern="barcode ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    await edit_or_reply(event, "...")
    start = datetime.now()
    input_str = event.pattern_match.group(1)
    message = "SYNTAX: `.barcode <long text to include>`"
    reply_msg_id = event.message.id
    if input_str:
        message = input_str
    elif event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        reply_msg_id = previous_message.id
        if previous_message.media:
Example #23
0
import requests
from uniborg.util import Freaky_on_cmd, sudo_cmd

from FreakyUserbot import CMD_HELP

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


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


@Freaky.on(Freaky_on_cmd("paste ?(.*)"))
@Freaky.on(sudo_cmd("paste ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    datetime.now()
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    input_str = event.pattern_match.group(1)
    if input_str:
        message = input_str
    elif event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        if previous_message.media:
            downloaded_file_name = await borg.download_media(
                previous_message,
Example #24
0
Syntax: .scha <option> <time in sec>
        scha options: Options for sca 

typing
contact
game
location
voice
round
video
photo
document
cancel"""

import asyncio

from uniborg.util import Freaky_on_cmd


@Freaky.on(Freaky_on_cmd("scha ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    await event.delete()
    input_str = event.pattern_match.group(1)
    action = "typing"
    if input_str:
        action = input_str
    async with borg.action(event.chat_id, action):
        await asyncio.sleep(86400)  # type for 10 seconds