Пример #1
0
import shutil
from fridaybot import CMD_HELP
from fridaybot.function import convert_to_image, crop_vid, runcmd
from fridaybot.utils import friday_on_cmd, sudo_cmd
import shutil
import os
import uuid
import img2pdf
from fridaybot.utils import friday_on_cmd
from telethon.tl.types import InputMessagesFilterPhotos

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


@friday.on(friday_on_cmd(pattern=r"ci2pdf(?: |$)(.*)"))
async def heck(event):
    if event.fwd_from:
        return
    un = event.pattern_match.group(1)
    rndm = uuid.uuid4().hex
    dir = f"./{rndm}/"
    media_count = 0
    text_count = 0
    os.makedirs(dir)
    if un:
        chnnl = un
    else:
        chnnl = event.chat_id
    await event.edit(f"**Fetching All Images From This Channel**")
    try:
Пример #2
0
# For @UniBorg
# Courtesy @yasirsiddiqui

"""
.bye
"""
import time

from telethon.tl.functions.channels import LeaveChannelRequest

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


@friday.on(friday_on_cmd("bye"))
@friday.on(sudo_cmd("bye", allow_sudo=True))
async def leave(e):
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        time.sleep(3)
        if e.is_group:
            await e.edit("`dahlah, gatau lagi. bye. `")
            await borg(LeaveChannelRequest(e.chat_id))
        else:
            await e.edit("`Boss, This is Not A Chat`")


CMD_HELP.update(
    {
        "bye": "**Bye**\
\n\n**Syntax : **`.bye`\
\n**Usage :** use this plugin to leave a group."
Пример #3
0
from shutil import rmtree
import cv2
import numpy as np
import requests
from PIL import Image, ImageDraw, ImageFont
from telegraph import upload_file
from fridaybot import CMD_HELP
from fridaybot.function import convert_to_image, crop_vid, runcmd
from fridaybot.utils import friday_on_cmd, sudo_cmd

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


@friday.on(friday_on_cmd(pattern=r"cit"))
@friday.on(sudo_cmd(pattern=r"cit", allow_sudo=True))
async def hmm(event):
    if not event.reply_to_msg_id:
        await event.reply("Reply to any Image.")
        return
    hmmu = await event.edit("Colourzing..")
    await event.get_reply_message()
    img = await convert_to_image(event, borg)
    net = cv2.dnn.readNetFromCaffe(
        "./resources/imgcolour/colouregex.prototxt",
        "./resources/imgcolour/colorization_release_v2.caffemodel",
    )

    pts = np.load("./resources/imgcolour/pts_in_hull.npy")
    class8 = net.getLayerId("class8_ab")
Пример #4
0
# Author: Shubhendra Kushwaha (@TheShubhendra)
# Email: [email protected]
import pygita

from fridaybot import CMD_HELP
from fridaybot.utils import friday_on_cmd
from var import Var

CLIENT_ID = Var.GITA_CLIENT_ID
CLIENT_SECRET = Var.GITA_CLIENT_SECRET
"""Get API crendentials from https://bhagavadgita.io."""


@friday.on(friday_on_cmd(pattern="gita +(.*) +(.*)$"))
async def gita(event):
    """To get a specific verse from a specific chapter in English."""
    if CLIENT_ID is None or CLIENT_SECRET is None:
        await event.edit(
            event,
            "`Please add required GITA_CLIENT_SECRET and GITA_CLIENT_ID env var`",
        )
        return
    pygita.auth(CLIENT_ID, CLIENT_SECRET)
    try:
        chapter_number = int(event.pattern_match.group(1))
        verse_number = int(event.pattern_match.group(2))
    except ValueError:
        return
    verse = pygita.get_verse(chapter_number, verse_number, language="en")
    await event.edit(f"**{verse.text}** {verse.meaning}")
Пример #5
0
import asyncio
import os

import pybase64
from telethon import functions, types
from telethon.tl.functions.messages import ImportChatInviteRequest as Get

from fridaybot.utils import edit_or_reply, friday_on_cmd


@friday.on(friday_on_cmd(pattern="spam (.*)"))
async def spammer(e):
    if e.fwd_from:
        return
    await e.get_chat()
    reply_to_id = e.message
    if e.reply_to_msg_id:
        reply_to_id = await e.get_reply_message()
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    try:
        hmm = pybase64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
        hmm = Get(hmm)
        await e.client(hmm)
    except BaseException:
        pass
    cat = ("".join(e.text.split(maxsplit=1)[1:])).split(" ", 1)
    counter = int(cat[0])
    if counter > 50:
        return await edit_or_reply(e,
                                   "Use `.bigspam` for spam greater than 50")
Пример #6
0
import os
import shutil
from re import findall

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


@friday.on(friday_on_cmd(pattern="wpaper ?(.*)"))
@friday.on(sudo_cmd(pattern="img ?(.*)", allow_sudo=True))
async def img_sampler(event):
    await edit_or_reply(event, "`Processing...`")
    reply = await event.get_reply_message()
    if event.pattern_match.group(1):
        queryo = event.pattern_match.group(1)
    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=", "")
        query = query.replace("lim=" + lim[0], "")
    except IndexError:
Пример #7
0
   Heroku manager for your fridaybot
"""
import asyncio
import math
import os

import heroku3
import requests

from fridaybot.utils import edit_or_reply, friday_on_cmd, sudo_cmd

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


@friday.on(friday_on_cmd(pattern="usage$", outgoing=True))
@friday.on(sudo_cmd(pattern="usage$", allow_sudo=True))
async def dyno_usage(dyno):
    """
    Get your account Dyno Usage
    """
    await edit_or_reply(dyno, "`Trying To Fetch Dyno Usage....`")
    useragent = ("Mozilla/5.0 (Linux; Android 10; SM-G975F) "
                 "AppleWebKit/537.36 (KHTML, like Gecko) "
                 "Chrome/80.0.3987.149 Mobile Safari/537.36")
    user_id = Heroku.account().id
    headers = {
        "User-Agent": useragent,
        "Authorization": f"Bearer {Var.HEROKU_API_KEY}",
        "Accept": "application/vnd.heroku+json; version=3.account-quotas",
    }
Пример #8
0
import asyncio
import time
from collections import deque

from telethon.tl.functions.channels import LeaveChannelRequest

from fridaybot import CMD_HELP
from fridaybot.utils import friday_on_cmd


@friday.on(friday_on_cmd("leave$"))
async def leave(e):
    if e.fwd_from:
        return
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        await e.edit("`I iz Leaving dis Lol Group kek!`")
        time.sleep(3)
        if "-" in str(e.chat_id):
            await bot(LeaveChannelRequest(e.chat_id))
        else:
            await e.edit("`But Boss! This is Not A Chat`")


@friday.on(friday_on_cmd(";__;$"))
# @register(outgoing=True, pattern="^;__;$")
async def fun(e):
    if e.fwd_from:
        return
    t = ";__;"
    for j in range(10):
        t = t[:-1] + "_;"
Пример #9
0
"""COMMAND : .eye"""

import asyncio

from fridaybot.utils import friday_on_cmd


@friday.on(friday_on_cmd(pattern="eye"))
async def _(event):

    if event.fwd_from:

        return

    animation_interval = 3

    animation_ttl = range(0, 103)

    # input_str = event.pattern_match.group(1)

    # if input_str == "eye":

    await event.edit("👁👁")

    animation_chars = [
        "👁👁\n  👄  =====> Abey Ja Na Gandu",
        "👁👁\n  👅  =====> Abey Ja Na Madarchod",
        "👁👁\n  💋  =====> Abey Ja Na Randi",
        "👁👁\n  👄  =====> Abey Ja Na Betichod",
        "👁👁\n  👅  =====> Abey Ja Na Behenchod",
        "👁👁\n  💋  =====> Abey Ja Na Na Mard",
Пример #10
0
                current_saved_welcome_message.format(
                    mention=mention,
                    title=title,
                    count=count,
                    first=first,
                    last=last,
                    fullname=fullname,
                    username=username,
                    userid=userid,
                ),
                file=cws.media_file_id,
            )
            update_previous_welcome(event.chat_id, current_message.id)


@friday.on(friday_on_cmd(pattern="savewelcome"))
async def _(event):
    if event.fwd_from:
        return
    msg = await event.get_reply_message()
    if msg and msg.media:
        bot_api_file_id = pack_bot_file_id(msg.media)
        add_welcome_setting(event.chat_id, msg.message, True, 0, bot_api_file_id)
        await event.edit("Welcome note saved. ")
    else:
        input_str = event.text.split(None, 1)
        add_welcome_setting(event.chat_id, input_str[1], True, 0, None)
        await event.edit("Welcome note saved. ")


@friday.on(friday_on_cmd(pattern="clearwelcome$"))  # pylint:disable=E0602
Пример #11
0
import asyncio
import os

import wget
from youtubesearchpython import SearchVideos

from fridaybot import CMD_HELP
from fridaybot.Configs import Config
from fridaybot.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
Пример #12
0
                int(snip.media_access_hash),
                snip.media_file_reference,
            )
        else:
            media = None
        message_id = event.message.id
        if event.reply_to_msg_id:
            message_id = event.reply_to_msg_id
        await borg.send_message(event.chat_id,
                                snip.reply,
                                reply_to=message_id,
                                file=media)
        await event.delete()


@friday.on(friday_on_cmd("snips (.*)"))
async def on_snip_save(event):
    name = event.pattern_match.group(1)
    msg = await event.get_reply_message()
    if msg:
        snip = {"type": TYPE_TEXT, "text": msg.message or ""}
        if msg.media:
            media = None
            if isinstance(msg.media, types.MessageMediaPhoto):
                media = utils.get_input_photo(msg.media.photo)
                snip["type"] = TYPE_PHOTO
            elif isinstance(msg.media, types.MessageMediaDocument):
                media = utils.get_input_document(msg.media.document)
                snip["type"] = TYPE_DOCUMENT
            if media:
                snip["id"] = media.id
Пример #13
0
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError

from fridaybot import CMD_HELP
from fridaybot.utils import edit_or_reply, friday_on_cmd, sudo_cmd
import json
from fridaybot import CMD_HELP
import requests

@friday.on(friday_on_cmd(pattern="bible ?(.*)"))
@friday.on(sudo_cmd(pattern="bible ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    if input_str is None:
      await edit_or_reply(event, "Input Not Found. 🤦")
    try:
      Hitler = input_str.split(":",2)
      book = (Hitler[0])
      cr = (Hitler[1])
      ve = (Hitler[2])
    except:
      await edit_or_reply(event, "Input Not Proper. Give Input in the form of `.bible bookName:chapter:verse` ")
    try:
      url = f"https://bible-api.com/{book.strip()}+{cr.strip()}:{ve.strip()}"
    
      pablo = requests.get(url).json()
    
      ref = pablo.get("reference")
      mnmm = pablo.get("verses")
Пример #14
0
import os
import shutil
from re import findall

from fridaybot import CMD_HELP
from fridaybot.function.gmdl import googleimagesdownload
from fridaybot.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=", "")
Пример #15
0
#
#    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 textwrap

from PIL import Image, ImageDraw, ImageFont
from telethon.tl.types import MessageMediaPhoto

from fridaybot.utils import friday_on_cmd

sedpath = Config.TMP_DOWNLOAD_DIRECTORY


@friday.on(friday_on_cmd(pattern="memify (.*)"))
async def starkmeme(event):
    hmm = event.pattern_match.group(1)
    if hmm == None:
        await event.edit("Give Some Text")
        return
    if not event.reply_to_msg_id:
        await event.edit("`PLease, Reply To A MsG`")
        return
    mryeast = await event.edit("Making Memes Until Praise MrBeast.")
    response = await event.get_reply_message()
    name = response.media
    if response and response.media:
        if isinstance(response.media, MessageMediaPhoto):
            seds = await borg.download_media(name, sedpath)
        elif "image" in response.media.document.mime_type.split("/"):
Пример #16
0
"""Download & Upload Images on Telegram\n
Syntax: `.img <Name>` or `.img (replied message)`
\n Upgraded and Google Image Error Fixed
"""

import os
import shutil
from re import findall

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


@friday.on(friday_on_cmd(pattern="(img|image|googleimage|gi) ?(.*)"))
@friday.on(
    sudo_cmd(pattern="(img|image|googleimage|gi) ?(.*)", allow_sudo=True))
async def img_sampler(event):
    await edit_or_reply(event, "`Processing...`")
    reply = await event.get_reply_message()
    if event.pattern_match.group(2):
        query = event.pattern_match.group(2)
    elif reply:
        query = reply.message
    else:
        await edit_or_reply(
            event,
            "`um, mind mentioning what I actually need to search for ;_;`")
        return

    lim = findall(r"lim=\d+", query)
Пример #17
0
def time_formatter(milliseconds: int) -> str:
    """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(?: |$)(.*)", outgoing=True))
@friday.on(sudo_cmd(pattern="download(?: |$)(.*)", allow_sudo=True))
async def download(target_file):
    """ For .dl command, download files to the fridaybot's server. """
    friday = await edit_or_reply(target_file, "`Processing ...`")
    await friday.edit("Processing using fridaybot server ( ◜‿◝ )♡")
    input_str = target_file.pattern_match.group(1)
    if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
        os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
    if "|" in input_str:
        url, file_name = input_str.split("|")
        url = url.strip()
        # https://stackoverflow.com/a/761825/4723940
        file_name = file_name.strip()
        head, tail = os.path.split(file_name)
        if head:
Пример #18
0
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    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/>.

from geopy.geocoders import Nominatim
from telethon.tl import types
import requests
import urllib.parse
from fridaybot import CMD_HELP
from fridaybot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd(pattern="gps ?(.*)"))
@friday.on(sudo_cmd(pattern="gps ?(.*)", allow_sudo=True))
async def gps(event):
    if event.fwd_from:
        return
    starkislub = await edit_or_reply(event, "Processing")
    if event.fwd_from:
        return
    reply_to_id = event.message
    if event.reply_to_msg_id:
        reply_to_id = await event.get_reply_message()
    address = event.pattern_match.group(1)
    if not address:
        return await starkislub.edit("`Give Input Location.`")
    await starkislub.edit("`Searching..`")
    url = 'https://nominatim.openstreetmap.org/search/' + urllib.parse.quote(
Пример #19
0
"""Emoji
Available Commands:
.support
Credits to noone
"""


import asyncio

from fridaybot import CMD_HELP
from fridaybot.utils import friday_on_cmd


@friday.on(friday_on_cmd("friday"))
async def _(event):
    if event.fwd_from:
        return
    animation_interval = 0.1
    animation_ttl = range(0, 36)
    # input_str = event.pattern_match.group(1)
    # if input_str == "support":
    await event.edit("for our support group")
    animation_chars = [
        "Click here",
        "[Support Group](https://t.me/FRIDAYSUPPORTOFFICIAL)",
    ]

    for i in animation_ttl:

        await asyncio.sleep(animation_interval)
        await event.edit(animation_chars[i % 18])
Пример #20
0
from telethon.tl.functions.messages import GetStickerSetRequest
from telethon.tl.types import (
    DocumentAttributeSticker,
    InputStickerSetID,
    InputStickerSetShortName,
    MessageMediaPhoto,
)

from fridaybot import ALIVE_NAME
from fridaybot.utils import edit_or_reply, friday_on_cmd, sudo_cmd

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 = "😎"
    input_str = event.pattern_match.group(1)
Пример #21
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 fridaybot import CMD_HELP
from fridaybot.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):
    if event.fwd_from:
        return
    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
Пример #22
0
# credits: SNAPDRAGON (@s_n_a_p_s)
import asyncio
import time
from fridaybot.utils import friday_on_cmd
from fridaybot import CMD_HELP


@borg.on(
    friday_on_cmd(
        pattern=
        "^.webupload ?(.+?|) (?:--)(anonfiles|transfer|filebin|anonymousfiles|megaupload|bayfiles|ninja)"
    ))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("`Processing ...`")
    PROCESS_RUN_TIME = 100
    input_str = event.pattern_match.group(1)
    selected_transfer = event.pattern_match.group(2)
    if input_str:
        file_name = input_str
    else:
        reply = await event.get_reply_message()
        file_name = await borg.download_media(reply.media,
                                              Config.TEMP_DOWNLOAD_DIRECTORY)
    CMD_WEB = {
        "anonfiles": 'curl -F "file=@{}" https://anonfiles.com/api/upload',
        "transfer":
        'curl --upload-file "{}" https://transfer.sh/{os.path.basename(file_name)}',
        "filebin":
        'curl -X POST --data-binary "@test.png" -H "filename: {}" "https://filebin.net"',
Пример #23
0
import os
from datetime import datetime

import requests
from bs4 import BeautifulSoup
from google_images_download import google_images_download

from fridaybot.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 = " "
Пример #24
0
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    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 requests
from fridaybot import CMD_HELP
from fridaybot.utils import edit_or_reply, friday_on_cmd, sudo_cmd
import os


#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 Friday.\nGet Your Own Friday From @FRIDAYCHAT."
    fole = "FRIDAYOT.jpg"
    await borg.send_file(event.chat_id, fole, caption=captin)
    await event.delete()
Пример #25
0
import html
from fridaybot.modules.sql_helper.gmute_sql import is_gmuted
from fridaybot.modules.sql_helper.mute_sql import is_muted, mute, unmute
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 telethon.tl.functions.messages import GetCommonChatsRequest
from telethon.tl.functions.users import GetFullUserRequest
from fridaybot import CMD_HELP, sclient
from fridaybot.utils import edit_or_reply, friday_on_cmd, sudo_cmd


@friday.on(friday_on_cmd("showcc(?: |$)(.*)"))
async def _(event):
    user_s, error = await get_full_user(event)
    if user_s is None:
        await event.edit("`Something Went Really Wrong !`")
        return
    if user_s.common_chats_count == 0:
        await event.edit("**No Chats in Common !**")
        return
    sed = await event.client(
        GetCommonChatsRequest(user_id=user_s.user.id, max_id=0, limit=100))
    lol = f"**User-ID :** `{user_s.user.id}` \n**First-Name :** `{user_s.user.first_name}` \n**Total Groups In Common :** `{user_s.common_chats_count}` \n\n"
    for stark in sed.chats:
        try:
            lol += f"**Chat ID :** `{stark.id}` \n**Chat Name :** `{stark.title}` \n**Chat-UserName :** `{stark.username}` \n\n"
        except:
            lol += f"**Chat ID :** `{stark.id}` \n**Chat Name :** `{stark.title}` \n\n"
    await event.edit(lol)
Пример #26
0
import asyncio

import requests
from bs4 import BeautifulSoup
from telethon.errors.rpcerrorlist import (
    UserAlreadyParticipantError,
    YouBlockedUserError,
)
from telethon.tl.functions.channels import JoinChannelRequest
from telethon.tl.functions.messages import ImportChatInviteRequest

from fridaybot.utils import friday_on_cmd


@friday.on(friday_on_cmd("phd ?(.*)"))
async def _(event):

    if event.fwd_from:

        return

    d_link = event.pattern_match.group(1)

    r = requests.get(d_link)

    soup = BeautifulSoup(r.content, "html.parser")

    temporary_variable = soup.find("span", {"class": "inlineFree"})

    title = temporary_variable.text
Пример #27
0
DEFAULTUSER = (str(ALIVE_NAME)
               if ALIVE_NAME else "Set ALIVE_NAME in config vars in Heroku")
CUSTOM_MIDDLE_PMP = (str(CUSTOM_PMPERMIT)
                     if CUSTOM_PMPERMIT else "Protection By Friday 🇮🇳")
USER_BOT_WARN_ZERO = "You Have Attempted To Spam Masters Inbox So Inorder To Avoid Over Spam , You Have Been Blocked By Userbot"

botisnoob = Var.TG_BOT_USER_NAME_BF_HER

USER_BOT_NO_WARN = (
    "**Hello, This is Friday PM Protection Service ⚠️**\n\n"
    f"`My Master {DEFAULTUSER} is Busy Right Now !` \n"
    "**I Request You To Choose A Reason You Have Came For** 👀 \n\n"
    f"**{CUSTOM_MIDDLE_PMP}**")
if Var.PRIVATE_GROUP_ID is not None:

    @borg.on(friday_on_cmd(pattern="(a|approve)"))
    async def block(event):
        if event.fwd_from:
            return
        replied_user = await borg(GetFullUserRequest(event.chat_id))
        firstname = replied_user.user.first_name
        chats = await event.get_chat()
        if event.is_private:
            if not pmpermit_sql.is_approved(chats.id):
                if chats.id in PM_WARNS:
                    del PM_WARNS[chats.id]
                if chats.id in PREV_REPLY_MESSAGE:
                    await PREV_REPLY_MESSAGE[chats.id].delete()
                    del PREV_REPLY_MESSAGE[chats.id]
                pmpermit_sql.approve(chats.id, "Approved Another Nibba")
                await event.edit("Approved to pm [{}](tg://user?id={})".format(
Пример #28
0
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    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/>.

from anime_downloader.sites import get_anime_class

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

from mal import AnimeSearch, Anime, MangaSearch, Manga


@friday.on(friday_on_cmd(pattern="anime ?(.*)"))
@friday.on(sudo_cmd(pattern="anime ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    ommhg = await edit_or_reply(event, "Searching For Anime.....")
    lmao = input_str.split(":", 1)
    try:
        site = lmao[1]
    except:
        site = "animeonline360"
        await edit_or_reply(
            event,
            "Please Provide Site Name From Next Time. Now Continuing With Default Site."
        )
Пример #29
0
                        snip.media_file_reference,
                    )
                else:
                    media = None
                event.message.id
                if event.reply_to_msg_id:
                    event.reply_to_msg_id
                await event.reply(snip.reply, file=media)
                if event.chat_id not in last_triggered_filters:
                    last_triggered_filters[event.chat_id] = []
                last_triggered_filters[event.chat_id].append(name)
                await asyncio.sleep(DELETE_TIMEOUT)
                last_triggered_filters[event.chat_id].remove(name)


@friday.on(friday_on_cmd(pattern="filter (.*)"))
@friday.on(sudo_cmd(pattern="filter (.*)", allow_sudo=True))
async def on_snip_save(event):
    if event.fwd_from:
        return
    hitler = await edit_or_reply(event, "Processing....")
    name = event.pattern_match.group(1)
    msg = await event.get_reply_message()
    if msg:
        snip = {"type": TYPE_TEXT, "text": msg.message or ""}
        if msg.media:
            media = None
            if isinstance(msg.media, types.MessageMediaPhoto):
                media = utils.get_input_photo(msg.media.photo)
                snip["type"] = TYPE_PHOTO
            elif isinstance(msg.media, types.MessageMediaDocument):
Пример #30
0
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 fridaybot import CMD_HELP, sclient
from fridaybot.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