Пример #1
0
import wikipedia

from jarvis.utils import admin_cmd, sudo_cmd


@jarvis.on(admin_cmd(pattern="wikipedia (.*)"))
@jarvis.on(sudo_cmd(pattern="wikipedia (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    await eor(event, "Processing ...")
    input_str = event.pattern_match.group(1)
    result = ""
    results = wikipedia.search(input_str)
    for s in results:
        page = wikipedia.page(s)
        url = page.url
        result += f"> [{s}]({url}) \n"
    await event.edit(
        "Wikipedia **Search**: {} \n\n **Result**: \n\n{}".format(input_str, result)
    )
Пример #2
0
"""Profile Updation Commands
.pbio <Bio>
.pname <Name>
.ppic"""
import os
from telethon import events
from telethon.tl import functions
from jarvis.utils import admin_cmd


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


@jarvis.on(admin_cmd(pattern="pname ((.|\n)*)"))  # pylint:disable=E0602,W0703
async def _(event):
    if event.fwd_from:
        return
    names = event.pattern_match.group(1)
    first_name = names
    last_name = ""
Пример #3
0
        if seconds == 0 and remainder == 0:
            break
        time_list.append(int(result))
        seconds = int(remainder)

    for x in range(len(time_list)):
        time_list[x] = str(time_list[x]) + time_suffix_list[x]
    if len(time_list) == 4:
        ping_time += time_list.pop() + ", "

    time_list.reverse()
    ping_time += ":".join(time_list)

    return ping_time


@jarvis.on(admin_cmd(pattern="uptime", outgoing=True))
@jarvis.on(sudo_cmd(pattern="uptime", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    await edit_or_reply(event, "Calculating Last Update or Restart Time")
    end = datetime.now()
    (end - start).microseconds / 1000
    uptime = get_readable_time((time.time() - Lastupdate))
    await edit_or_reply(
        event,
        f"🎖�JARVIS Userbot🎖� Has Been Restarted Or Updated {uptime} Ago !"
    )
Пример #4
0
"""Emoji

Available Commands:

.think"""

from telethon import events

import asyncio

from jarvis.utils import admin_cmd

@jarvis.on(admin_cmd("think"))
async def _(event):
    if event.fwd_from:
        return
    animation_interval = 0.1
    animation_ttl = range(0, 288)
    
    #await event.edit(input_str)
    await event.edit("thinking")
    animation_chars = [
            "THINKING",
            "THI&K#N₹",
            "T+IN@I?G",
            "¿H$NK∆NG",
            "¶H×NK&N*",
            "NGITHKIN",
            "T+I#K@₹G",
            "THINKING",
            "THI&K#N₹",
Пример #5
0
from coffeehouse.lydia import LydiaAI
from telethon import events

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd

# Non-SQL Mode
ACC_LYDIA = {}
SESSION_ID = {}

if Var.LYDIA_API_KEY:
    api_key = Var.LYDIA_API_KEY
    api_client = coffeehouse.API(api_key)
    Lydia = LydiaAI(api_client)


@jarvis.on(admin_cmd(pattern="repcf", outgoing=True))
@jarvis.on(sudo_cmd(pattern="repcf", allow_sudo=True))
async def repcf(event):
    if event.fwd_from:
        return
    await edit_or_reply(event, "Processing...")
    try:
        session = Lydia.create_session()
        session_id = session.id
        reply = await event.get_reply_message()
        msg = reply.text
        text_rep = session.think_thought((session_id, msg))
        await edit_or_reply(event, " {0}".format(text_rep))
    except Exception as e:
        await edit_or_reply(event, str(e))
Пример #6
0
from telethon import events
import random, re
from jarvis.utils import admin_cmd, sudo_cmd

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!`",
]


@jarvis.on(admin_cmd(pattern="congo"))
@jarvis.on(sudo_cmd(outgoing=True, 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 event.edit(reply_text)
Пример #7
0
from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import MessageEntityMentionName

from jarvis import ALIVE_NAME, CMD_HELP
from jarvis.utils import admin_cmd

DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Jarvis"
DEFAULTUSERBIO = "404: No bio found!˙"
if Config.PRIVATE_GROUP_BOT_API_ID is None:
    BOTLOG = False
else:
    BOTLOG = True
    BOTLOG_CHATID = Config.PRIVATE_GROUP_BOT_API_ID


@jarvis.on(admin_cmd(pattern="clone ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    reply_message = await event.get_reply_message()
    replied_user, error_i_a = await get_full_user(event)
    if replied_user is None:
        await event.edit(str(error_i_a))
        return False
    user_id = replied_user.user.id
    profile_pic = await event.client.download_profile_photo(
        user_id, Config.TMP_DOWNLOAD_DIRECTORY
    )
    # some people have weird HTML in their names
    first_name = html.escape(replied_user.user.first_name)
    # https://stackoverflow.com/a/5072031/4723940
Пример #8
0
import datetime
import asyncio
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError, UserAlreadyParticipantError
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from telethon.tl.functions.messages import ImportChatInviteRequest
from jarvis.utils import admin_cmd
import time
from jarvis import ALIVE_NAME

naam = str(ALIVE_NAME)

bot = "@jarvisotbot"


@jarvis.on(admin_cmd("jarvis ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    sysarg = event.pattern_match.group(1)

    if sysarg == "hello":
        async with borg.conversation(bot) as conv:
            try:
                await conv.send_message("/start")
                response = await conv.get_response()
                await conv.send_message("hello")
                audio = await conv.get_response()
                await borg.send_file(
                    event.chat_id,
                    audio,
Пример #9
0
    send_messages=None,
    send_media=None,
    send_stickers=None,
    send_gifs=None,
    send_games=None,
    send_inline=None,
    embed_links=None,
)

MUTE_RIGHTS = ChatBannedRights(until_date=None, send_messages=True)

UNMUTE_RIGHTS = ChatBannedRights(until_date=None, send_messages=False)
# ================================================


@jarvis.on(admin_cmd(pattern=f"zombies", allow_sudo=True))
@jarvis.on(events.NewMessage(pattern="^.zombies(?: |$)(.*)", outgoing=True))
async def rm_deletedacc(show):
    """ For .zombies command, list all the ghost/deleted/zombie accounts in a chat. """

    con = show.pattern_match.group(1).lower()
    del_u = 0
    del_status = "`No deleted accounts found, Group is clean`"

    if con != "clean":
        await show.edit("`Searching for ghost/deleted/zombie accounts...`")
        async for user in show.client.iter_participants(show.chat_id):

            if user.deleted:
                del_u += 1
                await sleep(1)
Пример #10
0
    file_id = file_id[1:]
    return file_id


async def get_file_name(content):
    file_name = ""
    c_append = False
    for c in str(content):
        if c == '"':
            c_append = True
        if c == ";":
            c_append = False
        if c_append:
            file_name = file_name + c
    file_name = file_name.replace('"', "")
    print("File Name: " + str(file_name))
    return file_name


@jarvis.on(events.NewMessage(pattern=r"\.gdl", outgoing=True))
@jarvis.on(admin_cmd(pattern=r"\.gdl", allow_sudo=True))
async def g_download(event):
    if event.fwd_from:
        return
    drive_link = event.text[4:]
    print("Drive Link: " + drive_link)
    file_id = await get_id(drive_link)
    await event.reply("Downloading Requested File from G-Drive...")
    file_name = await download_file_from_google_drive(file_id)
    await event.reply("File Downloaded.\nName: `" + str(file_name) + "`")
Пример #11
0
"""Emoji

Available Commands:

.ding"""

from telethon import events

import asyncio

from jarvis.utils import admin_cmd, sudo_cmd


@jarvis.on(admin_cmd(pattern=r"ding", allow_sudo=True))
async def _(event):

    if event.fwd_from:

        return

    animation_interval = 0.5

    animation_ttl = range(0, 10)

    #input_str = event.pattern_match.group(1)

    #if input_str == "ding":

    await event.edit("dong")

    animation_chars = [
Пример #12
0
"""COMMAND : .cd, .scd, .padmin"""

import asyncio

from telethon import events

from jarvis.utils import admin_cmd


@jarvis.on(admin_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:
Пример #13
0
# ====================
async def get_tz(con):
    """ Get time zone of the given country. """
    """ Credits: @aragon12 and @zakaryan2004. """
    for c_code in c_n:
        if con == c_n[c_code]:
            return tz(c_tz[c_code][0])
    try:
        if c_n[con]:
            return tz(c_tz[con][0])
    except KeyError:
        return


@jarvis.on(admin_cmd(outgoing=True, pattern="weather(?: |$)(.*)"))
@jarvis.on(sudo_cmd(allow_sudo=True, pattern="weather(?: |$)(.*)"))
@errors_handler
async def get_weather(weather):
    """ For .weather command, gets the current weather of a city. """

    if not OWM_API:
        await edit_or_reply(
            weather,
            "`Get an API key from` https://openweathermap.org/ `first.`")
        return

    APPID = OWM_API

    if not weather.pattern_match.group(1):
        CITY = DEFCITY
Пример #14
0
"""Get weather data using OpenWeatherMap
Syntax: .weather <Location>
.wttr <location> """

import aiohttp
import io
import time
from datetime import tzinfo, datetime
from jarvis.utils import admin_cmd


@jarvis.on(admin_cmd(pattern="weathers (.*)"))
@jarvis.on(admin_cmd(pattern="weathers (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    sample_url = "https://api.openweathermap.org/data/2.5/weather?q={}&APPID={}&units=metric"
    input_str = event.pattern_match.group(1)
    async with aiohttp.ClientSession() as session:
        response_api_zero = await session.get(
            sample_url.format(input_str, Config.OPEN_WEATHER_MAP_APPID))
    response_api = await response_api_zero.json()
    if response_api["cod"] == 200:
        country_code = response_api["sys"]["country"]
        country_time_zone = int(response_api["timezone"])
        sun_rise_time = int(response_api["sys"]["sunrise"]) + country_time_zone
        sun_set_time = int(response_api["sys"]["sunset"]) + country_time_zone
        await event.reply("""{}
**Temperature**: {}°С
    __minimium__: {}°С
    __maximum__ : {}°С
Пример #15
0
    fy = "http://getwallpapers.com" + random.choice(f)

    print(fy)

    if not os.path.exists("f.ttf"):

        urllib.request.urlretrieve(
            "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf",
            "f.ttf",
        )

    urllib.request.urlretrieve(fy, "donottouch.jpg")


@jarvis.on(admin_cmd(pattern="hackerdp ?(.*)", outgoing=True))
@jarvis.on(sudo_cmd(pattern="hackerdp ?(.*)", allow_sudo=True))
async def main(event):

    await edit_or_reply(
        event, "**Starting Hacker Profile Pic...\n\nDone !!! Check Your DP"
    )  # Owner MarioDevs

    while True:

        await animepp()

        file = await event.client.upload_file("donottouch.jpg")

        await event.client(functions.photos.UploadProfilePhotoRequest(file))
Пример #16
0
# Credits :- Catuserbot Made By @Sandy1709
from geopy.geocoders import Nominatim
from telethon.tl import types

from jarvis import CMD_HELP
from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd(pattern="gps ?(.*)", outgoing=True))
@jarvis.on(sudo_cmd(pattern="gps ?(.*)", allow_sudo=True))
async def gps(event):
    if event.fwd_from:
        return
    reply_to_id = event.message
    if event.reply_to_msg_id:
        reply_to_id = await event.get_reply_message()
    input_str = event.pattern_match.group(1)

    if not input_str:
        return await edit_or_reply(event,
                                   "Boss ! Give A Place To Search 😔 !.")

    await edit_or_reply(event, "Finding This Location In Maps Server.....")

    geolocator = Nominatim(user_agent="ios")
    geoloc = geolocator.geocode(input_str)

    if geoloc:
        lon = geoloc.longitude
        lat = geoloc.latitude
        await reply_to_id.reply(input_str,
Пример #17
0
                     )[metadata.has("duration")] / 2)),
            # '-filter:v', 'scale={}:-1'.format(width),
            "-vframes",
            "1",
            output,
        ],
        stdout=subprocess.PIPE,
        stderr=subprocess.DEVNULL,
    )
    p.communicate()
    if not p.returncode and os.path.lexists(file):
        os.remove(file)
        return output


@jarvis.on(admin_cmd(pattern="savethumbnail"))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("Processing ...")
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    if event.reply_to_msg_id:
        downloaded_file_name = await borg.download_media(
            await event.get_reply_message(), Config.TMP_DOWNLOAD_DIRECTORY)
        if downloaded_file_name.endswith(".mp4"):
            downloaded_file_name = get_video_thumb(downloaded_file_name)
        metadata = extractMetadata(createParser(downloaded_file_name))
        height = 0
        if metadata.has("height"):
            height = metadata.get("height")
Пример #18
0
# (c) @UniBorg
# Original written by @UniBorg edit by @INF1N17Y

import asyncio
from collections import deque

from jarvis.utils import admin_cmd


@jarvis.on(admin_cmd(pattern=r"clock"))
async def _(event):
    if event.fwd_from:
        return
    deq = deque(list("🕛🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚"))
    for _ in range(60):
        await asyncio.sleep(0.1)
        await event.edit("".join(deq))
        deq.rotate(1)
Пример #19
0
"""Get ID of any Telegram media, or any user
Syntax: .get_id"""
from telethon.utils import pack_bot_file_id

from jarvis.utils import admin_cmd, sudo_cmd


@jarvis.on(admin_cmd("get_id", outgoing=True))
@jarvis.on(sudo_cmd("get_id", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if event.reply_to_msg_id:
        await event.get_input_chat()
        r_msg = await event.get_reply_message()
        if r_msg.media:
            bot_api_file_id = pack_bot_file_id(r_msg.media)
            await event.reply(
                "Current Chat ID: `{}`\nFrom User ID: `{}`\nBot API File ID: `{}`".format(
                    str(event.chat_id), str(r_msg.from_id), bot_api_file_id
                )
            )
        else:
            await event.reply(
                "Current Chat ID: `{}`\nFrom User ID: `{}`".format(
                    str(event.chat_id), str(r_msg.from_id)
                )
            )
    else:
        await event.reply("Current Chat ID: `{}`".format(str(event.chat_id)))
Пример #20
0
ARTIST = 0
SONG = 0
USER_ID = 0

if BIO_PREFIX:
    BIOPREFIX = BIO_PREFIX
else:
    BIOPREFIX = None

LASTFMCHECK = False
RUNNING = False
LastLog = False
# ================================================


@jarvis.on(admin_cmd(outgoing=True, pattern="lastfm$"))
@jarvis.on(sudo_cmd(allow_sudo=True, pattern="lastfm$"))
async def last_fm(lastFM):
    """ For .lastfm command, fetch scrobble data from last.fm. """
    if not lastFM.text[0].isalpha() and lastFM.text[0] not in ("/", "#", "@",
                                                               "!"):
        await edit_or_reply(lastFM, "Processing...")
        preview = None
        playing = User(LASTFM_USERNAME, lastfm).get_now_playing()
        username = f"https://www.last.fm/user/{LASTFM_USERNAME}"
        if playing is not None:
            try:
                image = (User(LASTFM_USERNAME,
                              lastfm).get_now_playing().get_cover_image())
            except IndexError:
                image = None
Пример #21
0
#  (c)2020 JARVIS
#
# You may not use this plugin without proper authorship and consent from @JarvisSupportOt
#
# Creted by @buddhhu, @itzsjdude, @xditya
#
import asyncio
import os

from jarvis.utils import admin_cmd


@jarvis.on(admin_cmd(pattern="repack ?(.*)", outgoing=True))
async def _(event):
    a = await event.get_reply_message()
    input_str = event.pattern_match.group(1)
    b = open(input_str, "w")
    b.write(str(a.message))
    b.close()
    a = await event.reply(f"**Packing into** `{input_str}`")
    await asyncio.sleep(2)
    await a.edit(f"**Uploading** `{input_str}`")
    await asyncio.sleep(2)
    await event.client.send_file(event.chat_id, input_str)
    await a.delete()
    os.remove(input_str)
Пример #22
0
# For @UniBorg
# Courtesy @yasirsiddiqui
"""
.bye
"""
import time

from telethon.tl.functions.channels import LeaveChannelRequest

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd("bye", outgoing=True))
@jarvis.on(sudo_cmd("bye", allow_sudo=True))
async def leave(e):
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        await edit_or_reply(e, "`I am leaving this chat.....!`")
        time.sleep(3)
        if "-" in str(e.chat_id):
            await bot(LeaveChannelRequest(e.chat_id))
        else:
            await e.edit("`Sir This is Not A Chat`")
Пример #23
0
KANGING_STR = [
    "Using Witchery to kang this sticker...",
    "Plagiarising hehe...",
    "Inviting this sticker over to my pack...",
    "Kanging this sticker...",
    "Hey that's a nice sticker!\nMind if I kang?!..",
    "hehe me stel ur stikér\nhehe.",
    "Ay look over there (☉。☉)!→\nWhile I kang this...",
    "Roses are red violets are blue, kanging this sticker so my pacc looks cool",
    "Imprisoning this sticker...",
    "Mr.Steal Your Sticker is stealing this sticker... ",
]


@jarvis.on(admin_cmd(pattern="kang ?(.*)"))
async def kang(args):
    """ For .kang command, kangs stickers or creates new ones. """
    user = await jbot.get_me()
    if not user.username:
        try:
            user.first_name.encode("utf-8").decode("ascii")
            user.username = user.first_name
        except UnicodeDecodeError:
            user.username = f"cat_{user.id}"
    message = await args.get_reply_message()
    photo = None
    emojibypass = False
    is_anim = False
    emoji = None
    if message and message.media:
Пример #24
0
"""Emoji

Available Commands:

.ding"""

import asyncio

from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd


@jarvis.on(admin_cmd(pattern=r"ding", outgoing=True))
@jarvis.on(sudo_cmd(pattern=r"ding", allow_sudo=True))
async def _(event):

    if event.fwd_from:

        return

    animation_interval = 0.5

    animation_ttl = range(0, 10)

    # input_str = event.pattern_match.group(1)

    # if input_str == "ding":

    await edit_or_reply(event, "dong")

    animation_chars = [
        "🔴⬛⬛⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜",
Пример #25
0
"""Check your internet speed powered by speedtest.net
Syntax: .speedtest
Available Options: image, file, text"""
from datetime import datetime

import speedtest

from jarvis.utils import admin_cmd, eor, sudo_cmd


@jarvis.on(admin_cmd("speed ?(.*)", outgoing=True))
@jarvis.on(sudo_cmd("speed ?(.*)", allow_sudo=True))
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 eor(event, "`Calculating my internet speed. Please wait!`")
    start = datetime.now()
    s = speedtest.Speedtest()
    s.get_best_server()
    s.download()
    s.upload()
    end = datetime.now()
Пример #26
0
import asyncio
import datetime
import asyncio
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError, UserAlreadyParticipantError
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from jarvis.utils import admin_cmd, sudo_cmd
from jarvis import CMD_HELP


@jarvis.on(admin_cmd(pattern="purl ?(.*)"))
@jarvis.on(sudo_cmd(outgoing=True, pattern="purl ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if not event.reply_to_msg_id:
        await event.edit("**Reply to any document.**")
        return
    reply_message = await event.get_reply_message()
    chat = "@FiletolinkTGbot"
    sender = reply_message.sender
    await event.edit("**Making public url...**")
    async with event.client.conversation(chat) as conv:
        try:
            response = conv.wait_event(
                events.NewMessage(incoming=True, from_users=1011636686))
            await event.client.forward_messages(chat, reply_message)
            response = await response
        except YouBlockedUserError:
            await event.reply(
                "```Please unblock me (@FiletolinkTGbot) u N***a```")
Пример #27
0
from telethon import events
import asyncio
import os
import sys
from jarvis.utils import admin_cmd

@jarvis.on(admin_cmd(pattern=r"gaali",allow_sudo=True))
async def test(event):
    if event.fwd_from:
        return 
    await event.edit("`Main roz teri behno ki banjar chut me apna lawda daalke andar haryali lata tha magar aaj unke ke baare me sunke mujhe bhut afsos huwa ki unko ab bada loudha chahye ab mera balatkaaari lawda lagataar 4 ghante tk apne muh me kon rakhega vo teri behne hi thi jo apni kaali magar rasilli chut mere saamne khol deti aur zameen pe naagin ki tarah rengne lgti thi jaise ki kisine unki chut pe naariyal tod diya ho vo b bada wala mumbai ka naariyal..apni chennal maa ko b nhi bhej rahe mere paas to main kaixe tum logo se vaada karu ki main teri maa chodd dungaw ab agar tun sach me chahta hai ki main tum dono k mc ki chut me dhammal karu to mera lawda apne muh me rakho aur kaho Sameer hamare sage papa hain Aur agar tb b tjhe apni maa ki kaali chut mere saamne nahi rakhi to tumhare ghar me ghuske tumhari maa ka balatkaar kar dungaw jaixe delhi me huwa tha ab teri chudi hui kuttiyo ki tarah apni gaand hilaate hue mere aage kalapna mt ni to tumhari fatti bhoxdi me 100 ched karunga!`")      
Пример #28
0
# By @HeisenbergTheDanger for TeleBot
# @its_xditya
# Kangers keep credits

from jarvis.utils import admin_cmd


@jarvis.on(admin_cmd("pmto ?(.*)"))
async def pmto(event):
    a = event.pattern_match.group(1)
    b = a.split(" ")
    chat_id = b[0]
    try:
        chat_id = int(chat_id)
    except:
        pass
    msg = ""
    for i in b[1:]:
        msg += (i + " ")
    if msg == "":
        return
    try:
        await borg.send_message(chat_id, msg)
        await event.edit("Message sent!")
    except:
        await event.edit("Something went wrong.")
Пример #29
0
import asyncio

from telethon.tl.types import InputMediaUploadedPhoto

from jarvis.plugins.sql_helper.broadcast_sql import (
    add_channel,
    get_all_channels,
    in_channels,
    rm_channel,
)
from jarvis.utils import admin_cmd, edit_or_reply, sudo_cmd

logs_id = Var.PLUGIN_CHANNEL


@jarvis.on(admin_cmd("bforward ?(.*)", outgoing=True))
@jarvis.on(sudo_cmd("bforward ?(.*)", allow_sudo=True))
async def forw(event):
    if event.fwd_from:
        return
    if not event.is_reply:
        await edit_or_reply(event, "Reply to a message to broadcast.")
        return
    channels = get_all_channels()
    await event.edit("Sending...")
    error_count = 0
    sent_count = 0
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        previous_message.message
        previous_message.raw_text
Пример #30
0
# For Uniborg
# (c) @INF1N17Y

from jarvis.utils import admin_cmd


@jarvis.on(admin_cmd("mention (.*)"))
@jarvis.on(admin_cmd("mention (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        if previous_message.forward:
            replied_user = previous_message.forward.from_id
        else:
            replied_user = previous_message.from_id
    else:
        await event.reply("reply To Message")
    user_id = replied_user
    caption = """<a href='tg://user?id={}'>{}</a>""".format(user_id, input_str)
    await event.reply(caption, parse_mode="HTML")