コード例 #1
0
ファイル: news.py プロジェクト: perman-dev/perman_ub
# Copyright (C) By StarkGang [@STARKXD]
# Don't edit credits
# Works On Bases Of Cyberboysumanjay's Inshorts News Api
# Test

import requests

from var import Var
from virtualuserbot import CMD_HELP
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd

newslog = Var.NEWS_CHANNEL_ID


@friday.on(friday_on_cmd("news (.*)"))
@friday.on(sudo_cmd("news (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if Var.NEWS_CHANNEL_ID is None:
        await edit_or_reply(
            event, "`Please ADD NEWS_CHANNEL_ID For This Module To Work`")
        return
    infintyvar = event.pattern_match.group(1)
    main_url = f"https://inshortsapi.vercel.app/news?category={infintyvar}"
    stuber = await edit_or_reply(
        event,
        f"Ok ! Fectching {infintyvar} From inshortsapi Server And Sending To News Channel",
    )
    await stuber.edit("All News Has Been Sucessfully Send To News Channel")
    starknews = requests.get(main_url).json()
コード例 #2
0
ファイル: stickers.py プロジェクト: perman-dev/perman_ub
)

from virtualuserbot import ALIVE_NAME, CMD_HELP
from virtualuserbot.function import convert_to_image
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd

sedpath = Config.TMP_DOWNLOAD_DIRECTORY
if not os.path.isdir(sedpath):
    os.makedirs(sedpath)

DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Who is this"
FILLED_UP_DADDY = "Invalid pack selected."


@friday.on(friday_on_cmd(pattern="kang ?(.*)"))
@friday.on(sudo_cmd(pattern="kang ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if not event.reply_to_msg_id:
        await event.edit("PLease, Reply To A Sticker / Image To Add It Your Pack")
        return
    if not event.is_reply:
        await moods.edit("Reply to a photo to add to my personal sticker pack.")
        return
    reply_message = await event.get_reply_message()
    sticker_emoji = await get_sticker_emoji(event)
    input_str = event.pattern_match.group(1)
    if input_str:
        sticker_emoji = input_str
    moods = await edit_or_reply(
コード例 #3
0
import os

from cryptosteganography import CryptoSteganography
from telethon.tl.types import MessageMediaPhoto

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import friday_on_cmd, sudo_cmd

sedpath = "./fridaydevs/"
if not os.path.isdir(sedpath):
    os.makedirs(sedpath)


@friday.on(friday_on_cmd(pattern=r"stegano ?(.*)"))
@friday.on(sudo_cmd(pattern=r"stegano ?(.*)", allow_sudo=True))
async def hmm(event):
    if not event.reply_to_msg_id:
        await event.reply("Reply to any Image.")
        return
    await event.edit("hmm... Hiding Text Inside Image...")
    sed = await event.get_reply_message()
    if isinstance(sed.media, MessageMediaPhoto):
        img = await borg.download_media(sed.media, sedpath)
    elif "image" in sed.media.document.mime_type.split("/"):
        img = await borg.download_media(sed.media, sedpath)
    else:
        await event.edit("Reply To Image")
        return
    text = event.pattern_match.group(1)
    if not text:
        await event.edit("No input found!  --__--")
コード例 #4
0
# @FridayoT

import requests
from iplookup import iplookup
from selenium import webdriver
from youtube_search import YoutubeSearch

from virtualuserbot import CMD_HELP
from virtualuserbot.function import apk_dl
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd(pattern="wshot ?(.*)"))
@friday.on(sudo_cmd(pattern="wshot ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    urlissed = event.pattern_match.group(1)
    sedlyfstarky = await edit_or_reply(event, "Capturing Webshot, Stay Tuned.")
    driver = webdriver.Chrome()
    driver.get(urlissed)
    driver.get_screenshot_as_file("*****@*****.**")
    imgpath = "*****@*****.**"
    await sedlyfstarky.edit("Completed. Uploading in Telegram..")
    await borg.send_file(
        event.chat_id,
        file=imgpath,
        caption=
        f"**WEBSHOT OF** `{urlissed}` \n**Powered By @VirtualUserbot\nThanks to @FridayOT**",
    )
コード例 #5
0
ファイル: information.py プロジェクト: perman-dev/perman_ub
import html

from telethon.tl.functions.photos import GetUserPhotosRequest
from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import MessageEntityMentionName
from telethon.utils import get_input_location

from virtualuserbot import CMD_HELP, sclient
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd("info ?(.*)"))
@friday.on(sudo_cmd("info ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    replied_user, error_i_a = await get_full_user(event)
    if replied_user is None:
        await edit_or_reply(event, str(error_i_a))
        return False
    replied_user_profile_photos = await borg(
        GetUserPhotosRequest(user_id=replied_user.user.id,
                             offset=42,
                             max_id=0,
                             limit=80))
    replied_user_profile_photos_count = "None"
    try:
        replied_user_profile_photos_count = replied_user_profile_photos.count
    except AttributeError:
        pass
    user_id = replied_user.user.id
コード例 #6
0
    image_stream.seek(0)
    # finally, reply the sticker
    await event.client.send_file(
        event.chat_id,
        image_stream,
        caption="FridayOT",
        reply_to=event.message.reply_to_msg_id,
    )
    # cleanup
    try:
        os.remove(FONT_FILE)
    except:
        pass


@friday.on(sudo_cmd(pattern="stcr ?(?:(.*?) \| )?(.*)", allow_sudo=True))
async def sticklet(event):
    R = random.randint(0, 256)
    G = random.randint(0, 256)
    B = random.randint(0, 256)
    reply_message = event.message
    # get the input text
    # the text on which we would like to do the magic on
    font_file_name = event.pattern_match.group(1)
    if not font_file_name:
        font_file_name = ""
    sticktext = event.pattern_match.group(2)
    if not sticktext and event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        sticktext = reply_message.message
    elif not sticktext:
コード例 #7
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/.

from telethon.tl.functions.messages import SaveDraftRequest

from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd(pattern="chain"))
@friday.on(sudo_cmd(pattern="chain", allow_sudo=True))
async def _(event):
    pokemonlub = await edit_or_reply(event, "Counting...")
    count = -1
    message = event.message
    while message:
        reply = await message.get_reply_message()
        if reply is None:
            await borg(
                SaveDraftRequest(await event.get_input_chat(),
                                 "",
                                 reply_to_msg_id=message.id))
        message = reply
        count += 1
    await pokemonlub.edit(f"Chain length: {count}")
コード例 #8
0
ファイル: proxyscrape.py プロジェクト: perman-dev/perman_ub
from pySmartDL import SmartDL

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import friday_on_cmd, sudo_cmd

STARK_HTTP = "https://api.proxyscrape.com/?request=getproxies&proxytype=http&timeout=10000&country=all&ssl=all&anonymity=all"
HTTP_TXT = "**Proxy Info** \nType: __HTTPS__ \nTimeOut: __10000__ \nCountry: __All__ \nSsl: All \nAnonymity: __All__ \n[Click Here To View Or Download File Manually](https://api.proxyscrape.com/?request=getproxies&proxytype=http&timeout=10000&country=all&ssl=all&anonymity=all) \nUploaded By [Friday](https://github.com/starkgang/FridayUserBot) \n**Here Is Your Proxy** 👇"
STARK_SOCKS4 = "https://api.proxyscrape.com/?request=getproxies&proxytype=socks4&timeout=10000&country=all"
SOCKS4_TXT = "**Proxy Info** \nType: __SOCKS4__ \nTimeOut: __10000__ \nCountry: __All__ \nSsl: __Only For Http Proxy__ \nAnonymity: __Only For Http__ \n[Click Here To View Or Download File Manually](https://api.proxyscrape.com/?request=getproxies&proxytype=socks4&timeout=10000&country=all) \nUploaded By [Friday](https://github.com/starkgang/FridayUserBot) \n**Here Is Your Proxy** 👇"
STARK_SOCKS5 = "https://api.proxyscrape.com/?request=getproxies&proxytype=socks5&timeout=10000&country=all"
SOCKS5_TXT = "**Proxy Info** \nType: __SOCKS4__ \nTimeOut: __10000__ \nCountry: __All__ \nSsl: __Only For Http Proxy__ \nAnonymity: __Only For Http__ \n[Click Here To View Or Download File Manually](https://api.proxyscrape.com/?request=getproxies&proxytype=socks5&timeout=10000&country=all) \nUploaded By [Friday](https://github.com/starkgang/FridayUserBot) \n**Here Is Your Proxy** 👇"
sedpng = "https://soon.proxyscrape.com/asset/img/service/downloadicon.svg"


@friday.on(friday_on_cmd(pattern="http$"))
@friday.on(sudo_cmd(pattern="http$", allow_sudo=True))
async def starkxD(event):
    await event.get_chat()
    file_name = "proxy_http.txt"
    downloaded_file_name = os.path.join(Config.TMP_DOWNLOAD_DIRECTORY,
                                        file_name)
    downloader = SmartDL(f"{STARK_HTTP}",
                         downloaded_file_name,
                         progress_bar=False)
    downloader.start(blocking=False)
    await event.client.send_file(
        event.chat_id,
        downloaded_file_name,
        force_document=False,
        thumb=sedpng,
        caption=HTTP_TXT,
コード例 #9
0
""" Google Translate
Available Commands:
.tr LanguageCode as reply to a message
.tr LangaugeCode | text to translate"""

import requests
from google_trans_new import google_translator
from googletrans import LANGUAGES
from langdetect import detect

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd("tr ?(.*)"))
@friday.on(sudo_cmd("tr ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if "trim" in event.raw_text:
        return
    input_str = event.pattern_match.group(1)
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        text = previous_message.message
        lan = input_str or "en"
    elif "|" in input_str:
        lan, text = input_str.split("|")
    else:
        await edit_or_reply(event, "`.tr LanguageCode` as reply to a message")
        return
コード例 #10
0
ファイル: get_admin.py プロジェクト: perman-dev/perman_ub
"""Get Administrators of any Chat*
Syntax: .get_admin"""
from telethon.tl.types import (
    ChannelParticipantAdmin,
    ChannelParticipantCreator,
    ChannelParticipantsAdmins,
)

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd("get_ad?(m)in ?(.*)"))
@friday.on(sudo_cmd("get_ad?(m)in ?(.*)", allow_sudo=True))
async def _(event):
    admeme = await edit_or_reply(event, "Processing")
    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
コード例 #11
0
import os.path

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import friday_on_cmd, sudo_cmd

sedpath = "./chsaiujwal/"
if not os.path.isdir(sedpath):
    os.makedirs(sedpath)


@friday.on(friday_on_cmd("savepass ?(.*)"))
@friday.on(sudo_cmd("savepass ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    ujwal = input_str.split(":")
    usermail = ujwal[0]
    passwd = ujwal[1]
    webo = ujwal[2]
    if os.path.exists("./chsaiujwal/info.pablo"):
        file = open("./chsaiujwal/info.pablo", "a")
    else:
        file = open("./chsaiujwal/info.pablo", "x")
        file.close()
        file = open("./chsaiujwal/info.pablo", "a")

    userName = usermail
    password = passwd
    website = webo
コード例 #12
0
    "\U0001F800-\U0001F8FF"  # Supplemental Arrows-C
    "\U0001F900-\U0001F9FF"  # Supplemental Symbols and Pictographs
    "\U0001FA00-\U0001FA6F"  # Chess Symbols
    "\U0001FA70-\U0001FAFF"  # Symbols and Pictographs Extended-A
    "\U00002702-\U000027B0"  # Dingbats
    "]+")


def deEmojify(inputString: str) -> str:
    """Remove emojis and other non-safe characters from string"""
    return re.sub(EMOJI_PATTERN, "", inputString)


# @register(outgoing=True, pattern="^.waifu(?: |$)(.*)", allow_sudo=True))
@friday.on(friday_on_cmd(pattern=r"waifu(?: |$)(.*)"))
@friday.on(sudo_cmd(pattern=r"waifu(?: |$)(.*)", allow_sudo=True))
async def waifu(animu):
    text = animu.pattern_match.group(1)
    if not text:
        if animu.is_reply:
            text = (await animu.get_reply_message()).message
        else:
            await edit_or_reply(
                animu,
                "`You haven't written any article, Waifu is going away.`")
            return
    animus = [1, 3, 7, 9, 13, 22, 34, 35, 36, 37, 43, 44, 45, 52, 53, 55]
    sticcers = await bot.inline_query(
        "stickerizerbot", f"#{random.choice(animus)}{(deEmojify(text))}")
    await sticcers[0].click(
        animu.chat_id,
コード例 #13
0
ファイル: bash.py プロジェクト: perman-dev/perman_ub
import asyncio
import io
import time

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd(pattern="bash ?(.*)"))
@friday.on(sudo_cmd(pattern="bash ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    PROCESS_RUN_TIME = 100
    cmd = event.pattern_match.group(1)
    tflyf = await edit_or_reply(event, "Processing Your Request...")
    reply_to_id = event.message.id
    if event.reply_to_msg_id:
        reply_to_id = event.reply_to_msg_id
    time.time() + PROCESS_RUN_TIME
    process = await asyncio.create_subprocess_shell(
        cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
    stdout, stderr = await process.communicate()
    e = stderr.decode()
    if not e:
        e = "No Error"
    o = stdout.decode()
    if not o:
        o = "**Tip**: \n`If you want to see the results of your code, I suggest printing them to stdout.`"
    else:
        _o = o.split("\n")
コード例 #14
0
    """Inputs time in milliseconds, to get beautified time,
    as string"""
    seconds, milliseconds = divmod(int(milliseconds), 1000)
    minutes, seconds = divmod(seconds, 60)
    hours, minutes = divmod(minutes, 60)
    days, hours = divmod(hours, 24)
    tmp = (((str(days) + " day(s), ") if days else "") +
           ((str(hours) + " hour(s), ") if hours else "") +
           ((str(minutes) + " minute(s), ") if minutes else "") +
           ((str(seconds) + " second(s), ") if seconds else "") +
           ((str(milliseconds) + " millisecond(s), ") if milliseconds else ""))
    return tmp[:-2]


@friday.on(friday_on_cmd(pattern="deezer ?(.*)"))
@friday.on(sudo_cmd(pattern="deezer ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    credits = "By Friday. Get Your Friday From @FridayOT."
    link = f"https://api.deezer.com/search?q={input_str}&limit=1"
    ommhg = await edit_or_reply(event, "Searching For The Song 🧐🔍")
    dato = requests.get(url=link).json()
    match = dato.get("data")
    urlhp = (match[0])
    print(credits)
    m0 = credits[3]
    urlp = urlhp.get("link")
    thums = urlhp["album"]["cover_big"]
    LLL = "deezer's token fly"
コード例 #15
0
ファイル: github.py プロジェクト: perman-dev/perman_ub
"""Get information about an user on GitHub
Syntax: .github USERNAME"""
import requests

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@borg.on(friday_on_cmd("github (.*)"))
@borg.on(sudo_cmd("github (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    url = "https://api.github.com/users/{}".format(input_str)
    r = requests.get(url)
    if r.status_code != 404:
        b = r.json()
        avatar_url = b["avatar_url"]
        html_url = b["html_url"]
        gh_type = b["type"]
        name = b["name"]
        company = b["company"]
        blog = b["blog"]
        location = b["location"]
        bio = b["bio"]
        created_at = b["created_at"]
        await borg.send_file(
            event.chat_id,
            caption="""Name: [{}]({})
Type: {}
コード例 #16
0
import logging

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import friday_on_cmd, sudo_cmd

logger = logging.getLogger(__name__)


if 1 == 1:

    name = "Profile Photos"

    client = borg

    @friday.on(friday_on_cmd(pattern="poto(.*)"))
    @friday.on(sudo_cmd(pattern="poto(.*)", allow_sudo=True))
    async def potocmd(event):

        """Gets the profile photos of replied users, channels or chats"""
        id = "".join(event.raw_text.split(maxsplit=2)[1:])

        user = await event.get_reply_message()

        chat = event.input_chat

        if user:

            photos = await event.client.get_profile_photos(user.sender)

        else:
コード例 #17
0
import asyncio
import os

import wget
from youtubesearchpython import SearchVideos

from virtualuserbot import CMD_HELP
from virtualuserbot.Configs import Config
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd(pattern="ytmusic ?(.*)"))
@friday.on(sudo_cmd(pattern="ytmusic ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    urlissed = event.pattern_match.group(1)
    myself_stark = await edit_or_reply(
        event, f"`Getting {urlissed} From Youtube Servers. Please Wait.`")
    search = SearchVideos(f"{urlissed}", offset=1, mode="dict", max_results=1)
    mi = search.result()
    mio = mi["search_result"]
    mo = mio[0]["link"]
    thum = mio[0]["title"]
    fridayz = mio[0]["id"]
    thums = mio[0]["channel"]
    kekme = f"https://img.youtube.com/vi/{fridayz}/hqdefault.jpg"
    await asyncio.sleep(0.6)
    if not os.path.isdir("./music/"):
        os.makedirs("./music/")
    path = Config.TMP_DOWNLOAD_DIRECTORY
コード例 #18
0
ファイル: fakeimagegen.py プロジェクト: perman-dev/perman_ub
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <https://www.gnu.org/licenses/>.

import os

import requests

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import friday_on_cmd, sudo_cmd


# hmm
@friday.on(friday_on_cmd(pattern="picgen"))
@friday.on(sudo_cmd(pattern="picgen", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return

    url = "https://thispersondoesnotexist.com/image"
    response = requests.get(url)
    if response.status_code == 200:
        with open("FRIDAYOT.jpg", "wb") as f:
            f.write(response.content)

    captin = f"Fake Image By VirtualUserbot.\nGet Your Own Superpowers From [VirtualUserbot](github.com/inukaasith/virtualuserbot)."
    fole = "FRIDAYOT.jpg"
    await borg.send_file(event.chat_id, fole, caption=captin)
    await event.delete()
    os.system("rm /root/virtualuserbot/FRIDAYOT.jpg ")
コード例 #19
0
Syntax: .iffuci"""
import os
from datetime import datetime

import requests

from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


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


@friday.on(friday_on_cmd(pattern="iffuci ?(.*)"))
@friday.on(sudo_cmd(pattern="iffuci ?(.*)", allow_sudo=True))
async def _(event):
    crackexy = await edit_or_reply(event, "Processing")
    if event.fwd_from:
        return
    start = datetime.now()
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    input_str = event.pattern_match.group(1)
    message = "SYNTAX: `.iffuci <long text to include>`"
    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(
コード例 #20
0
Syntax: .invite <User(s)>"""

from telethon import functions

from virtualuserbot.utils import friday_on_cmd
"""Invite the user(s) to the current chat
Syntax: .invite <User(s)>"""

from telethon import functions

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd(pattern="invite ?(.*)"))
@friday.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 edit_or_reply(
            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(
コード例 #21
0
ファイル: ultragoogle.py プロジェクト: perman-dev/perman_ub
import requests
from bs4 import BeautifulSoup
from google_images_download import google_images_download

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


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


@friday.on(friday_on_cmd(pattern="search (.*)"))
@friday.on(sudo_cmd(pattern="search (.*)", allow_sudo=True))
async def _(event):
    stark = await edit_or_reply(event, "`Processing Your Request`")
    if event.fwd_from:
        return
    start = datetime.now()
    await stark.edit("`Trying To Connect...`")
    # SHOW_DESCRIPTION = False
    input_str = event.pattern_match.group(
        1
    )  # + " -inurl:(htm|html|php|pls|txt) intitle:index.of \"last modified\" (mkv|mp4|avi|epub|pdf|mp3)"
    input_url = "https://bots.shrimadhavuk.me/search/?q={}".format(input_str)
    headers = {"USER-AGENT": "UniBorg"}
    response = requests.get(input_url, headers=headers).json()
    output_str = " "
    for result in response["results"]:
コード例 #22
0
import os
import shutil
from re import findall

from virtualuserbot import CMD_HELP
from virtualuserbot.googol_images import googleimagesdownload
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd(pattern="(wpaper|wallpaper|wp) ?(.*)"))
@friday.on(sudo_cmd(pattern="(wpaper|wallpaper|wp) ?(.*)", allow_sudo=True))
async def img_sampler(event):
    if event.fwd_from:
        return
    await edit_or_reply(event, "`Processing...`")
    reply = await event.get_reply_message()
    if event.pattern_match.group(2):
        queryo = event.pattern_match.group(2)
    elif reply:
        queryo = reply.message
    else:
        await edit_or_reply(
            event,
            "`um, mind mentioning what I actually need to search for ;_;`")
        return
    query = queryo + "hd wallpaper"
    lim = findall(r"lim=\d+", query)
    # lim = event.pattern_match.group(1)
    try:
        lim = lim[0]
        lim = lim.replace("lim=", "")
コード例 #23
0
ファイル: upload_dl.py プロジェクト: perman-dev/perman_ub
    """Inputs time in milliseconds, to get beautified time,
    as string"""
    seconds, milliseconds = divmod(int(milliseconds), 1000)
    minutes, seconds = divmod(seconds, 60)
    hours, minutes = divmod(minutes, 60)
    days, hours = divmod(hours, 24)
    tmp = (((str(days) + " day(s), ") if days else "") +
           ((str(hours) + " hour(s), ") if hours else "") +
           ((str(minutes) + " minute(s), ") if minutes else "") +
           ((str(seconds) + " second(s), ") if seconds else "") +
           ((str(milliseconds) + " millisecond(s), ") if milliseconds else ""))
    return tmp[:-2]


@friday.on(friday_on_cmd(pattern="download(?: |$)(.*)"))
@friday.on(sudo_cmd(pattern="download(?: |$)(.*)", allow_sudo=True))
async def download(target_file):
    if target_file.fwd_from:
        return
    friday = await edit_or_reply(target_file, "`Processing ...`")
    await friday.edit("Processing using virtualuserbot server ( ◜‿◝ )♡")
    if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
        os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
    if not target_file.reply_to_msg_id:
        await friday.edit(
            "`Reply to a message to download to my local server.`")
        return
    sedd = await target_file.get_reply_message()
    if not sedd.media:
        await event.edit("`I Can Only Download Media As For Now.`")
        return
コード例 #24
0
ファイル: heroku.py プロジェクト: perman-dev/perman_ub
from virtualuserbot import CMD_HELP
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd

telegraph = Telegraph()
tgnoob = telegraph.create_account(short_name="Friday 🇮🇳")

Heroku = heroku3.from_key(Var.HEROKU_API_KEY)
heroku_api = "https://api.heroku.com"


@friday.on(
    friday_on_cmd(pattern="(set|get|del) var(?: |$)(.*)(?: |$)([\s\S]*)", outgoing=True)
)
@friday.on(
    sudo_cmd(pattern="(set|get|del) var(?: |$)(.*)(?: |$)([\s\S]*)", allow_sudo=True)
)
async def variable(var):
    """
    Manage most of ConfigVars setting, set new var, get current var,
    or delete var...
    """
    if Var.HEROKU_APP_NAME is not None:
        app = Heroku.app(Var.HEROKU_APP_NAME)
    else:
        return await edit_or_reply(
            var, "`[HEROKU]:" "\nPlease setup your` **HEROKU_APP_NAME**"
        )
    exe = var.pattern_match.group(1)
    heroku_var = app.config()
    if exe == "get":
コード例 #25
0
ファイル: locks.py プロジェクト: perman-dev/perman_ub
Available Commands: .lock <option>, .unlock <option>, .locks
API Options: msg, media, sticker, gif, gamee, ainline, gpoll, adduser, cpin, changeinfo
DB Options: bots, commands, email, forward, url"""

from telethon import events, functions, types

from virtualuserbot.modules.sql_helper.locks_sql import (
    get_locks,
    is_locked,
    update_lock,
)
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd("lock( (?P<target>\S+)|$)"))
@friday.on(sudo_cmd("lock( (?P<target>\S+)|$)", allow_sudo=True))
async def _(event):
    mrhackerguy = await edit_or_reply(event, "Processing")
    # 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")
    peer_id = event.chat_id
    if input_str in (("bots", "commands", "email", "forward", "url")):
        update_lock(peer_id, input_str, True)
        await mrhackerguy.edit("Locked {}".format(input_str))
    else:
        msg = None
        media = None
        sticker = None
コード例 #26
0
import pyshorteners

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd(pattern="urlshort (.*)"))
@friday.on(sudo_cmd(pattern="urlshort (.*)", allow_sudo=True))
async def vom(event):
    try:
        link = event.pattern_match.group(1)
        sed = pyshorteners.Shortener()
        kek = sed.tinyurl.short(link)
        bestisbest = (
            f"<b>Url Shortened</b> \n<b><u>Given Link</u></b> ➠ {link}\n"
            f"<b><u>Shortened Link</u></b> ➠ {kek}"
        )
        await event.edit(bestisbest, parse_mode="HTML")
    except Exception as e:
        await event.edit("SomeThing Went Wrong. \nError : " + e)


CMD_HELP.update(
    {
        "urlshortner": "**URL shortner**\
\n\n**Syntax : **`.urlshort <url link>`\
\n**Usage :** Shortens the given URL."
    }
)
コード例 #27
0
ファイル: glitch.py プロジェクト: perman-dev/perman_ub
from telethon.tl.types import MessageMediaPhoto

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import friday_on_cmd, sudo_cmd

glitcher = ImageGlitcher()
DURATION = 200  # Set this to however many centiseconds each frame should be visible for
LOOP = 0  # Set this to how many times the gif should loop
# LOOP = 0 means infinite loop
sedpath = "./starkgangz/"
if not os.path.isdir(sedpath):
    os.makedirs(sedpath)


@friday.on(friday_on_cmd(pattern=r"glitch"))
@friday.on(sudo_cmd(pattern=r"glitch", allow_sudo=True))
async def glitch(event):
    sed = await event.get_reply_message()
    okbruh = await event.edit("`Gli, Glitchiiingggg.....`")
    if isinstance(sed.media, MessageMediaPhoto):
        photolove = await borg.download_media(sed.media, sedpath)
    elif "image" in sed.media.document.mime_type.split("/"):
        photolove = await borg.download_media(sed.media, sedpath)
    else:
        await event.edit("`Reply To Image`")
        return
    fmt = "gif"
    pathsn = f"./starkgangz/@fridayot.{fmt}"
    glitch_imgs = glitcher.glitch_image(photolove,
                                        2,
                                        gif=True,
コード例 #28
0
ファイル: figlet.py プロジェクト: perman-dev/perman_ub
import pyfiglet

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd(pattern="figlet ?(.*)", outgoing=True))
@friday.on(sudo_cmd(pattern="figlet ?(.*)", allow_sudo=True))
async def figlet(event):
    arjun = await edit_or_reply(event, "`Figleting This Text xD`")
    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:
コード例 #29
0
# Lel, Didn't Get Time To Make New One So Used Plugin Made br @mrconfused and @sandy1709 dont edit credits
import io
import os

import lyricsgenius
from tswift import Song

from virtualuserbot import CMD_HELP
from virtualuserbot.utils import edit_or_reply, friday_on_cmd, sudo_cmd

GENIUS = os.environ.get("GENIUS_API_TOKEN", None)


@friday.on(friday_on_cmd(outgoing=True, pattern="lyrics (.*)"))
@friday.on(sudo_cmd(pattern="lyrics (.*)", allow_sudo=True))
async def _(event):
    await edit_or_reply(event, "Searching For Lyrics.....")
    reply_to_id = event.message.id
    if event.reply_to_msg_id:
        reply_to_id = event.reply_to_msg_id
    reply = await event.get_reply_message()
    if event.pattern_match.group(1):
        query = event.pattern_match.group(1)
    elif reply.text:
        query = reply.message
    else:
        await edit_or_reply(event, "`What I am Supposed to find `")
        return

    song = ""
    song = Song.find_song(query)
コード例 #30
0
ファイル: nsfw.py プロジェクト: perman-dev/perman_ub
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <https://www.gnu.org/licenses/>.
import os

import requests
from pornhub_api import PornhubApi
from telethon.tl.types import MessageMediaPhoto
from uniborg.util import friday_on_cmd

from virtualuserbot import CMD_HELP, pro
from virtualuserbot.utils import admin_cmd, friday_on_cmd, sudo_cmd

if pro == "True":

    @friday.on(friday_on_cmd(pattern=r"nsfw"))
    @friday.on(sudo_cmd(pattern=r"nsfw", allow_sudo=True))
    async def nsfw(event):
        url = "https://nsfw-categorize.it/api/upload"
        await event.edit("`Processing..`")
        sed = await event.get_reply_message()
        photo = None
        sedpath = "./fridaydevs/"
        if sed and sed.media:
            if isinstance(sed.media, MessageMediaPhoto):
                photo = await borg.download_media(sed.media, sedpath)
            elif "image" in sed.media.document.mime_type.split("/"):
                photo = await borg.download_media(sed.media, sedpath)
            else:
                await event.edit("Reply To Image")
                return
        if photo: