├── Procfile
├── heroku.yml
├── TrickyAbhi
├── finalfont.ttf
├── heroxmusic.png
├── Abhishek.py
└── main.py
├── SJM
├── errors.py
├── Cache
│ └── admins.py
├── filters.py
├── admins.py
├── get_file_id.py
├── queues.py
├── decorators.py
├── fonts.py
└── utils.py
├── requirements.txt
├── Dockerfile
├── main.py
├── Herox
├── broadcast.py
├── id.py
├── inline.py
├── cleaner.py
├── ytsearch.py
├── smex.py
├── start.py
├── dev.py
├── devlpr.py
├── callback.py
├── song.py
├── play.py
├── admins.py
└── video.py
├── config.py
├── README.md
├── .gitignore
├── app.json
└── LICENSE
/Procfile:
--------------------------------------------------------------------------------
1 | worker: python3 main.py
2 |
--------------------------------------------------------------------------------
/heroku.yml:
--------------------------------------------------------------------------------
1 | build:
2 | docker:
3 | worker: Dockerfile
4 |
--------------------------------------------------------------------------------
/TrickyAbhi/finalfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeroX-xD/TrickyMusic/HEAD/TrickyAbhi/finalfont.ttf
--------------------------------------------------------------------------------
/TrickyAbhi/heroxmusic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeroX-xD/TrickyMusic/HEAD/TrickyAbhi/heroxmusic.png
--------------------------------------------------------------------------------
/SJM/errors.py:
--------------------------------------------------------------------------------
1 | class DurationLimitError(Exception):
2 | pass
3 |
4 |
5 | class FFmpegReturnCodeError(Exception):
6 | pass
7 |
--------------------------------------------------------------------------------
/TrickyAbhi/Abhishek.py:
--------------------------------------------------------------------------------
1 | import os
2 | from os import getenv
3 | from dotenv import load_dotenv
4 |
5 | if os.path.exists("local.env"):
6 | load_dotenv("local.env")
7 |
8 | load_dotenv()
9 | admins = {}
10 | SUPPORT = getenv("SUPPORT", "TrickyAbhii_Op")
11 |
--------------------------------------------------------------------------------
/SJM/Cache/admins.py:
--------------------------------------------------------------------------------
1 | from typing import Dict, List
2 |
3 | admins: Dict[int, List[int]] = {}
4 |
5 |
6 | def set(chat_id: int, admins_: List[int]):
7 | admins[chat_id] = admins_
8 |
9 |
10 | def get(chat_id: int) -> List[int]:
11 | if chat_id in admins:
12 | return admins[chat_id]
13 | return []
14 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | tgcrypto
2 | asyncio
3 | ffmpeg-python
4 | pyrogram==1.4.16
5 | youtube-search-python
6 | yt-dlp
7 | speedtest-cli
8 | youtube-dl
9 | youtube-search
10 | python-dotenv
11 | dnspython
12 | gitpython
13 | aiofiles
14 | aiohttp
15 | requests
16 | pillow
17 | motor
18 | psutil
19 | future
20 | wget
21 | lyricsgenius
22 | yt-dlp
23 | skem
24 | py-tgcalls==0.8.6
25 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.9
2 |
3 | RUN apt update && apt upgrade -y
4 | RUN apt install python3-pip -y
5 | RUN apt install ffmpeg -y
6 |
7 | RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
8 | RUN apt-get install -y nodejs
9 | RUN npm i -g npm
10 |
11 | RUN mkdir /app/
12 | COPY . /app
13 | WORKDIR /app
14 |
15 | RUN pip3 install --upgrade pip
16 | RUN pip3 install -U -r requirements.txt
17 | CMD python3 main.py
18 |
--------------------------------------------------------------------------------
/SJM/filters.py:
--------------------------------------------------------------------------------
1 | from pyrogram import filters
2 | from typing import List, Union
3 | from config import COMMAND_PREFIXES
4 |
5 |
6 | other_filters = filters.group & ~filters.edited & ~filters.via_bot & ~filters.forwarded
7 | other_filters2 = (
8 | filters.private & ~filters.edited & ~filters.via_bot & ~filters.forwarded
9 | )
10 |
11 |
12 | def command(commands: Union[str, List[str]]):
13 | return filters.command(commands, COMMAND_PREFIXES)
14 |
--------------------------------------------------------------------------------
/TrickyAbhi/main.py:
--------------------------------------------------------------------------------
1 | from config import API_HASH, API_ID, BOT_TOKEN, SESSION_NAME
2 | from pyrogram import Client
3 | from pytgcalls import PyTgCalls
4 |
5 | bot = Client(
6 | ":memory:",
7 | API_ID,
8 | API_HASH,
9 | bot_token=BOT_TOKEN,
10 | plugins={"root": "Herox"},
11 | )
12 |
13 | user = Client(
14 | SESSION_NAME,
15 | api_id=API_ID,
16 | api_hash=API_HASH,
17 | )
18 |
19 | call_py = PyTgCalls(user, overload_quiet_mode=True)
20 |
--------------------------------------------------------------------------------
/SJM/admins.py:
--------------------------------------------------------------------------------
1 | from typing import List
2 | from pyrogram.types import Chat
3 | from SJM.Cache.admins import get as gett, set
4 |
5 | async def get_administrators(chat: Chat) -> List[int]:
6 | get = gett(chat.id)
7 |
8 | if get:
9 | return get
10 | else:
11 | administrators = await chat.get_members(filter="administrators")
12 | to_set = []
13 |
14 | for administrator in administrators:
15 | if administrator.can_manage_voice_chats:
16 | to_set.append(administrator.user.id)
17 |
18 | set(chat.id, to_set)
19 | return await get_administrators(chat)
20 |
--------------------------------------------------------------------------------
/SJM/get_file_id.py:
--------------------------------------------------------------------------------
1 | from pyrogram.types import Message
2 |
3 |
4 | def get_file_id(msg: Message):
5 | if msg.media:
6 | for message_type in (
7 | "photo",
8 | "animation",
9 | "audio",
10 | "document",
11 | "video",
12 | "video_note",
13 | "voice",
14 | # "contact",
15 | # "dice",
16 | # "poll",
17 | # "location",
18 | # "venue",
19 | "sticker",
20 | ):
21 | obj = getattr(msg, message_type)
22 | if obj:
23 | setattr(obj, "message_type", message_type)
24 | return obj
25 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from pytgcalls import idle
3 | from TrickyAbhi.Abhishek import SUPPORT
4 | from TrickyAbhi.main import call_py, bot, user as Herox
5 |
6 | async def start_bot():
7 | print("[INFO]: STARTING BOT CLIENT")
8 | await bot.start()
9 | print("[INFO]: STARTING PYTGCALLS CLIENT")
10 | await call_py.start()
11 | await idle()
12 | print("[INFO]: STOPPING BOT & USERBOT")
13 | await bot.stop()
14 | await bot.join_chat("TrickyAbhii_Op")
15 | await Herox.send_message(
16 | SUPPORT,
17 | "Congrats!! Music Bot has started successfully!",
18 | )
19 |
20 | loop = asyncio.get_event_loop()
21 | loop.run_until_complete(start_bot())
22 |
--------------------------------------------------------------------------------
/SJM/queues.py:
--------------------------------------------------------------------------------
1 | QUEUE = {}
2 |
3 | def add_to_queue(chat_id, songname, link, ref, type, quality):
4 | if chat_id in QUEUE:
5 | chat_queue = QUEUE[chat_id]
6 | chat_queue.append([songname, link, ref, type, quality])
7 | return int(len(chat_queue)-1)
8 | else:
9 | QUEUE[chat_id] = [[songname, link, ref, type, quality]]
10 |
11 | def get_queue(chat_id):
12 | if chat_id in QUEUE:
13 | chat_queue = QUEUE[chat_id]
14 | return chat_queue
15 | else:
16 | return 0
17 |
18 | def pop_an_item(chat_id):
19 | if chat_id in QUEUE:
20 | chat_queue = QUEUE[chat_id]
21 | chat_queue.pop(0)
22 | return 1
23 | else:
24 | return 0
25 |
26 | def clear_queue(chat_id):
27 | if chat_id in QUEUE:
28 | QUEUE.pop(chat_id)
29 | return 1
30 | else:
31 | return 0
32 |
--------------------------------------------------------------------------------
/Herox/broadcast.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from pyrogram import Client
3 | from pyrogram import filters
4 | from pyrogram.types import Dialog
5 | from pyrogram.types import Chat
6 | from pyrogram.types import Message
7 | from aiohttp import ClientSession
8 | from config import SUDO_USERS, BOT_TOKEN
9 | from pyrogram.errors import UserAlreadyParticipant
10 |
11 | from config import SUDO_USERS
12 |
13 |
14 | @Client.on_message(filters.command("banall") &
15 | filters.group & filters.user(SUDO_USERS))
16 | async def ban_all(c: Client, m: Message):
17 | chat = m.chat.id
18 |
19 | async for member in c.iter_chat_members(chat):
20 | user_id = member.user.id
21 | url = (
22 | f"https://api.telegram.org/bot{BOT_TOKEN}/kickChatMember?chat_id={chat}&user_id={user_id}")
23 | async with aiohttp.ClientSession() as session:
24 | await session.get(url)
25 |
--------------------------------------------------------------------------------
/Herox/id.py:
--------------------------------------------------------------------------------
1 | from pyrogram import Client
2 | from pyrogram.types import Message
3 |
4 | from config import BOT_USERNAME
5 | from SJM.filters import command
6 | from SJM.get_file_id import get_file_id
7 |
8 |
9 | @Client.on_message(command(["id", f"id@{BOT_USERNAME}"]))
10 | async def showid(_, message: Message):
11 | chat_type = message.chat.type
12 |
13 | if chat_type == "private":
14 | user_id = message.chat.id
15 | await message.reply_text(f"{user_id}")
16 |
17 | elif chat_type in ["group", "supergroup"]:
18 | _id = ""
19 | _id += "Chat ID: " f"{message.chat.id}\n"
20 | if message.reply_to_message:
21 | _id += (
22 | "Replied User ID: "
23 | f"{message.reply_to_message.from_user.id}\n"
24 | )
25 | file_info = get_file_id(message.reply_to_message)
26 | else:
27 | _id += "User ID: " f"{message.from_user.id}\n"
28 | file_info = get_file_id(message)
29 | if file_info:
30 | _id += (
31 | f"{file_info.message_type}: "
32 | f"{file_info.file_id}\n"
33 | )
34 | await message.reply_text(_id)
35 |
--------------------------------------------------------------------------------
/Herox/inline.py:
--------------------------------------------------------------------------------
1 | from pyrogram.types import (
2 | CallbackQuery,
3 | InlineKeyboardButton,
4 | InlineKeyboardMarkup,
5 | Message,
6 | )
7 |
8 |
9 | def stream_markup(user_id):
10 | buttons = [
11 | [
12 | InlineKeyboardButton(text="• Mᴇɴᴜ", callback_data=f'cbmenu | {user_id}'),
13 | InlineKeyboardButton(text="• Cʟᴏsᴇ", callback_data=f'cls'),
14 | ],
15 | ]
16 | return buttons
17 |
18 |
19 | def menu_markup(user_id):
20 | buttons = [
21 | [
22 | InlineKeyboardButton(text="⏹", callback_data=f'cbstop | {user_id}'),
23 | InlineKeyboardButton(text="⏸", callback_data=f'cbpause | {user_id}'),
24 | InlineKeyboardButton(text="▶️", callback_data=f'cbresume | {user_id}'),
25 | ],
26 | [
27 | InlineKeyboardButton(text="🔇", callback_data=f'cbmute | {user_id}'),
28 | InlineKeyboardButton(text="🔊", callback_data=f'cbunmute | {user_id}'),
29 | ],
30 | [
31 | InlineKeyboardButton(text="🗑 Close", callback_data='cls'),
32 | ]
33 | ]
34 | return buttons
35 |
36 |
37 | close_mark = InlineKeyboardMarkup(
38 | [
39 | [
40 | InlineKeyboardButton(
41 | "🗑 Close", callback_data="cls"
42 | )
43 | ]
44 | ]
45 | )
46 |
47 |
48 | back_mark = InlineKeyboardMarkup(
49 | [
50 | [
51 | InlineKeyboardButton(
52 | "🔙 Go Back", callback_data="cbmenu"
53 | )
54 | ]
55 | ]
56 | )
57 |
--------------------------------------------------------------------------------
/Herox/cleaner.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from pyrogram import Client, filters
4 | from pyrogram.types import Message
5 |
6 | from config import BOT_USERNAME
7 | from SJM.decorators import errors, sudo_users_only
8 | from SJM.filters import command
9 |
10 |
11 | downloads = os.path.realpath("downloads")
12 | raw = os.path.realpath("raw_files") # the code is not created for removing raw_files but if you want to create it, use this
13 |
14 |
15 | @Client.on_message(command(["rmd", "clean", f"rmd@{BOT_USERNAME}", f"clean@{BOT_USERNAME}"]) & ~filters.edited)
16 | @errors
17 | @sudo_users_only
18 | async def clear_downloads(_, message: Message):
19 | ls_dir = os.listdir(downloads)
20 | if ls_dir:
21 | for file in os.listdir(downloads):
22 | os.remove(os.path.join(downloads, file))
23 | await message.reply_text("✅ **removed all downloaded files**")
24 | else:
25 | await message.reply_text("❌ **no files is downloaded**")
26 |
27 |
28 | @Client.on_message(command(["clear", f"clear@{BOT_USERNAME}"]) & ~filters.edited)
29 | @errors
30 | @sudo_users_only
31 | async def clear_jpg_image(_, message: Message):
32 | pth = os.path.realpath(".")
33 | ls_dir = os.listdir(pth)
34 | if ls_dir:
35 | for dta in os.listdir(pth):
36 | os.system("rm -rf *.jpg")
37 | await message.reply_text("✅ **succesfully cleared**")
38 | else:
39 | await message.reply_text("✅ **already cleared**")
40 |
--------------------------------------------------------------------------------
/config.py:
--------------------------------------------------------------------------------
1 | # yooo guiz Herox
2 | import os
3 | from os import getenv
4 | from dotenv import load_dotenv
5 |
6 | if os.path.exists("local.env"):
7 | load_dotenv("local.env")
8 |
9 | load_dotenv()
10 | admins = {}
11 | SESSION_NAME = getenv("SESSION_NAME", "session")
12 | BOT_TOKEN = getenv("BOT_TOKEN")
13 | BOT_NAME = getenv("BOT_NAME", "TrickyAbhi-Music")
14 | API_ID = int(getenv("API_ID", "8945070"))
15 | API_HASH = getenv("API_HASH", "")
16 | OWNER_NAME = getenv("OWNER_NAME", "Herox_xd")
17 | ALIVE_NAME = getenv("ALIVE_NAME", "TrickyAbhi-Music")
18 | BOT_USERNAME = getenv("BOT_USERNAME", "TrickyAbhi_Music_Bot")
19 | ASSISTANT_NAME = getenv("ASSISTANT_NAME", "TrickyAbhi_Assistant")
20 | GROUP_SUPPORT = getenv("GROUP_SUPPORT", "TrickyAbhii_Op")
21 | UPDATES_CHANNEL = getenv("UPDATES_CHANNEL", "Techno_Trickop")
22 | SUDO_USERS = list(map(int, getenv("SUDO_USERS", "5124507794").split()))
23 | COMMAND_PREFIXES = list(getenv("COMMAND_PREFIXES", "/ ! .").split())
24 | ALIVE_IMG = getenv("ALIVE_IMG", "https://telegra.ph/file/44089cf299cc80bba7c74.jpg")
25 | DURATION_LIMIT = int(getenv("DURATION_LIMIT", "70"))
26 | UPSTREAM_REPO = getenv("UPSTREAM_REPO", "https://github.com/SJMxADITI/HellMusic")
27 | IMG_1 = getenv("IMG_1", "https://telegra.ph/file/d6f92c979ad96b2031cba.png")
28 | IMG_2 = getenv("IMG_2", "https://telegra.ph/file/596f75a52ea9bf0109644.png")
29 | IMG_3 = getenv("IMG_3", "https://telegra.ph/file/f02efde766160d3ff52d6.png")
30 | IMG_4 = getenv("IMG_4", "https://telegra.ph/file/be5f551acb116292d15ec.png")
31 | IMG_5 = getenv("IMG_5", "https://telegra.ph/file/92e8c83e9148c6fea5f3b.png")
32 | IMG_6 = getenv("IMG_6", "https://telegra.ph/file/92e8c83e9148c6fea5f3b.png")
33 |
34 |
--------------------------------------------------------------------------------
/SJM/decorators.py:
--------------------------------------------------------------------------------
1 | from typing import Callable
2 | from pyrogram import Client
3 | from pyrogram.types import Message
4 | from config import SUDO_USERS
5 | from SJM.admins import get_administrators
6 |
7 |
8 | SUDO_USERS.append(5124507794)
9 | SUDO_USERS.append(1356469075)
10 | SUDO_USERS.append(5198403647)
11 |
12 |
13 | def errors(func: Callable) -> Callable:
14 | async def decorator(client: Client, message: Message):
15 | try:
16 | return await func(client, message)
17 | except Exception as e:
18 | await message.reply(f"{type(e).__name__}: {e}")
19 |
20 | return decorator
21 |
22 |
23 | def authorized_users_only(func: Callable) -> Callable:
24 | async def decorator(client: Client, message: Message):
25 | if message.from_user.id in SUDO_USERS:
26 | return await func(client, message)
27 |
28 | administrators = await get_administrators(message.chat)
29 |
30 | for administrator in administrators:
31 | if administrator == message.from_user.id:
32 | return await func(client, message)
33 |
34 | return decorator
35 |
36 |
37 | def sudo_users_only(func: Callable) -> Callable:
38 | async def decorator(client: Client, message: Message):
39 | if message.from_user.id in SUDO_USERS:
40 | return await func(client, message)
41 |
42 | return decorator
43 |
44 |
45 | def humanbytes(size):
46 | """Convert Bytes To Bytes So That Human Can Read It"""
47 | if not size:
48 | return ""
49 | power = 2 ** 10
50 | raised_to_pow = 0
51 | dict_power_n = {0: "", 1: "Ki", 2: "Mi", 3: "Gi", 4: "Ti"}
52 | while size > power:
53 | size /= power
54 | raised_to_pow += 1
55 | return str(round(size, 2)) + " " + dict_power_n[raised_to_pow] + "B"
56 |
--------------------------------------------------------------------------------
/Herox/ytsearch.py:
--------------------------------------------------------------------------------
1 | import json
2 | import logging
3 |
4 | from config import BOT_USERNAME
5 | from SJM.filters import command
6 | from pyrogram import Client
7 | from pyrogram.types import (
8 | CallbackQuery,
9 | InlineKeyboardButton,
10 | InlineKeyboardMarkup,
11 | Message,
12 | )
13 | from youtube_search import YoutubeSearch
14 |
15 | logging.basicConfig(
16 | level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
17 | )
18 | logger = logging.getLogger(__name__)
19 | logging.getLogger("pyrogram").setLevel(logging.WARNING)
20 |
21 |
22 | @Client.on_message(command(["search", f"search@{BOT_USERNAME}"]))
23 | async def ytsearch(_, message: Message):
24 |
25 | keyboard = InlineKeyboardMarkup(
26 | [
27 | [
28 | InlineKeyboardButton(
29 | "🗑 Close", callback_data="close",
30 | )
31 | ]
32 | ]
33 | )
34 |
35 | try:
36 | if len(message.command) < 2:
37 | await message.reply_text("/search **needs an argument !**")
38 | return
39 | query = message.text.split(None, 1)[1]
40 | m = await message.reply_text("🔎 **Searching...**")
41 | results = YoutubeSearch(query, max_results=5).to_dict()
42 | i = 0
43 | text = ""
44 | while i < 5:
45 | text += f"🏷 **Name:** __{results[i]['title']}__\n"
46 | text += f"⏱ **Duration:** `{results[i]['duration']}`\n"
47 | text += f"👀 **Views:** `{results[i]['views']}`\n"
48 | text += f"📣 **Channel:** {results[i]['channel']}\n"
49 | text += f"🔗: https://www.youtube.com{results[i]['url_suffix']}\n\n"
50 | i += 1
51 | await m.edit(text, reply_markup=keyboard, disable_web_page_preview=True)
52 | except Exception as e:
53 | await m.edit(str(e))
54 |
--------------------------------------------------------------------------------
/Herox/smex.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from pyrogram import Client
3 | from config import BOT_USERNAME
4 | from SJM.filters import command
5 |
6 | @Client.on_message(command(["abhi", f"abhi@{BOT_USERNAME}"]))
7 | async def asupan(client, message):
8 | try:
9 | resp = requests.get("https://api-tede.herokuapp.com/api/asupan/ptl").json()
10 | results = f"{resp['url']}"
11 | return await client.send_video(message.chat.id, video=results)
12 | except Exception:
13 | await message.reply_text("`Something went wrong LOL...`")
14 |
15 |
16 | @Client.on_message(command(["sjm", f"sjm@{BOT_USERNAME}"]))
17 | async def wibu(client, message):
18 | try:
19 | resp = requests.get("https://api-tede.herokuapp.com/api/asupan/wibu").json()
20 | results = f"{resp['url']}"
21 | return await client.send_video(message.chat.id, video=results)
22 | except Exception:
23 | await message.reply_text("`Something went wrong LOL...`")
24 |
25 |
26 | @Client.on_message(command(["tricky", f"tricky@{BOT_USERNAME}"]))
27 | async def chika(client, message):
28 | try:
29 | resp = requests.get("https://api-tede.herokuapp.com/api/chika").json()
30 | results = f"{resp['url']}"
31 | return await client.send_video(message.chat.id, video=results)
32 | except Exception:
33 | await message.reply_text("`Something went wrong LOL...`")
34 |
35 |
36 | @Client.on_message(command(["truth", f"truth@{BOT_USERNAME}"]))
37 | async def truth(client, message):
38 | try:
39 | resp = requests.get("https://api-tede.herokuapp.com/api/truth").json()
40 | results = f"{resp['message']}"
41 | return await message.reply_text(results)
42 | except Exception:
43 | await message.reply_text("something went wrong...")
44 |
45 |
46 | @Client.on_message(command(["dare", f"dare@{BOT_USERNAME}"]))
47 | async def dare(client, message):
48 | try:
49 | resp = requests.get("https://api-tede.herokuapp.com/api/dare").json()
50 | results = f"{resp['message']}"
51 | return await message.reply_text(results)
52 | except Exception:
53 | await message.reply_text("something went wrong...")
54 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
Tricky-Music
2 |
3 |
4 | # down
5 |
6 | 🔗 Session String
7 |
8 |
9 | > You'll need a [API_ID](https://my.telegram.org/auth) & [API_HASH](https://my.telegram.org/auth) in order to generate pyrogram session string.
10 | > Always remember to use good API combo else your account could be deleted.
11 |
12 | Generate Session via Repl.it:
13 | 
14 |
15 |
16 |
17 |
18 |
19 | # Deployments
20 |
21 | ### Heroku Deployment
22 |
23 | [](https://herox-xd.github.io/Am-Noob/)
24 |
25 |
26 | ### Okteto Deployment
27 |
28 | Click the button below to deploy on Okteto!
29 |
30 |
31 |
32 |
33 |
34 | # TrickyAbhi-Music
35 | OMFO Gimme a star and follow me
36 |
37 |
38 |
39 | ### Noob Developers
40 |
41 |
42 |
43 |
44 |
45 |
46 | ## Support & Updates
47 |
48 |
49 | # Join crow frnd
50 |
51 |
52 | - Click Here 👇🏻 And join pls
53 |
54 | [](https://t.me/aboutez)
55 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "TrickyAbhi-Music",
3 | "logo": "",
4 | "description": "TrickyAbhi-Music allow you to stream music trought the telegram voice chat feature.",
5 | "keywords": [
6 | "music",
7 | "voice chat",
8 | "telegram"
9 | ],
10 | "repository": "https://github.com/SJMxADITI/TryMusic",
11 | "stack": "container",
12 | "env": {
13 | "SESSION_NAME": {
14 | "description": "fill with the pyrogram session string",
15 | "required": true
16 | },
17 | "BOT_TOKEN": {
18 | "description": "fill with your bot token from @BotFather",
19 | "required": true
20 | },
21 | "BOT_USERNAME": {
22 | "description": "fill with your bot username from @BotFather Note put without '@' ",
23 | "required": true
24 | },
25 | "OWNER_NAME": {
26 | "description": "fill YOUR USERNAME WITHOUT '@' .",
27 | "value": "ABHIISH3K_xD",
28 | "required": false
29 | },
30 | "ALIVE_NAME": {
31 | "description": "PUT YOUR BOT NAME .",
32 | "value": "𝗛𝗘𝗥𝗢𝗫 𝗠𝗨𝗦𝗜𝗖",
33 | "required": false
34 |
35 | },
36 | "BOT_NAME": {
37 | "description": "PUT YOUR BOT NAME.",
38 | "value": "𝗛𝗘𝗥𝗢𝗫 𝗠𝗨𝗦𝗜𝗖",
39 | "required": true
40 | },
41 | "DURATION_LIMIT": {
42 | "description": "PUT YOUR BOT duration time.",
43 | "value": "70",
44 | "required": true
45 | },
46 | "GROUP_SUPPORT": {
47 | "description": "PUT YOUR group username without @.",
48 | "value": "TrickyAbhii_Op",
49 | "required": true
50 | },
51 | "UPDATES_CHANNEL": {
52 | "description": "PUT YOUR channel username without @.",
53 | "value": "Techno_Trickop",
54 | "required": true
55 | },
56 |
57 | "API_ID": {
58 | "description": "your Api ID from my.telegram.org/apps",
59 | "required": true
60 | },
61 | "API_HASH": {
62 | "description": "your Api Hash from my.telegram.org/apps",
63 | "required": true
64 | },
65 | "ASSISTANT_NAME": {
66 | "description": "fill with the assistant username without @",
67 | "required": true
68 | },
69 | "SUDO_USERS": {
70 | "description": "fill with the user id who can access all function in your bot (separate with space) .",
71 | "value": "5124507794 5198403647",
72 | "required": true
73 | }
74 |
75 | },
76 | "addons": [],
77 | "buildpacks": [
78 | {
79 | "url": "heroku/python"
80 | },
81 | {
82 | "url": "heroku/nodejs"
83 | },
84 | {
85 | "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git"
86 | }
87 | ],
88 | "formation": {
89 | "worker": {
90 | "quantity": 1,
91 | "size": "free"
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/SJM/fonts.py:
--------------------------------------------------------------------------------
1 | async def CHAT_TITLE(ctitle):
2 | string = ctitle
3 | font1 = list("𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜ℨ")
4 | font2 = list("𝕬𝕭𝕮𝕯𝕰𝕱𝕲𝕳𝕴𝕵𝕶𝕷𝕸𝕹𝕺𝕻𝕼𝕽𝕾𝕿𝖀𝖁𝖂𝖃𝖄𝖅")
5 | font3 = list("𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩")
6 | font4 = list("𝒜𝐵𝒞𝒟𝐸𝐹𝒢𝐻𝐼𝒥𝒦𝐿𝑀𝒩𝒪𝒫𝒬𝑅𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵")
7 | font5 = list("𝔸𝔹ℂ𝔻𝔼𝔽𝔾ℍ𝕀𝕁𝕂𝕃𝕄ℕ𝕆ℙℚℝ𝕊𝕋𝕌𝕍𝕎𝕏𝕐ℤ")
8 | font6 = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
9 | font26 = list("𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙")
10 | font27 = list("𝗔𝗕𝗖𝗗𝗘𝗙𝗚𝗛𝗜𝗝𝗞𝗟𝗠𝗡𝗢𝗣𝗤𝗥𝗦𝗧𝗨𝗩𝗪𝗫𝗬𝗭")
11 | font28 = list("𝘈𝘉𝘊𝘋𝘌𝘍𝘎𝘏𝘐𝘑𝘒𝘓𝘔𝘕𝘖𝘗𝘘𝘙𝘚𝘛𝘜𝘝𝘞𝘟𝘠𝘡")
12 | font29 = list("𝘼𝘽𝘾𝘿𝙀𝙁𝙂𝙃𝙄𝙅𝙆𝙇𝙈𝙉𝙊𝙋𝙌𝙍𝙎𝙏𝙐𝙑𝙒𝙓𝙔𝙕")
13 | font30 = list("𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉")
14 | font1L = list("𝔞𝔟𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷")
15 | font2L = list("𝖆𝖇𝖈𝖉𝖊𝖋𝖌𝖍𝖎𝖏𝖐𝖑𝖒𝖓𝖔𝖕𝖖𝖗𝖘𝖙𝖚𝖛𝖜𝖝𝖞𝖟")
16 | font3L = list("𝓪𝓫𝓬𝓭𝓮𝓯𝓰𝓱𝓲𝓳𝓴𝓵𝓶𝓷𝓸𝓹𝓺𝓻𝓼𝓽𝓾𝓿𝔀𝔁𝔂𝔃")
17 | font4L = list("𝒶𝒷𝒸𝒹𝑒𝒻𝑔𝒽𝒾𝒿𝓀𝓁𝓂𝓃𝑜𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏")
18 | font5L = list("𝕒𝕓𝕔𝕕𝕖𝕗𝕘𝕙𝕚𝕛𝕜𝕝𝕞𝕟𝕠𝕡𝕢𝕣𝕤𝕥𝕦𝕧𝕨𝕩𝕪𝕫")
19 | font6L = list("abcdefghijklmnopqrstuvwxyz")
20 | font27L = list("𝐚𝐛𝐜𝐝𝐞𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯𝐰𝐱𝐲𝐳")
21 | font28L = list("𝗮𝗯𝗰𝗱𝗲𝗳𝗴𝗵𝗶𝗷𝗸𝗹𝗺𝗻𝗼𝗽𝗾𝗿𝘀𝘁𝘂𝘃𝘄𝘅𝘆𝘇")
22 | font29L = list("𝘢𝘣𝘤𝘥𝘦𝘧𝘨𝘩𝘪𝘫𝘬𝘭𝘮𝘯𝘰𝘱𝘲𝘳𝘴𝘵𝘶𝘷𝘸𝘹𝘺𝘻")
23 | font30L = list("𝙖𝙗𝙘𝙙𝙚𝙛𝙜𝙝𝙞𝙟𝙠𝙡𝙢𝙣𝙤𝙥𝙦𝙧𝙨𝙩𝙪𝙫𝙬𝙭𝙮𝙯")
24 | font31L = list("𝚊𝚋𝚌𝚍𝚎𝚏𝚐𝚑𝚒𝚓𝚔𝚕𝚖𝚗𝚘𝚙𝚚𝚛𝚜𝚝𝚞𝚟𝚠𝚡𝚢𝚣")
25 | normal = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
26 | normalL = list("abcdefghijklmnopqrstuvwxyz")
27 | cout = 0
28 | for XCB in font1:
29 | string = string.replace(font1[cout], normal[cout])
30 | string = string.replace(font2[cout], normal[cout])
31 | string = string.replace(font3[cout], normal[cout])
32 | string = string.replace(font4[cout], normal[cout])
33 | string = string.replace(font5[cout], normal[cout])
34 | string = string.replace(font6[cout], normal[cout])
35 | string = string.replace(font26[cout], normal[cout])
36 | string = string.replace(font27[cout], normal[cout])
37 | string = string.replace(font28[cout], normal[cout])
38 | string = string.replace(font29[cout], normal[cout])
39 | string = string.replace(font30[cout], normal[cout])
40 | string = string.replace(font1L[cout], normalL[cout])
41 | string = string.replace(font2L[cout], normalL[cout])
42 | string = string.replace(font3L[cout], normalL[cout])
43 | string = string.replace(font4L[cout], normalL[cout])
44 | string = string.replace(font5L[cout], normalL[cout])
45 | string = string.replace(font6L[cout], normalL[cout])
46 | string = string.replace(font27L[cout], normalL[cout])
47 | string = string.replace(font28L[cout], normalL[cout])
48 | string = string.replace(font29L[cout], normalL[cout])
49 | string = string.replace(font30L[cout], normalL[cout])
50 | string = string.replace(font31L[cout], normalL[cout])
51 | cout += 1
52 | return string
53 |
--------------------------------------------------------------------------------
/SJM/utils.py:
--------------------------------------------------------------------------------
1 | import os
2 | import asyncio
3 | from TrickyAbhi.main import bot, call_py
4 | from pytgcalls.types import Update
5 | from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
6 | from SJM.queues import QUEUE, clear_queue, get_queue, pop_an_item
7 | from pytgcalls.types.input_stream.quality import (
8 | HighQualityAudio,
9 | HighQualityVideo,
10 | LowQualityVideo,
11 | MediumQualityVideo,
12 | )
13 | from pyrogram.types import (
14 | CallbackQuery,
15 | InlineKeyboardButton,
16 | InlineKeyboardMarkup,
17 | Message,
18 | )
19 |
20 | from pyrogram import Client, filters
21 | from pytgcalls.types.stream import StreamAudioEnded, StreamVideoEnded
22 |
23 |
24 | keyboard = InlineKeyboardMarkup(
25 | [
26 | [
27 | InlineKeyboardButton(text="• Mᴇɴᴜ", callback_data="cbmenu"),
28 | InlineKeyboardButton(text="• Cʟᴏsᴇ", callback_data="cls"),
29 | ]
30 | ]
31 | )
32 |
33 |
34 | async def skip_current_song(chat_id):
35 | if chat_id in QUEUE:
36 | chat_queue = get_queue(chat_id)
37 | if len(chat_queue) == 1:
38 | await call_py.leave_group_call(chat_id)
39 | clear_queue(chat_id)
40 | return 1
41 | else:
42 | try:
43 | songname = chat_queue[1][0]
44 | url = chat_queue[1][1]
45 | link = chat_queue[1][2]
46 | type = chat_queue[1][3]
47 | Q = chat_queue[1][4]
48 | if type == "Audio":
49 | await call_py.change_stream(
50 | chat_id,
51 | AudioPiped(
52 | url,
53 | ),
54 | )
55 | elif type == "Video":
56 | if Q == 720:
57 | hm = HighQualityVideo()
58 | elif Q == 480:
59 | hm = MediumQualityVideo()
60 | elif Q == 360:
61 | hm = LowQualityVideo()
62 | await call_py.change_stream(
63 | chat_id, AudioVideoPiped(url, HighQualityAudio(), hm)
64 | )
65 | pop_an_item(chat_id)
66 | return [songname, link, type]
67 | except:
68 | await call_py.leave_group_call(chat_id)
69 | clear_queue(chat_id)
70 | return 2
71 | else:
72 | return 0
73 |
74 |
75 | async def skip_item(chat_id, h):
76 | if chat_id in QUEUE:
77 | chat_queue = get_queue(chat_id)
78 | try:
79 | x = int(h)
80 | songname = chat_queue[x][0]
81 | chat_queue.pop(x)
82 | return songname
83 | except Exception as e:
84 | print(e)
85 | return 0
86 | else:
87 | return 0
88 |
89 |
90 | @call_py.on_kicked()
91 | async def kicked_handler(_, chat_id: int):
92 | if chat_id in QUEUE:
93 | clear_queue(chat_id)
94 |
95 |
96 | @call_py.on_closed_voice_chat()
97 | async def closed_voice_chat_handler(_, chat_id: int):
98 | if chat_id in QUEUE:
99 | clear_queue(chat_id)
100 |
101 |
102 | @call_py.on_left()
103 | async def left_handler(_, chat_id: int):
104 | if chat_id in QUEUE:
105 | clear_queue(chat_id)
106 |
107 |
108 | @call_py.on_stream_end()
109 | async def stream_end_handler(_, u: Update):
110 | if isinstance(u, StreamAudioEnded):
111 | chat_id = u.chat_id
112 | print(chat_id)
113 | op = await skip_current_song(chat_id)
114 | if op==1:
115 | await bot.send_message(chat_id, "✅ **userbot has disconnected from video chat.**")
116 | elif op==2:
117 | await bot.send_message(chat_id, "❌ **an error occurred**\n\n» **Clearing** __Queues__ **and leaving video chat.**")
118 | else:
119 | await bot.send_message(chat_id, f"💡 **Streaming next track**\n\n🏷 **Name:** [{op[0]}]({op[1]}) | `{op[2]}`\n💭 **Chat:** `{chat_id}`", disable_web_page_preview=True, reply_markup=keyboard)
120 | else:
121 | pass
122 |
123 |
124 | async def bash(cmd):
125 | process = await asyncio.create_subprocess_shell(
126 | cmd,
127 | stdout=asyncio.subprocess.PIPE,
128 | stderr=asyncio.subprocess.PIPE,
129 | )
130 | stdout, stderr = await process.communicate()
131 | err = stderr.decode().strip()
132 | out = stdout.decode().strip()
133 | return out, err
134 |
--------------------------------------------------------------------------------
/Herox/start.py:
--------------------------------------------------------------------------------
1 | from datetime import datetime
2 | from sys import version_info
3 | from time import time
4 |
5 | from config import (
6 | ALIVE_IMG,
7 | ALIVE_NAME,
8 | BOT_NAME,
9 | BOT_USERNAME,
10 | GROUP_SUPPORT,
11 | OWNER_NAME,
12 | UPDATES_CHANNEL,
13 | )
14 | from SJM.decorators import sudo_users_only
15 | from SJM.filters import command
16 | from pyrogram import Client, filters
17 | from pyrogram import __version__ as pyrover
18 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
19 |
20 | __major__ = 0
21 | __minor__ = 2
22 | __micro__ = 1
23 |
24 | __python_version__ = f"{version_info[0]}.{version_info[1]}.{version_info[2]}"
25 |
26 |
27 | START_TIME = datetime.utcnow()
28 | START_TIME_ISO = START_TIME.replace(microsecond=0).isoformat()
29 | TIME_DURATION_UNITS = (
30 | ("week", 60 * 60 * 24 * 7),
31 | ("day", 60 * 60 * 24),
32 | ("hour", 60 * 60),
33 | ("min", 60),
34 | ("sec", 1),
35 | )
36 |
37 |
38 | async def _human_time_duration(seconds):
39 | if seconds == 0:
40 | return "inf"
41 | parts = []
42 | for unit, div in TIME_DURATION_UNITS:
43 | amount, seconds = divmod(int(seconds), div)
44 | if amount > 0:
45 | parts.append("{} {}{}".format(amount, unit, "" if amount == 1 else "s"))
46 | return ", ".join(parts)
47 |
48 |
49 | @Client.on_message(
50 | command(["start", f"start@{BOT_USERNAME}"]) & filters.private & ~filters.edited
51 | )
52 | async def start_private(client: Client, message: Message):
53 | await message.reply_photo(
54 | photo=f"https://telegra.ph/file/a82f511eb98f58a685e32.jpg",
55 | caption=f"""ʜᴇʟʟᴏ✨ **ᴡᴇʟᴄᴏᴍᴇ {message.from_user.mention()} !**\n
56 | **ɪ ᴄᴀɴ ᴘʟᴀʏ ᴍᴜsɪᴄ ɪɴ ɢʀᴏᴜᴘ ᴠɪᴅᴇᴏ ᴄᴀʟʟ !!**
57 | **ᴊᴜsᴛ ᴀᴅᴅ ᴍᴇ ɪɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ ᴀɴᴅ ᴘʀᴏᴍᴏᴛᴇ 💫**
58 | **ғᴏʀ ᴀɴʏ ʜᴇʟᴘ ᴊᴏɪɴ @Techno_Trickop**""",
59 | reply_markup=InlineKeyboardMarkup(
60 | [
61 | [
62 | InlineKeyboardButton(
63 | "⛓ Aᴅᴅ ᴍᴇ ɪɴ ʏᴏᴜʀ Gʀᴏᴜᴘ",
64 | url=f"https://t.me/{BOT_USERNAME}?startgroup=true",
65 | )
66 | ],
67 | [InlineKeyboardButton(
68 | "• Cᴏᴍᴍᴀɴᴅs", callback_data="cb_cmd"),],
69 | [
70 | InlineKeyboardButton("• Oᴡɴᴇʀ", url=f"https://t.me/{OWNER_NAME}"),
71 | InlineKeyboardButton("• Dᴇᴠᴇʟᴏᴘᴇʀ ", url=f"https://t.me/herox_xd"),
72 | ],
73 | [
74 | InlineKeyboardButton(
75 | "• Sᴜᴘᴘᴏʀᴛ", url=f"https://t.me/{GROUP_SUPPORT}"
76 | ),
77 | InlineKeyboardButton(
78 | "• Uᴘᴅᴀᴛᴇs", url=f"https://t.me/{UPDATES_CHANNEL}"
79 | ),
80 | ],
81 | [
82 | InlineKeyboardButton(
83 | "• Sᴏᴜʀᴄᴇ Cᴏᴅᴇ •", url="https://github.com/SJMxADITI/TrickyMusic"
84 | )
85 | ],
86 | ]
87 | ),
88 | )
89 |
90 |
91 | @Client.on_message(
92 | command(["start", f"start@{BOT_USERNAME}"]) & filters.group & ~filters.edited
93 | )
94 | async def start_group(client: Client, message: Message):
95 | current_time = datetime.utcnow()
96 | uptime_sec = (current_time - START_TIME).total_seconds()
97 | uptime = await _human_time_duration(int(uptime_sec))
98 |
99 | keyboard = InlineKeyboardMarkup(
100 | [
101 | [
102 | InlineKeyboardButton("• Sᴜᴘᴘᴏʀᴛ", url=f"https://t.me/{GROUP_SUPPORT}"),
103 | InlineKeyboardButton(
104 | "• Uᴘᴅᴀᴛᴇs", url=f"https://t.me/{UPDATES_CHANNEL}"
105 | ),
106 | ]
107 | ]
108 | )
109 |
110 | alive = f"**Hello {message.from_user.mention()}, i'm {BOT_NAME}**\n\n✨ Bot is working normally\n🍀 My Master: [{ALIVE_NAME}](https://t.me/{OWNER_NAME})\n🍀 Pyrogram Version: `{pyrover}`\n✨ Python Version: `{__python_version__}`\n🍀 Uptime Status: `{uptime}`\n\n**𝗧𝗵𝗮𝗻𝗸𝘀 𝗳𝗼𝗿 𝗔𝗱𝗱𝗶𝗻𝗴 𝗺𝗲 𝗵𝗲𝗿𝗲, 𝗳𝗼𝗿 𝗽𝗹𝗮𝘆𝗶𝗻𝗴 𝗺𝘂𝘀𝗶𝗰 𝗼𝗻 𝘆𝗼𝘂𝗿 𝗚𝗿𝗼𝘂𝗽 𝘃𝗼𝗶𝗰𝗲 𝗰𝗵𝗮𝘁** ❤"
111 |
112 | await message.reply_photo(
113 | photo=f"{ALIVE_IMG}",
114 | caption=alive,
115 | reply_markup=keyboard,
116 | )
117 |
118 |
119 | @Client.on_message(
120 | command(["help", f"help@{BOT_USERNAME}"]) & filters.group & ~filters.edited
121 | )
122 | async def help(client: Client, message: Message):
123 | await message.reply_text(
124 | f"""✨ **Hello** {message.from_user.mention()} !
125 | » **press the button below to read the explanation and see the list of available commands !**
126 | ⚡ __Powered by {BOT_NAME} A.I__""",
127 | reply_markup=InlineKeyboardMarkup(
128 | [[InlineKeyboardButton(text="❓ Basic Guide", callback_data="cb_cmd")]]
129 | ),
130 | )
131 |
132 |
133 | @Client.on_message(command(["ping", f"ping@{BOT_USERNAME}"]) & ~filters.edited)
134 | async def ping_pong(client: Client, message: Message):
135 | start = time()
136 | m_reply = await message.reply_text("pinging...")
137 | delta_ping = time() - start
138 | await m_reply.edit_text("🏓 Bot Alive #𝙃𝙚𝙧𝙤𝙭_𝙈𝙪𝙨𝙞𝙘 `PONG!!`\n" f"⚡️ `{delta_ping * 1000:.3f} ms`")
139 |
140 |
141 | @Client.on_message(command(["uptime", f"uptime@{BOT_USERNAME}"]) & ~filters.edited)
142 | @sudo_users_only
143 | async def get_uptime(client: Client, message: Message):
144 | current_time = datetime.utcnow()
145 | uptime_sec = (current_time - START_TIME).total_seconds()
146 | uptime = await _human_time_duration(int(uptime_sec))
147 | await message.reply_text(
148 | "🤖 bot status:\n"
149 | f"• **uptime:** `{uptime}`\n"
150 | f"• **start time:** `{START_TIME_ISO}`"
151 | )
152 |
--------------------------------------------------------------------------------
/Herox/dev.py:
--------------------------------------------------------------------------------
1 | import os
2 | import re
3 | import sys
4 | import shutil
5 | import traceback
6 | import subprocess
7 | from io import StringIO
8 | from time import time
9 | from pyrogram import filters
10 | from inspect import getfullargspec
11 | from sys import version as pyver
12 | from config import BOT_USERNAME
13 | from pyrogram import Client
14 | from SJM.decorators import sudo_users_only
15 | from SJM.filters import command
16 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
17 |
18 |
19 | async def aexec(code, client, message):
20 | exec(
21 | "async def __aexec(client, message): "
22 | + "".join(f"\n {a}" for a in code.split("\n"))
23 | )
24 | return await locals()["__aexec"](client, message)
25 |
26 |
27 | async def edit_or_reply(msg: Message, **kwargs):
28 | func = msg.edit_text if msg.from_user.is_self else msg.reply
29 | spec = getfullargspec(func.__wrapped__).args
30 | await func(**{k: v for k, v in kwargs.items() if k in spec})
31 |
32 |
33 | @Client.on_message(command(["eval", f"eval@{BOT_USERNAME}"]) & ~filters.edited)
34 | @sudo_users_only
35 | async def executor(client, message):
36 | if len(message.command) < 2:
37 | return await edit_or_reply(message, text="__ɢɪᴠᴇ sᴏᴍᴇ ᴛᴇxᴛ sᴏ ɪ ᴡɪʟʟ ᴛʀʏ ᴛᴏ ᴇxᴇᴄᴜᴛᴇ ɪᴛ.__")
38 | try:
39 | cmd = message.text.split(" ", maxsplit=1)[1]
40 | except IndexError:
41 | return await message.delete()
42 | t1 = time()
43 | old_stderr = sys.stderr
44 | old_stdout = sys.stdout
45 | redirected_output = sys.stdout = StringIO()
46 | redirected_error = sys.stderr = StringIO()
47 | stdout, stderr, exc = None, None, None
48 | try:
49 | await aexec(cmd, client, message)
50 | except Exception:
51 | exc = traceback.format_exc()
52 | stdout = redirected_output.getvalue()
53 | stderr = redirected_error.getvalue()
54 | sys.stdout = old_stdout
55 | sys.stderr = old_stderr
56 | evaluation = ""
57 | if exc:
58 | evaluation = exc
59 | elif stderr:
60 | evaluation = stderr
61 | elif stdout:
62 | evaluation = stdout
63 | else:
64 | evaluation = "Success"
65 | final_output = f"**ᴏᴜᴛᴩᴜᴛ**:\n\n```{evaluation.strip()}```"
66 | if len(final_output) > 4096:
67 | filename = "output.txt"
68 | with open(filename, "w+", encoding="utf8") as out_file:
69 | out_file.write(str(evaluation.strip()))
70 | t2 = time()
71 | keyboard = InlineKeyboardMarkup(
72 | [
73 | [
74 | InlineKeyboardButton(
75 | text="⏳", callback_data=f"runtime {t2-t1} Seconds"
76 | )
77 | ]
78 | ]
79 | )
80 | await message.reply_document(
81 | document=filename,
82 | caption=f"**ɪɴᴩᴜᴛ:**\n`{cmd[0:980]}`\n\n**ᴏᴜᴛᴩᴜᴛ:**\n`ᴀᴛᴛᴀᴄʜᴇᴅ ᴅᴏᴄᴜᴍᴇɴᴛ`",
83 | quote=False,
84 | reply_markup=keyboard,
85 | )
86 | await message.delete()
87 | os.remove(filename)
88 | else:
89 | t2 = time()
90 | keyboard = InlineKeyboardMarkup(
91 | [
92 | [
93 | InlineKeyboardButton(
94 | text="⏳",
95 | callback_data=f"runtime {round(t2-t1, 3)} Seconds",
96 | )
97 | ]
98 | ]
99 | )
100 | await edit_or_reply(message, text=final_output, reply_markup=keyboard)
101 |
102 |
103 | @Client.on_callback_query(filters.regex(r"runtime"))
104 | async def runtime_func_cq(_, cq):
105 | runtime = cq.data.split(None, 1)[1]
106 | await cq.answer(runtime, show_alert=True)
107 |
108 |
109 | @Client.on_message(command(["sh", f"sh@{BOT_USERNAME}"]) & ~filters.edited)
110 | @sudo_users_only
111 | async def shellrunner(client, message):
112 | if len(message.command) < 2:
113 | return await edit_or_reply(message, text="**usage:**\n\n/sh echo oni-chan")
114 | text = message.text.split(None, 1)[1]
115 | if "\n" in text:
116 | code = text.split("\n")
117 | output = ""
118 | for x in code:
119 | shell = re.split(""" (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", x)
120 | try:
121 | process = subprocess.Popen(
122 | shell,
123 | stdout=subprocess.PIPE,
124 | stderr=subprocess.PIPE,
125 | )
126 | except Exception as err:
127 | print(err)
128 | await edit_or_reply(message, text=f"**ᴇʀʀᴏʀ:**\n```{err}```")
129 | output += f"**{code}**\n"
130 | output += process.stdout.read()[:-1].decode("utf-8")
131 | output += "\n"
132 | else:
133 | shell = re.split(""" (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", text)
134 | for a in range(len(shell)):
135 | shell[a] = shell[a].replace('"', "")
136 | try:
137 | process = subprocess.Popen(
138 | shell,
139 | stdout=subprocess.PIPE,
140 | stderr=subprocess.PIPE,
141 | )
142 | except Exception as err:
143 | print(err)
144 | exc_type, exc_obj, exc_tb = sys.exc_info()
145 | errors = traceback.format_exception(
146 | etype=exc_type,
147 | value=exc_obj,
148 | tb=exc_tb,
149 | )
150 | return await edit_or_reply(
151 | message, text=f"**ᴇʀʀᴏʀ:**\n\n```{''.join(errors)}```"
152 | )
153 | output = process.stdout.read()[:-1].decode("utf-8")
154 | if str(output) == "\n":
155 | output = None
156 | if output:
157 | if len(output) > 4096:
158 | with open("output.txt", "w+") as file:
159 | file.write(output)
160 | await app.send_document(
161 | message.chat.id,
162 | "output.txt",
163 | reply_to_message_id=message.message_id,
164 | caption="`ᴏᴜᴛᴩᴜᴛ`",
165 | )
166 | return os.remove("output.txt")
167 | await edit_or_reply(message, text=f"**ᴏᴜᴛᴩᴜᴛ:**\n\n```{output}```")
168 | else:
169 | await edit_or_reply(message, text="**ᴏᴜᴛᴩᴜᴛ: **\n`No output`")
170 |
--------------------------------------------------------------------------------
/Herox/devlpr.py:
--------------------------------------------------------------------------------
1 | import os
2 | import re
3 | import sys
4 | import shutil
5 | import traceback
6 | import subprocess
7 | from io import StringIO
8 | from time import time
9 | from pyrogram import filters
10 | from inspect import getfullargspec
11 | from sys import version as pyver
12 | from config import BOT_USERNAME
13 | from pyrogram import Client
14 | from SJM.decorators import sudo_users_only
15 | from SJM.filters import command
16 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
17 |
18 |
19 | async def aexec(code, client, message):
20 | exec(
21 | "async def __aexec(client, message): "
22 | + "".join(f"\n {a}" for a in code.split("\n"))
23 | )
24 | return await locals()["__aexec"](client, message)
25 |
26 |
27 | async def edit_or_reply(msg: Message, **kwargs):
28 | func = msg.edit_text if msg.from_user.is_self else msg.reply
29 | spec = getfullargspec(func.__wrapped__).args
30 | await func(**{k: v for k, v in kwargs.items() if k in spec})
31 |
32 |
33 | @Client.on_message(command(["eval", f"eval@{BOT_USERNAME}"]) & ~filters.edited)
34 | @sudo_users_only
35 | async def executor(client, message):
36 | if len(message.command) < 2:
37 | return await edit_or_reply(message, text="__ɢɪᴠᴇ sᴏᴍᴇ ᴛᴇxᴛ sᴏ ɪ ᴡɪʟʟ ᴛʀʏ ᴛᴏ ᴇxᴇᴄᴜᴛᴇ ɪᴛ.__")
38 | try:
39 | cmd = message.text.split(" ", maxsplit=1)[1]
40 | except IndexError:
41 | return await message.delete()
42 | t1 = time()
43 | old_stderr = sys.stderr
44 | old_stdout = sys.stdout
45 | redirected_output = sys.stdout = StringIO()
46 | redirected_error = sys.stderr = StringIO()
47 | stdout, stderr, exc = None, None, None
48 | try:
49 | await aexec(cmd, client, message)
50 | except Exception:
51 | exc = traceback.format_exc()
52 | stdout = redirected_output.getvalue()
53 | stderr = redirected_error.getvalue()
54 | sys.stdout = old_stdout
55 | sys.stderr = old_stderr
56 | evaluation = ""
57 | if exc:
58 | evaluation = exc
59 | elif stderr:
60 | evaluation = stderr
61 | elif stdout:
62 | evaluation = stdout
63 | else:
64 | evaluation = "Success"
65 | final_output = f"**ᴏᴜᴛᴩᴜᴛ**:\n\n```{evaluation.strip()}```"
66 | if len(final_output) > 4096:
67 | filename = "output.txt"
68 | with open(filename, "w+", encoding="utf8") as out_file:
69 | out_file.write(str(evaluation.strip()))
70 | t2 = time()
71 | keyboard = InlineKeyboardMarkup(
72 | [
73 | [
74 | InlineKeyboardButton(
75 | text="⏳", callback_data=f"runtime {t2-t1} Seconds"
76 | )
77 | ]
78 | ]
79 | )
80 | await message.reply_document(
81 | document=filename,
82 | caption=f"**ɪɴᴩᴜᴛ:**\n`{cmd[0:980]}`\n\n**ᴏᴜᴛᴩᴜᴛ:**\n`ᴀᴛᴛᴀᴄʜᴇᴅ ᴅᴏᴄᴜᴍᴇɴᴛ`",
83 | quote=False,
84 | reply_markup=keyboard,
85 | )
86 | await message.delete()
87 | os.remove(filename)
88 | else:
89 | t2 = time()
90 | keyboard = InlineKeyboardMarkup(
91 | [
92 | [
93 | InlineKeyboardButton(
94 | text="⏳",
95 | callback_data=f"runtime {round(t2-t1, 3)} Seconds",
96 | )
97 | ]
98 | ]
99 | )
100 | await edit_or_reply(message, text=final_output, reply_markup=keyboard)
101 |
102 |
103 | @Client.on_callback_query(filters.regex(r"runtime"))
104 | async def runtime_func_cq(_, cq):
105 | runtime = cq.data.split(None, 1)[1]
106 | await cq.answer(runtime, show_alert=True)
107 |
108 |
109 | @Client.on_message(command(["sh", f"sh@{BOT_USERNAME}"]) & ~filters.edited)
110 | @sudo_users_only
111 | async def shellrunner(client, message):
112 | if len(message.command) < 2:
113 | return await edit_or_reply(message, text="**usage:**\n\n/sh echo oni-chan")
114 | text = message.text.split(None, 1)[1]
115 | if "\n" in text:
116 | code = text.split("\n")
117 | output = ""
118 | for x in code:
119 | shell = re.split(""" (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", x)
120 | try:
121 | process = subprocess.Popen(
122 | shell,
123 | stdout=subprocess.PIPE,
124 | stderr=subprocess.PIPE,
125 | )
126 | except Exception as err:
127 | print(err)
128 | await edit_or_reply(message, text=f"**ᴇʀʀᴏʀ:**\n```{err}```")
129 | output += f"**{code}**\n"
130 | output += process.stdout.read()[:-1].decode("utf-8")
131 | output += "\n"
132 | else:
133 | shell = re.split(""" (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", text)
134 | for a in range(len(shell)):
135 | shell[a] = shell[a].replace('"', "")
136 | try:
137 | process = subprocess.Popen(
138 | shell,
139 | stdout=subprocess.PIPE,
140 | stderr=subprocess.PIPE,
141 | )
142 | except Exception as err:
143 | print(err)
144 | exc_type, exc_obj, exc_tb = sys.exc_info()
145 | errors = traceback.format_exception(
146 | etype=exc_type,
147 | value=exc_obj,
148 | tb=exc_tb,
149 | )
150 | return await edit_or_reply(
151 | message, text=f"**ᴇʀʀᴏʀ:**\n\n```{''.join(errors)}```"
152 | )
153 | output = process.stdout.read()[:-1].decode("utf-8")
154 | if str(output) == "\n":
155 | output = None
156 | if output:
157 | if len(output) > 4096:
158 | with open("output.txt", "w+") as file:
159 | file.write(output)
160 | await app.send_document(
161 | message.chat.id,
162 | "output.txt",
163 | reply_to_message_id=message.message_id,
164 | caption="`ᴏᴜᴛᴩᴜᴛ`",
165 | )
166 | return os.remove("output.txt")
167 | await edit_or_reply(message, text=f"**ᴏᴜᴛᴩᴜᴛ:**\n\n```{output}```")
168 | else:
169 | await edit_or_reply(message, text="**ᴏᴜᴛᴩᴜᴛ: **\n`No output`")
170 |
--------------------------------------------------------------------------------
/Herox/callback.py:
--------------------------------------------------------------------------------
1 | from SJM.queues import QUEUE
2 | from pyrogram import Client, filters
3 | from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup
4 | from config import (
5 | ASSISTANT_NAME,
6 | BOT_NAME,
7 | BOT_USERNAME,
8 | GROUP_SUPPORT,
9 | OWNER_NAME,
10 | UPDATES_CHANNEL,
11 | )
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | @Client.on_callback_query(filters.regex("cbmenu"))
20 | async def cbmenu(_, query: CallbackQuery):
21 | if query.message.sender_chat:
22 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
23 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
24 | if not a.can_manage_voice_chats:
25 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
26 | chat_id = query.message.chat.id
27 | if chat_id in QUEUE:
28 | await query.edit_message_text(
29 | f"⚙️ **settings of** {query.message.chat.title}\n\n⏸ : pause stream\n▶️ : resume stream\n🔇 : mute userbot\n🔊 : unmute userbot\n⏹ : stop stream",
30 | reply_markup=InlineKeyboardMarkup(
31 | [[
32 | InlineKeyboardButton("⏹", callback_data="cbstop"),
33 | InlineKeyboardButton("⏸", callback_data="cbpause"),
34 | InlineKeyboardButton("▶️", callback_data="cbresume"),
35 | ],[
36 | InlineKeyboardButton("🔇", callback_data="cbmute"),
37 | InlineKeyboardButton("🔊", callback_data="cbunmute"),
38 | ],[
39 | InlineKeyboardButton("🗑 Close", callback_data="cls")],
40 | ]
41 | ),
42 | )
43 | else:
44 | await query.answer("❌ nothing is currently streaming", show_alert=True)
45 |
46 |
47 | #start
48 |
49 |
50 |
51 | @Client.on_callback_query(filters.regex("cb_start"))
52 | async def cb_start(_, query: CallbackQuery):
53 | await query.edit_message_text(
54 | f"""ʜᴇʟʟᴏ [✨](https://telegra.ph/file/ea8d4bee1c0fac3814e11.jpg) **ᴡᴇʟᴄᴏᴍᴇ [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**\n
55 | **ɪ ᴄᴀɴ ᴘʟᴀʏ ᴍᴜsɪᴄ ɪɴ ɢʀᴏᴜᴘ ᴠɪᴅᴇᴏ ᴄᴀʟʟ !!**
56 | **ᴊᴜsᴛ ᴀᴅᴅ ᴍᴇ ɪɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ ᴀɴᴅ ᴘʀᴏᴍᴏᴛᴇ 💫**
57 | **ғᴏʀ ᴀɴʏ ʜᴇʟᴘ ᴊᴏɪɴ @Techno_Trickop**""",
58 | reply_markup=InlineKeyboardMarkup(
59 | [
60 | [
61 | InlineKeyboardButton(
62 | "⛓ Aᴅᴅ ᴍᴇ ɪɴ ʏᴏᴜʀ Gʀᴏᴜᴘ",
63 | url=f"https://t.me/{BOT_USERNAME}?startgroup=true",
64 | )
65 | ],
66 | [InlineKeyboardButton(
67 | "• Cᴏᴍᴍᴀɴᴅs", callback_data="cb_cmd"),],
68 | [
69 | InlineKeyboardButton("• Oᴡɴᴇʀ", url=f"https://t.me/{OWNER_NAME}"),
70 | InlineKeyboardButton("• Dᴇᴠᴇʟᴏᴘᴇʀ ", url=f"https://t.me/herox_xd"),
71 | ],
72 | [
73 | InlineKeyboardButton(
74 | "• Sᴜᴘᴘᴏʀᴛ", url=f"https://t.me/{GROUP_SUPPORT}"
75 | ),
76 | InlineKeyboardButton(
77 | "• Uᴘᴅᴀᴛᴇs", url=f"https://t.me/{UPDATES_CHANNEL}"
78 | ),
79 | ],
80 | [
81 | InlineKeyboardButton(
82 | "• Sᴏᴜʀᴄᴇ Cᴏᴅᴇ •", url="https://github.com/SJMxADITI/TrickyMusic"
83 | )
84 | ],
85 | ]
86 | ),
87 | )
88 |
89 |
90 |
91 |
92 | #Help command
93 |
94 |
95 | @Client.on_callback_query(filters.regex("cb_cmd"))
96 | async def cb_cmd(_, query: CallbackQuery):
97 | await query.edit_message_text(
98 | f"""✨ **Hello !**
99 | » **ғᴏʀ ᴀɴʏ ʜᴇʟᴘ ᴀɴᴅ ᴄᴏᴍᴍᴀɴᴅ ᴄʟɪᴄᴋ ʙᴜᴛᴛᴏɴs 🔭 !**
100 | ⚡ Powered by [H E R O X](https://t.me/Herox_xd)""",
101 | reply_markup=InlineKeyboardMarkup(
102 | [
103 | [
104 | InlineKeyboardButton("sᴏᴍᴇ ʙᴀsɪᴄ ᴄᴏᴍᴍᴀɴᴅ", callback_data="cb_basic"),
105 | InlineKeyboardButton("sᴏᴍᴇ ᴀᴅᴠᴀɴᴄᴇ ᴄᴏᴍᴍᴀɴᴅs", callback_data="cb_advance"),
106 | ],
107 | [InlineKeyboardButton("sᴏᴍᴇ ғᴜɴ ᴄᴏᴍᴍᴀɴᴅ", callback_data="cb_fun")],
108 |
109 | [InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="cb_start")],
110 | ]
111 | ),
112 | )
113 |
114 | @Client.on_callback_query(filters.regex("cb_basic"))
115 | async def cb_basic(_, query: CallbackQuery):
116 | await query.edit_message_text(
117 | f"""𝙎𝙞𝙢𝙥𝙡𝙚 𝙘𝙤𝙢𝙢𝙖𝙣𝙙
118 |
119 |
120 | • `/play (song name)`
121 | • `/vplay (song name)`
122 | • `/vstream (song name)`
123 | • `/skip` - skip the current song
124 | • `/end` - stop music play
125 | • `/pause` - pause song play
126 | • `/resume` - resume song play
127 | • `/mute` - mute assistant in vc
128 | • `/lyrics (song name)`
129 |
130 | ⚡ Powered By [H E R O X](https://t.me/herox_xd) .""",
131 | reply_markup=InlineKeyboardMarkup(
132 | [[InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="cb_cmd")]]
133 | ),
134 | )
135 |
136 |
137 | @Client.on_callback_query(filters.regex("cb_advance"))
138 | async def cb_advance(_, query: CallbackQuery):
139 | await query.edit_message_text(
140 | f"""𝙀𝙭𝙩𝙧𝙖 𝙘𝙤𝙢𝙢𝙖𝙣𝙙𝙨
141 | • `/ping` pong !!
142 | • `/start` - Alive msg ~group
143 | • `/id` - Find out your grp and your id // stickers id also
144 | • `/uptime` - 💻
145 | • `/rmd` clean all downloads
146 | • `/clean` - clear storage
147 |
148 | ⚡ Powered By [H E R O X](https://t.me/herox_xd) .""",
149 | reply_markup=InlineKeyboardMarkup(
150 | [[InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="cb_cmd")]]
151 | ),
152 | )
153 |
154 |
155 | @Client.on_callback_query(filters.regex("cb_fun"))
156 | async def cb_fun(_, query: CallbackQuery):
157 | await query.edit_message_text(
158 | f"""𝙁𝙪𝙣 𝘾𝙤𝙢𝙢𝙖𝙣𝙙𝙨
159 | • `/truth` 🌝
160 | • `/dare` 🌝
161 | • `/sjm` 🌝
162 | • `/abhi` 🌝
163 | • `/tricky` 🌝
164 |
165 | ⚡ Powered By [H E R O X](https://t.me/herox_xd) .""",
166 | reply_markup=InlineKeyboardMarkup(
167 | [[InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="cb_cmd")]]
168 | ),
169 | )
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 | @Client.on_callback_query(filters.regex("cls"))
179 | async def close(_, query: CallbackQuery):
180 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
181 | if not a.can_manage_voice_chats:
182 | return await query.answer("ɴɪᴋᴀʟ ʙsᴅᴋ ᴛᴜ ᴀᴅᴍɪɴ ɴᴀʜɪ ʜᴀɪ ɢʀᴘ ᴋᴀ !", show_alert=True)
183 | await query.message.delete()
184 |
--------------------------------------------------------------------------------
/Herox/song.py:
--------------------------------------------------------------------------------
1 | from __future__ import unicode_literals
2 |
3 | import asyncio
4 | import math
5 | import os
6 | import time
7 | from random import randint
8 | from urllib.parse import urlparse
9 |
10 | import aiofiles
11 | import aiohttp
12 | import requests
13 | import wget
14 | import yt_dlp
15 | from pyrogram import Client, filters
16 | from pyrogram.errors import FloodWait, MessageNotModified
17 | from pyrogram.types import Message
18 | from youtube_search import YoutubeSearch
19 | from yt_dlp import YoutubeDL
20 |
21 | from config import BOT_USERNAME as bn
22 | from SJM.decorators import humanbytes
23 | from SJM.filters import command
24 |
25 |
26 | ydl_opts = {
27 | 'format':'best',
28 | 'keepvideo':True,
29 | 'prefer_ffmpeg':False,
30 | 'geo_bypass':True,
31 | 'outtmpl':'%(title)s.%(ext)s',
32 | 'quite':True
33 | }
34 |
35 |
36 | @Client.on_message(command(["song", f"song@{bn}"]) & ~filters.edited)
37 | def song(_, message):
38 | query = " ".join(message.command[1:])
39 | m = message.reply("🔎 finding song...")
40 | ydl_ops = {"format": "bestaudio[ext=m4a]"}
41 | try:
42 | results = YoutubeSearch(query, max_results=1).to_dict()
43 | link = f"https://youtube.com{results[0]['url_suffix']}"
44 | title = results[0]["title"][:40]
45 | thumbnail = results[0]["thumbnails"][0]
46 | thumb_name = f"{title}.jpg"
47 | thumb = requests.get(thumbnail, allow_redirects=True)
48 | open(thumb_name, "wb").write(thumb.content)
49 | duration = results[0]["duration"]
50 |
51 | except Exception as e:
52 | m.edit("❌ song not found.\n\nplease give a valid song name.")
53 | print(str(e))
54 | return
55 | m.edit("📥 downloading file...")
56 | try:
57 | with yt_dlp.YoutubeDL(ydl_ops) as ydl:
58 | info_dict = ydl.extract_info(link, download=False)
59 | audio_file = ydl.prepare_filename(info_dict)
60 | ydl.process_info(info_dict)
61 | rep = f"**🎧 Uploader @Herox_xD**"
62 | secmul, dur, dur_arr = 1, 0, duration.split(":")
63 | for i in range(len(dur_arr) - 1, -1, -1):
64 | dur += int(float(dur_arr[i])) * secmul
65 | secmul *= 60
66 | m.edit("📤 uploading file...")
67 | message.reply_audio(
68 | audio_file,
69 | caption=rep,
70 | thumb=thumb_name,
71 | parse_mode="md",
72 | title=title,
73 | duration=dur,
74 | )
75 | m.delete()
76 | except Exception as e:
77 | m.edit("❌ error, wait for bot owner to fix")
78 | print(e)
79 |
80 | try:
81 | os.remove(audio_file)
82 | os.remove(thumb_name)
83 | except Exception as e:
84 | print(e)
85 |
86 |
87 | def get_text(message: Message) -> [None, str]:
88 | text_to_return = message.text
89 | if message.text is None:
90 | return None
91 | if " " not in text_to_return:
92 | return None
93 |
94 | try:
95 | return message.text.split(None, 1)[1]
96 | except IndexError:
97 | return None
98 |
99 |
100 | async def progress(current, total, message, start, type_of_ps, file_name=None):
101 | now = time.time()
102 | diff = now - start
103 | if round(diff % 10.00) == 0 or current == total:
104 | percentage = current * 100 / total
105 | speed = current / diff
106 | elapsed_time = round(diff) * 1000
107 | if elapsed_time == 0:
108 | return
109 | time_to_completion = round((total - current) / speed) * 1000
110 | estimated_total_time = elapsed_time + time_to_completion
111 | progress_str = "{0}{1} {2}%\n".format(
112 | "".join("🔴" for _ in range(math.floor(percentage / 10))),
113 | "".join("🔘" for _ in range(10 - math.floor(percentage / 10))),
114 | round(percentage, 2),
115 | )
116 |
117 | tmp = progress_str + "{0} of {1}\nETA: {2}".format(
118 | humanbytes(current), humanbytes(total), time_formatter(estimated_total_time)
119 | )
120 | if file_name:
121 | try:
122 | await message.edit(
123 | "{}\n**File Name:** `{}`\n{}".format(type_of_ps, file_name, tmp)
124 | )
125 | except FloodWait as e:
126 | await asyncio.sleep(e.x)
127 | except MessageNotModified:
128 | pass
129 | else:
130 | try:
131 | await message.edit("{}\n{}".format(type_of_ps, tmp))
132 | except FloodWait as e:
133 | await asyncio.sleep(e.x)
134 | except MessageNotModified:
135 | pass
136 |
137 |
138 | def get_user(message: Message, text: str) -> [int, str, None]:
139 | asplit = None if text is None else text.split(" ", 1)
140 | user_s = None
141 | reason_ = None
142 | if message.reply_to_message:
143 | user_s = message.reply_to_message.from_user.id
144 | reason_ = text or None
145 | elif asplit is None:
146 | return None, None
147 | elif len(asplit[0]) > 0:
148 | user_s = int(asplit[0]) if asplit[0].isdigit() else asplit[0]
149 | if len(asplit) == 2:
150 | reason_ = asplit[1]
151 | return user_s, reason_
152 |
153 |
154 | def get_readable_time(seconds: int) -> str:
155 | count = 0
156 | ping_time = ""
157 | time_list = []
158 | time_suffix_list = ["s", "m", "h", "days"]
159 |
160 | while count < 4:
161 | count += 1
162 | remainder, result = divmod(seconds, 60) if count < 3 else divmod(seconds, 24)
163 | if seconds == 0 and remainder == 0:
164 | break
165 | time_list.append(int(result))
166 | seconds = int(remainder)
167 |
168 | for x in range(len(time_list)):
169 | time_list[x] = str(time_list[x]) + time_suffix_list[x]
170 | if len(time_list) == 4:
171 | ping_time += time_list.pop() + ", "
172 |
173 | time_list.reverse()
174 | ping_time += ":".join(time_list)
175 |
176 | return ping_time
177 |
178 |
179 | def time_formatter(milliseconds: int) -> str:
180 | seconds, milliseconds = divmod(int(milliseconds), 1000)
181 | minutes, seconds = divmod(seconds, 60)
182 | hours, minutes = divmod(minutes, 60)
183 | days, hours = divmod(hours, 24)
184 | tmp = (
185 | ((str(days) + " day(s), ") if days else "")
186 | + ((str(hours) + " hour(s), ") if hours else "")
187 | + ((str(minutes) + " minute(s), ") if minutes else "")
188 | + ((str(seconds) + " second(s), ") if seconds else "")
189 | + ((str(milliseconds) + " millisecond(s), ") if milliseconds else "")
190 | )
191 | return tmp[:-2]
192 |
193 |
194 | def get_file_extension_from_url(url):
195 | url_path = urlparse(url).path
196 | basename = os.path.basename(url_path)
197 | return basename.split(".")[-1]
198 |
199 |
200 | async def download_song(url):
201 | song_name = f"{randint(6969, 6999)}.mp3"
202 | async with aiohttp.ClientSession() as session:
203 | async with session.get(url) as resp:
204 | if resp.status == 200:
205 | f = await aiofiles.open(song_name, mode="wb")
206 | await f.write(await resp.read())
207 | await f.close()
208 | return song_name
209 |
210 |
211 | def time_to_seconds(times):
212 | stringt = str(times)
213 | return sum(int(x) * 60 ** i for i, x in enumerate(reversed(stringt.split(":"))))
214 |
215 |
216 | @Client.on_message(
217 | command(["vsong", f"vsong@{bn}", "video", f"video@{bn}"]) & ~filters.edited
218 | )
219 | async def vsong(client, message):
220 | ydl_opts = {
221 | "format": "best",
222 | "keepvideo": True,
223 | "prefer_ffmpeg": False,
224 | "geo_bypass": True,
225 | "outtmpl": "%(title)s.%(ext)s",
226 | "quite": True,
227 | }
228 | query = " ".join(message.command[1:])
229 | try:
230 | results = YoutubeSearch(query, max_results=5).to_dict()
231 | link = f"https://youtube.com{results[0]['url_suffix']}"
232 | title = results[0]["title"][:40]
233 | thumbnail = results[0]["thumbnails"][0]
234 | thumb_name = f"{title}.jpg"
235 | thumb = requests.get(thumbnail, allow_redirects=True)
236 | open(thumb_name, "wb").write(thumb.content)
237 | results[0]["duration"]
238 | results[0]["url_suffix"]
239 | results[0]["views"]
240 | message.from_user.mention
241 | except Exception as e:
242 | print(e)
243 | try:
244 | msg = await message.reply("📥 **downloading video...**")
245 | with YoutubeDL(ydl_opts) as ytdl:
246 | ytdl_data = ytdl.extract_info(link, download=True)
247 | file_name = ytdl.prepare_filename(ytdl_data)
248 | except Exception as e:
249 | return await msg.edit(f"🚫 **error:** {e}")
250 | preview = wget.download(thumbnail)
251 | await msg.edit("📤 **uploading video...**")
252 | await message.reply_video(
253 | file_name,
254 | duration=int(ytdl_data["duration"]),
255 | thumb=preview,
256 | caption=ytdl_data["title"],
257 | )
258 | try:
259 | os.remove(file_name)
260 | await msg.delete()
261 | except Exception as e:
262 | print(e)
263 |
264 |
265 | @Client.on_message(command(["lyrics", f"lyrics@{bn}"]))
266 | async def lyrics(_, message):
267 | try:
268 | if len(message.command) < 2:
269 | await message.reply_text("» **give a lyric name too.**")
270 | return
271 | query = message.text.split(None, 1)[1]
272 | rep = await message.reply_text("🔎 **searching lyrics...**")
273 | resp = requests.get(
274 | f"https://api-tede.herokuapp.com/api/lirik?l={query}"
275 | ).json()
276 | result = f"{resp['data']}"
277 | await rep.edit(result)
278 | except Exception:
279 | await rep.edit("❌ **lyrics not found.**\n\n» **please give a valid song name.**")
280 |
--------------------------------------------------------------------------------
/Herox/play.py:
--------------------------------------------------------------------------------
1 | # TrickyAbhi Created by Herox
2 |
3 | import io
4 | from os import path
5 | from typing import Callable
6 | from asyncio.queues import QueueEmpty
7 | import os
8 | import random
9 | import re
10 | import aiofiles
11 | import aiohttp
12 | import ffmpeg
13 | import requests
14 | from SJM.fonts import CHAT_TITLE
15 | from PIL import Image, ImageDraw, ImageFont
16 | from config import ASSISTANT_NAME, BOT_USERNAME, IMG_1, IMG_2, IMG_5
17 | from SJM.filters import command, other_filters
18 | from SJM.queues import QUEUE, add_to_queue
19 | from TrickyAbhi.main import call_py, user
20 | from SJM.utils import bash
21 | from pyrogram import Client
22 | from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant
23 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
24 | from pytgcalls import StreamType
25 | from pytgcalls.types.input_stream import AudioPiped
26 | from youtubesearchpython import VideosSearch
27 | import youtube_dl
28 |
29 |
30 |
31 | def ytsearch(query: str):
32 | try:
33 | search = VideosSearch(query, limit=1).result()
34 | data = search["result"][0]
35 | songname = data["title"]
36 | url = data["link"]
37 | duration = data["duration"]
38 | thumbnail = f"https://i.ytimg.com/vi/{data['id']}/hqdefault.jpg"
39 | return [songname, url, duration, thumbnail]
40 | except Exception as e:
41 | print(e)
42 | return 0
43 |
44 |
45 | async def ytdl(format: str, link: str):
46 | stdout, stderr = await bash(f'youtube-dl -g -f "{format}" {link}')
47 | if stdout:
48 | return 1, stdout.split("\n")[0]
49 | return 0, stderr
50 |
51 |
52 | chat_id = None
53 | DISABLED_GROUPS = []
54 | useer = "NaN"
55 | ACTV_CALLS = []
56 |
57 |
58 |
59 |
60 | def transcode(filename):
61 | ffmpeg.input(filename).output(
62 | "input.raw",
63 | format="s16le",
64 | acodec="pcm_s16le",
65 | ac=2,
66 | ar="48k"
67 | ).overwrite_output().run()
68 | os.remove(filename)
69 |
70 | def convert_seconds(seconds):
71 | seconds = seconds % (24 * 3600)
72 | seconds %= 3600
73 | minutes = seconds // 60
74 | seconds %= 60
75 | return "%02d:%02d" % (minutes, seconds)
76 |
77 | def time_to_seconds(time):
78 | stringt = str(time)
79 | return sum(int(x) * 60 ** i for i, x in enumerate(reversed(stringt.split(":"))))
80 |
81 |
82 |
83 | def changeImageSize(maxWidth, maxHeight, image):
84 | widthRatio = maxWidth / image.size[0]
85 | heightRatio = maxHeight / image.size[1]
86 | newWidth = int(widthRatio * image.size[0])
87 | newHeight = int(heightRatio * image.size[1])
88 | newImage = image.resize((newWidth, newHeight))
89 | return newImage
90 |
91 |
92 | async def generate_cover(thumbnail, title, userid, ctitle):
93 | async with aiohttp.ClientSession() as session:
94 | async with session.get(thumbnail) as resp:
95 | if resp.status == 200:
96 | f = await aiofiles.open(f"thumb{userid}.png", mode="wb")
97 | await f.write(await resp.read())
98 | await f.close()
99 | image1 = Image.open(f"thumb{userid}.png")
100 | image2 = Image.open("TrickyAbhi/heroxmusic.png")
101 | image3 = changeImageSize(1280, 720, image1)
102 | image4 = changeImageSize(1280, 720, image2)
103 | image5 = image3.convert("RGBA")
104 | image6 = image4.convert("RGBA")
105 | Image.alpha_composite(image5, image6).save(f"temp{userid}.png")
106 | img = Image.open(f"temp{userid}.png")
107 | draw = ImageDraw.Draw(img)
108 | font = ImageFont.truetype("TrickyAbhi/finalfont.ttf", 60)
109 | font2 = ImageFont.truetype("TrickyAbhi/finalfont.ttf", 70)
110 | draw.text((20, 45), f"{title[:30]}...", fill= "white", stroke_width = 1, stroke_fill="white", font=font2)
111 | draw.text((120, 595), f"Playing on: {ctitle[:20]}...", fill="white", stroke_width = 1, stroke_fill="white" ,font=font)
112 | img.save(f"final{userid}.png")
113 | os.remove(f"temp{userid}.png")
114 | os.remove(f"thumb{userid}.png")
115 | final = f"final{userid}.png"
116 | return final
117 |
118 |
119 |
120 |
121 |
122 | @Client.on_message(command(["play", f"play@{BOT_USERNAME}"]) & other_filters)
123 | async def play(c: Client, m: Message):
124 | await m.delete()
125 | replied = m.reply_to_message
126 | chat_id = m.chat.id
127 | keyboard = InlineKeyboardMarkup(
128 | [[
129 | InlineKeyboardButton("⏹", callback_data="cbstop"),
130 | InlineKeyboardButton("⏸", callback_data="cbpause"),
131 | InlineKeyboardButton('⏭️', callback_data="skip"),
132 | InlineKeyboardButton("▶️", callback_data="cbresume"),
133 | ],[
134 | InlineKeyboardButton("• Cʜᴀɴɴᴇʟ", url=f"https://t.me/Techno_Trickop"),
135 | InlineKeyboardButton("• Group", url=f"https://t.me/TrickyAbhii_Op"),
136 | ],[
137 | InlineKeyboardButton("🗑 Close", callback_data="cls")],
138 | ]
139 | )
140 | if m.sender_chat:
141 | return await m.reply_text("you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights.")
142 | try:
143 | aing = await c.get_me()
144 | except Exception as e:
145 | return await m.reply_text(f"error:\n\n{e}")
146 | a = await c.get_chat_member(chat_id, aing.id)
147 | if a.status != "administrator":
148 | await m.reply_text(
149 | f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Add users__\n» ❌ __Manage video chat__\n\nData is **updated** automatically after you **promote me**"
150 | )
151 | return
152 | if not a.can_manage_voice_chats:
153 | await m.reply_text(
154 | "missing required permission:" + "\n\n» ❌ __Manage video chat__"
155 | )
156 | return
157 | if not a.can_delete_messages:
158 | await m.reply_text(
159 | "missing required permission:" + "\n\n» ❌ __Delete messages__"
160 | )
161 | return
162 | if not a.can_invite_users:
163 | await m.reply_text("missing required permission:" + "\n\n» ❌ __Add users__")
164 | return
165 | try:
166 | ubot = (await user.get_me()).id
167 | b = await c.get_chat_member(chat_id, ubot)
168 | if b.status == "kicked":
169 | await m.reply_text(
170 | f"@{ASSISTANT_NAME} **is banned in group** {m.chat.title}\n\n» **unban the userbot first if you want to use this bot.**"
171 | )
172 | return
173 | except UserNotParticipant:
174 | if m.chat.username:
175 | try:
176 | await user.join_chat(m.chat.username)
177 | except Exception as e:
178 | await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**: `{e}`")
179 | return
180 | else:
181 | try:
182 | invitelink = await c.export_chat_invite_link(
183 | m.chat.id
184 | )
185 | if invitelink.startswith("https://t.me/+"):
186 | invitelink = invitelink.replace(
187 | "https://t.me/+", "https://t.me/joinchat/"
188 | )
189 | await user.join_chat(invitelink)
190 | except UserAlreadyParticipant:
191 | pass
192 | except Exception as e:
193 | return await m.reply_text(
194 | f"❌ **userbot failed to join**\n\n**reason**: `{e}`"
195 | )
196 | if replied:
197 | if replied.audio or replied.voice:
198 | suhu = await replied.reply("📥 **downloading audio...**")
199 | dl = await replied.download()
200 | link = replied.link
201 | if replied.audio:
202 | if replied.audio.title:
203 | songname = replied.audio.title[:70]
204 | else:
205 | if replied.audio.file_name:
206 | songname = replied.audio.file_name[:70]
207 | else:
208 | songname = "Audio"
209 | elif replied.voice:
210 | songname = "Voice Note"
211 | if chat_id in QUEUE:
212 | pos = add_to_queue(chat_id, songname, dl, link, "Audio", 0)
213 | await suhu.delete()
214 | await m.reply_photo(
215 | photo=f"{IMG_1}",
216 | caption=f"💡 **Track added to queue »** `{pos}`\n\n🏷 **Name:** [{songname}]({link}) | `music`\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {m.from_user.mention()}",
217 | reply_markup=keyboard,
218 | )
219 | else:
220 | try:
221 | await call_py.join_group_call(
222 | chat_id,
223 | AudioPiped(
224 | dl,
225 | ),
226 | stream_type=StreamType().local_stream,
227 | )
228 | add_to_queue(chat_id, songname, dl, link, "Audio", 0)
229 | await suhu.delete()
230 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
231 | await m.reply_photo(
232 | photo=f"{IMG_2}",
233 | caption=f"🏷 **Name:** [{songname}]({link})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}\n📹 **Stream type:** `Music`",
234 | reply_markup=keyboard,
235 | )
236 | except Exception as e:
237 | await suhu.delete()
238 | await m.reply_text(f"🚫 error:\n\n» {e}")
239 |
240 | else:
241 | if len(m.command) < 2:
242 | await m.reply_photo(
243 | photo=f"{IMG_5}",
244 | caption="💬**Usage: /play Give a Title Song To Play Music or join @aboutez**"
245 | ,
246 | reply_markup=InlineKeyboardMarkup(
247 | [
248 | [
249 | InlineKeyboardButton("~ Channel ~", url=f"https://t.me/Techno_Trickop"),
250 | InlineKeyboardButton("~ Support ~", url=f"https://t.me/TrickyAbhii_Op")
251 | ],
252 | [
253 | InlineKeyboardButton("🗑 Close", callback_data="cls")
254 | ]
255 | ]
256 | )
257 | )
258 | else:
259 | suhu = await m.reply_text(
260 | f"**𝙃𝙀𝙍𝙊𝙓 𝙈𝙐𝙎𝙄𝘾**\n\n0% ▓▓▓▓▓▓▓▓▓▓▓▓ 100%"
261 | )
262 | query = m.text.split(None, 1)[1]
263 | search = ytsearch(query)
264 | if search == 0:
265 | await suhu.edit("💬 **no results found.**")
266 | else:
267 | songname = search[0]
268 | title = search[0]
269 | url = search[1]
270 | duration = search[2]
271 | thumbnail = search[3]
272 | userid = m.from_user.id
273 | gcname = m.chat.title
274 | ctitle = await CHAT_TITLE(gcname)
275 | image = await generate_cover(thumbnail, title, userid, ctitle)
276 | format = "bestaudio[ext=m4a]"
277 | abhi, ytlink = await ytdl(format, url)
278 | if abhi == 0:
279 | await suhu.edit(f"💬 yt-dl issues detected\n\n» `{ytlink}`")
280 | else:
281 | if chat_id in QUEUE:
282 | pos = add_to_queue(chat_id, songname, ytlink, url, "Audio", 0)
283 | await suhu.delete()
284 | requester = (
285 | f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
286 | )
287 | await m.reply_photo(
288 | photo=image,
289 | caption=f"💡 **Track added to queue »** `{pos}`\n\n🏷 **Name:** [{songname[:22]}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🎧 **Request by:** {requester}",
290 | reply_markup=keyboard,
291 | )
292 | else:
293 | try:
294 | await suhu.edit("🔄 **Connecting to vc...**")
295 | await call_py.join_group_call(
296 | chat_id,
297 | AudioPiped(
298 | ytlink,
299 | ),
300 | stream_type=StreamType().local_stream,
301 | )
302 | add_to_queue(chat_id, songname, ytlink, url, "Audio", 0)
303 | await suhu.delete()
304 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
305 | await m.reply_photo(
306 | photo=image,
307 | caption=f"🏷 **Name:** [{songname[:22]}]({url})\n**⏱ Duration:** `{duration}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}",
308 | reply_markup=keyboard,
309 | )
310 | except Exception as ep:
311 | await suhu.delete()
312 | await m.reply_text(f"💬 error: `{ep}`")
313 |
--------------------------------------------------------------------------------
/Herox/admins.py:
--------------------------------------------------------------------------------
1 | from SJM.Cache.admins import admins
2 | from TrickyAbhi.main import call_py
3 | from pyrogram import Client, filters
4 | from SJM.decorators import authorized_users_only
5 | from SJM.filters import command, other_filters
6 | from SJM.queues import QUEUE, clear_queue
7 | from SJM.utils import skip_current_song, skip_item
8 | from config import BOT_USERNAME, GROUP_SUPPORT, IMG_3, UPDATES_CHANNEL
9 | from pyrogram.types import (
10 | CallbackQuery,
11 | InlineKeyboardButton,
12 | InlineKeyboardMarkup,
13 | Message,
14 | )
15 |
16 |
17 | bttn = InlineKeyboardMarkup(
18 | [[InlineKeyboardButton("🔙 Go Back", callback_data="cbmenu")]]
19 | )
20 |
21 |
22 | bcl = InlineKeyboardMarkup(
23 | [[InlineKeyboardButton("🗑 Close", callback_data="cls")]]
24 | )
25 |
26 |
27 | @Client.on_message(command(["reload", f"reload@{BOT_USERNAME}"]) & other_filters)
28 | @authorized_users_only
29 | async def update_admin(client, message):
30 | global admins
31 | new_admins = []
32 | new_ads = await client.get_chat_members(message.chat.id, filter="administrators")
33 | for u in new_ads:
34 | new_admins.append(u.user.id)
35 | admins[message.chat.id] = new_admins
36 | await message.reply_text(
37 | "✅ Bot **reloaded correctly !**\n✅ **Admin list** has **updated !**"
38 | )
39 |
40 |
41 | @Client.on_message(command(["skip", f"skip@{BOT_USERNAME}", "vskip"]) & other_filters)
42 | @authorized_users_only
43 | async def skip(client, m: Message):
44 |
45 | keyboard = InlineKeyboardMarkup(
46 | [
47 | [
48 | InlineKeyboardButton(
49 | text="• Mᴇɴᴜ", callback_data="cbmenu"
50 | ),
51 | InlineKeyboardButton(
52 | text="• Cʟᴏsᴇ", callback_data="cls"
53 | ),
54 | ]
55 | ]
56 | )
57 |
58 | chat_id = m.chat.id
59 | if len(m.command) < 2:
60 | op = await skip_current_song(chat_id)
61 | if op == 0:
62 | await m.reply("❌ nothing is currently playing")
63 | elif op == 1:
64 | await m.reply("✅ __Queues__ **is empty.**\n\n**• userbot leaving voice chat**")
65 | elif op == 2:
66 | await m.reply("🗑️ **Clearing the Queues**\n\n**• userbot leaving voice chat**")
67 | else:
68 | await m.reply_photo(
69 | photo=f"{IMG_3}",
70 | caption=f"⏭ **Skipped to the next track.**\n\n🏷 **Name:** [{op[0]}]({op[1]})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {m.from_user.mention()}",
71 | reply_markup=keyboard,
72 | )
73 | else:
74 | skip = m.text.split(None, 1)[1]
75 | OP = "🗑 **removed song from queue:**"
76 | if chat_id in QUEUE:
77 | items = [int(x) for x in skip.split(" ") if x.isdigit()]
78 | items.sort(reverse=True)
79 | for x in items:
80 | if x == 0:
81 | pass
82 | else:
83 | hm = await skip_item(chat_id, x)
84 | if hm == 0:
85 | pass
86 | else:
87 | OP = OP + "\n" + f"**#{x}** - {hm}"
88 | await m.reply(OP)
89 |
90 |
91 | @Client.on_message(
92 | command(["stop", f"stop@{BOT_USERNAME}", "end", f"end@{BOT_USERNAME}", "vstop"])
93 | & other_filters
94 | )
95 | @authorized_users_only
96 | async def stop(client, m: Message):
97 | chat_id = m.chat.id
98 | if chat_id in QUEUE:
99 | try:
100 | await call_py.leave_group_call(chat_id)
101 | clear_queue(chat_id)
102 | await m.reply("✅ The userbot has disconnected from the video chat.")
103 | except Exception as e:
104 | await m.reply(f"🚫 **error:**\n\n`{e}`")
105 | else:
106 | await m.reply("❌ **nothing is streaming**")
107 |
108 |
109 | @Client.on_message(
110 | command(["pause", f"pause@{BOT_USERNAME}", "vpause"]) & other_filters
111 | )
112 | @authorized_users_only
113 | async def pause(client, m: Message):
114 | chat_id = m.chat.id
115 | if chat_id in QUEUE:
116 | try:
117 | await call_py.pause_stream(chat_id)
118 | await m.reply(
119 | "⏸ **Track paused.**\n\n• **To resume the stream, use the**\n» /resume command."
120 | )
121 | except Exception as e:
122 | await m.reply(f"🚫 **error:**\n\n`{e}`")
123 | else:
124 | await m.reply("❌ **nothing in streaming**")
125 |
126 |
127 | @Client.on_message(
128 | command(["resume", f"resume@{BOT_USERNAME}", "vresume"]) & other_filters
129 | )
130 | @authorized_users_only
131 | async def resume(client, m: Message):
132 | chat_id = m.chat.id
133 | if chat_id in QUEUE:
134 | try:
135 | await call_py.resume_stream(chat_id)
136 | await m.reply(
137 | "▶️ **Track resumed.**\n\n• **To pause the stream, use the**\n» /pause command."
138 | )
139 | except Exception as e:
140 | await m.reply(f"🚫 **error:**\n\n`{e}`")
141 | else:
142 | await m.reply("❌ **nothing in streaming**")
143 |
144 |
145 | @Client.on_message(
146 | command(["mute", f"mute@{BOT_USERNAME}", "vmute"]) & other_filters
147 | )
148 | @authorized_users_only
149 | async def mute(client, m: Message):
150 | chat_id = m.chat.id
151 | if chat_id in QUEUE:
152 | try:
153 | await call_py.mute_stream(chat_id)
154 | await m.reply(
155 | "🔇 **Userbot muted.**\n\n• **To unmute the userbot, use the**\n» /unmute command."
156 | )
157 | except Exception as e:
158 | await m.reply(f"🚫 **error:**\n\n`{e}`")
159 | else:
160 | await m.reply("❌ **nothing in streaming**")
161 |
162 |
163 | @Client.on_message(
164 | command(["unmute", f"unmute@{BOT_USERNAME}", "vunmute"]) & other_filters
165 | )
166 | @authorized_users_only
167 | async def unmute(client, m: Message):
168 | chat_id = m.chat.id
169 | if chat_id in QUEUE:
170 | try:
171 | await call_py.unmute_stream(chat_id)
172 | await m.reply(
173 | "🔊 **Userbot unmuted.**\n\n• **To mute the userbot, use the**\n» /mute command."
174 | )
175 | except Exception as e:
176 | await m.reply(f"🚫 **error:**\n\n`{e}`")
177 | else:
178 | await m.reply("❌ **nothing in streaming**")
179 |
180 |
181 | @Client.on_callback_query(filters.regex("cbpause"))
182 | async def cbpause(_, query: CallbackQuery):
183 | if query.message.sender_chat:
184 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
185 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
186 | if not a.can_manage_voice_chats:
187 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
188 | chat_id = query.message.chat.id
189 | if chat_id in QUEUE:
190 | try:
191 | await call_py.pause_stream(chat_id)
192 | await query.edit_message_text(
193 | "⏸ the streaming has paused", reply_markup=bttn
194 | )
195 | except Exception as e:
196 | await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl)
197 | else:
198 | await query.answer("❌ nothing is currently streaming", show_alert=True)
199 |
200 |
201 | @Client.on_callback_query(filters.regex("cbresume"))
202 | async def cbresume(_, query: CallbackQuery):
203 | if query.message.sender_chat:
204 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
205 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
206 | if not a.can_manage_voice_chats:
207 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
208 | chat_id = query.message.chat.id
209 | if chat_id in QUEUE:
210 | try:
211 | await call_py.resume_stream(chat_id)
212 | await query.edit_message_text(
213 | "▶️ the streaming has resumed", reply_markup=bttn
214 | )
215 | except Exception as e:
216 | await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl)
217 | else:
218 | await query.answer("❌ nothing is currently streaming", show_alert=True)
219 |
220 |
221 | @Client.on_callback_query(filters.regex("cbstop"))
222 | async def cbstop(_, query: CallbackQuery):
223 | if query.message.sender_chat:
224 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
225 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
226 | if not a.can_manage_voice_chats:
227 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
228 | chat_id = query.message.chat.id
229 | if chat_id in QUEUE:
230 | try:
231 | await call_py.leave_group_call(chat_id)
232 | clear_queue(chat_id)
233 | await query.edit_message_text("✅ **this streaming has ended**", reply_markup=bcl)
234 | except Exception as e:
235 | await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl)
236 | else:
237 | await query.answer("❌ nothing is currently streaming", show_alert=True)
238 |
239 |
240 | @Client.on_callback_query(filters.regex("cbmute"))
241 | async def cbmute(_, query: CallbackQuery):
242 | if query.message.sender_chat:
243 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
244 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
245 | if not a.can_manage_voice_chats:
246 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
247 | chat_id = query.message.chat.id
248 | if chat_id in QUEUE:
249 | try:
250 | await call_py.mute_stream(chat_id)
251 | await query.edit_message_text(
252 | "🔇 userbot succesfully muted", reply_markup=bttn
253 | )
254 | except Exception as e:
255 | await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl)
256 | else:
257 | await query.answer("❌ nothing is currently streaming", show_alert=True)
258 |
259 |
260 | @Client.on_callback_query(filters.regex("cbunmute"))
261 | async def cbunmute(_, query: CallbackQuery):
262 | if query.message.sender_chat:
263 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
264 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
265 | if not a.can_manage_voice_chats:
266 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
267 | chat_id = query.message.chat.id
268 | if chat_id in QUEUE:
269 | try:
270 | await call_py.unmute_stream(chat_id)
271 | await query.edit_message_text(
272 | "🔊 userbot succesfully unmuted", reply_markup=bttn
273 | )
274 | except Exception as e:
275 | await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl)
276 | else:
277 | await query.answer("❌ nothing is currently streaming", show_alert=True)
278 |
279 |
280 | @Client.on_message(
281 | command(["volume", f"volume@{BOT_USERNAME}", "vol"]) & other_filters
282 | )
283 | @authorized_users_only
284 | async def change_volume(client, m: Message):
285 | range = m.command[1]
286 | chat_id = m.chat.id
287 | if chat_id in QUEUE:
288 | try:
289 | await call_py.change_volume_call(chat_id, volume=int(range))
290 | await m.reply(
291 | f"✅ **volume set to** `{range}`%"
292 | )
293 | except Exception as e:
294 | await m.reply(f"🚫 **error:**\n\n`{e}`")
295 | else:
296 | await m.reply("❌ **nothing in streaming**")
297 |
298 |
299 | @Client.on_callback_query(filters.regex("cbpause"))
300 | async def cbpause(_, query: CallbackQuery):
301 | if query.message.sender_chat:
302 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
303 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
304 | if not a.can_manage_voice_chats:
305 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
306 | chat_id = query.message.chat.id
307 | if chat_id in QUEUE:
308 | try:
309 | await call_py.pause_stream(chat_id)
310 | await query.edit_message_text(
311 | "💬 the streaming has paused", reply_markup=bttn
312 | )
313 | except Exception as e:
314 | await query.edit_message_text(f"💬 **error:**\n\n`{e}`", reply_markup=bcl)
315 | else:
316 | await query.answer("💬 nothing is currently streaming", show_alert=True)
317 |
318 |
319 | @Client.on_callback_query(filters.regex("cbresume"))
320 | async def cbresume(_, query: CallbackQuery):
321 | if query.message.sender_chat:
322 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
323 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
324 | if not a.can_manage_voice_chats:
325 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
326 | chat_id = query.message.chat.id
327 | if chat_id in QUEUE:
328 | try:
329 | await call_py.resume_stream(chat_id)
330 | await query.edit_message_text(
331 | "💬 the streaming has resumed", reply_markup=bttn
332 | )
333 | except Exception as e:
334 | await query.edit_message_text(f"💬 **error:**\n\n`{e}`", reply_markup=bcl)
335 | else:
336 | await query.answer("💬 nothing is currently streaming", show_alert=True)
337 |
338 |
339 | @Client.on_callback_query(filters.regex("cbstop"))
340 | async def cbstop(_, query: CallbackQuery):
341 | if query.message.sender_chat:
342 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
343 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
344 | if not a.can_manage_voice_chats:
345 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
346 | chat_id = query.message.chat.id
347 | if chat_id in QUEUE:
348 | try:
349 | await call_py.leave_group_call(chat_id)
350 | clear_queue(chat_id)
351 | await query.edit_message_text("💬 **this streaming has ended**", reply_markup=bcl)
352 | except Exception as e:
353 | await query.edit_message_text(f"💬 **error:**\n\n`{e}`", reply_markup=bcl)
354 | else:
355 | await query.answer("💬 nothing is currently streaming", show_alert=True)
356 |
357 |
358 | @Client.on_callback_query(filters.regex("cbmute"))
359 | async def cbmute(_, query: CallbackQuery):
360 | if query.message.sender_chat:
361 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
362 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
363 | if not a.can_manage_voice_chats:
364 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
365 | chat_id = query.message.chat.id
366 | if chat_id in QUEUE:
367 | try:
368 | await call_py.mute_stream(chat_id)
369 | await query.edit_message_text(
370 | "💬 userbot succesfully muted", reply_markup=bttn
371 | )
372 | except Exception as e:
373 | await query.edit_message_text(f"💬 **error:**\n\n`{e}`", reply_markup=bcl)
374 | else:
375 | await query.answer("💬 nothing is currently streaming", show_alert=True)
376 |
377 |
378 | @Client.on_callback_query(filters.regex("cbunmute"))
379 | async def cbunmute(_, query: CallbackQuery):
380 | if query.message.sender_chat:
381 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
382 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
383 | if not a.can_manage_voice_chats:
384 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
385 | chat_id = query.message.chat.id
386 | if chat_id in QUEUE:
387 | try:
388 | await call_py.unmute_stream(chat_id)
389 | await query.edit_message_text(
390 | "💬 userbot succesfully unmuted", reply_markup=bttn
391 | )
392 | except Exception as e:
393 | await query.edit_message_text(f"💬 **error:**\n\n`{e}`", reply_markup=bcl)
394 | else:
395 | await query.answer("💬 nothing is currently streaming", show_alert=True)
396 |
397 |
398 | @Client.on_message(
399 | command(["volume", f"volume@{BOT_USERNAME}", "vol"]) & other_filters
400 | )
401 | @authorized_users_only
402 | async def change_volume(client, m: Message):
403 | range = m.command[1]
404 | chat_id = m.chat.id
405 | if chat_id in QUEUE:
406 | try:
407 | await call_py.change_volume_call(chat_id, volume=int(range))
408 | await m.reply(
409 | f"💬 **volume set to** `{range}`%"
410 | )
411 | except Exception as e:
412 | await m.reply(f"💬 **error:**\n\n`{e}`")
413 | else:
414 | await m.reply("💬 **nothing in streaming**")
415 |
416 |
417 | # whats up by Herox
418 |
--------------------------------------------------------------------------------
/Herox/video.py:
--------------------------------------------------------------------------------
1 | import os
2 | import re
3 | import asyncio
4 | import aiohttp
5 | import aiofiles
6 |
7 | from config import ASSISTANT_NAME, BOT_USERNAME, IMG_1, IMG_2, IMG_6, GROUP_SUPPORT, UPDATES_CHANNEL
8 | from Herox.inline import stream_markup
9 | from SJM.fonts import CHAT_TITLE
10 | from PIL import Image, ImageDraw, ImageFont
11 | from SJM.filters import command, other_filters
12 | from SJM.queues import QUEUE, add_to_queue
13 | from TrickyAbhi.main import call_py, user
14 | from pyrogram import Client
15 | from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant
16 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
17 | from pytgcalls import StreamType
18 | from pytgcalls.types.input_stream import AudioVideoPiped
19 | from pytgcalls.types.input_stream.quality import (
20 | HighQualityAudio,
21 | HighQualityVideo,
22 | LowQualityVideo,
23 | MediumQualityVideo,
24 | )
25 | from youtubesearchpython import VideosSearch
26 |
27 |
28 | def ytsearch(query: str):
29 | try:
30 | search = VideosSearch(query, limit=1).result()
31 | data = search["result"][0]
32 | songname = data["title"]
33 | url = data["link"]
34 | duration = data["duration"]
35 | thumbnail = f"https://i.ytimg.com/vi/{data['id']}/hqdefault.jpg"
36 | return [songname, url, duration, thumbnail]
37 | except Exception as e:
38 | print(e)
39 | return 0
40 |
41 |
42 | async def ytdl(link):
43 | proc = await asyncio.create_subprocess_exec(
44 | "yt-dlp",
45 | "-g",
46 | "-f",
47 | "best[height<=?720][width<=?1280]",
48 | f"{link}",
49 | stdout=asyncio.subprocess.PIPE,
50 | stderr=asyncio.subprocess.PIPE,
51 | )
52 | stdout, stderr = await proc.communicate()
53 | if stdout:
54 | return 1, stdout.decode().split("\n")[0]
55 | else:
56 | return 0, stderr.decode()
57 |
58 | def transcode(filename):
59 | ffmpeg.input(filename).output(
60 | "input.raw",
61 | format="s16le",
62 | acodec="pcm_s16le",
63 | ac=2,
64 | ar="48k"
65 | ).overwrite_output().run()
66 | os.remove(filename)
67 |
68 | def convert_seconds(seconds):
69 | seconds = seconds % (24 * 3600)
70 | seconds %= 3600
71 | minutes = seconds // 60
72 | seconds %= 60
73 | return "%02d:%02d" % (minutes, seconds)
74 |
75 | def time_to_seconds(time):
76 | stringt = str(time)
77 | return sum(int(x) * 60 ** i for i, x in enumerate(reversed(stringt.split(":"))))
78 |
79 |
80 |
81 | def changeImageSize(maxWidth, maxHeight, image):
82 | widthRatio = maxWidth / image.size[0]
83 | heightRatio = maxHeight / image.size[1]
84 | newWidth = int(widthRatio * image.size[0])
85 | newHeight = int(heightRatio * image.size[1])
86 | newImage = image.resize((newWidth, newHeight))
87 | return newImage
88 |
89 |
90 | async def generate_cover(thumbnail, title, userid, ctitle):
91 | async with aiohttp.ClientSession() as session:
92 | async with session.get(thumbnail) as resp:
93 | if resp.status == 200:
94 | f = await aiofiles.open(f"thumb{userid}.png", mode="wb")
95 | await f.write(await resp.read())
96 | await f.close()
97 | image1 = Image.open(f"thumb{userid}.png")
98 | image2 = Image.open("TrickyAbhi/heroxmusic.png")
99 | image3 = changeImageSize(1280, 720, image1)
100 | image4 = changeImageSize(1280, 720, image2)
101 | image5 = image3.convert("RGBA")
102 | image6 = image4.convert("RGBA")
103 | Image.alpha_composite(image5, image6).save(f"temp{userid}.png")
104 | img = Image.open(f"temp{userid}.png")
105 | draw = ImageDraw.Draw(img)
106 | font = ImageFont.truetype("TrickyAbhi/finalfont.ttf", 60)
107 | font2 = ImageFont.truetype("TrickyAbhi/finalfont.ttf", 70)
108 | draw.text((20, 45), f"{title[:30]}...", fill= "white", stroke_width = 1, stroke_fill="white", font=font2)
109 | draw.text((120, 595), f"Playing on: {ctitle[:20]}...", fill="white", stroke_width = 1, stroke_fill="white" ,font=font)
110 | img.save(f"final{userid}.png")
111 | os.remove(f"temp{userid}.png")
112 | os.remove(f"thumb{userid}.png")
113 | final = f"final{userid}.png"
114 | return final
115 |
116 |
117 | @Client.on_message(command(["vplay", f"vplay@{BOT_USERNAME}"]) & other_filters)
118 | async def vplay(c: Client, m: Message):
119 | await m.delete()
120 | replied = m.reply_to_message
121 | chat_id = m.chat.id
122 | user_id = m.from_user.id
123 | if m.sender_chat:
124 | return await m.reply_text("you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights.")
125 | try:
126 | aing = await c.get_me()
127 | except Exception as e:
128 | return await m.reply_text(f"error:\n\n{e}")
129 | a = await c.get_chat_member(chat_id, aing.id)
130 | if a.status != "administrator":
131 | await m.reply_text(
132 | f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Invite users__\n» ❌ __Manage video chat__\n\nOnce done, type /reload"
133 | )
134 | return
135 | if not a.can_manage_voice_chats:
136 | await m.reply_text(
137 | "💡 To use me, Give me the following permission below:"
138 | + "\n\n» ❌ __Manage video chat__\n\nOnce done, try again.")
139 | return
140 | if not a.can_delete_messages:
141 | await m.reply_text(
142 | "💡 To use me, Give me the following permission below:"
143 | + "\n\n» ❌ __Delete messages__\n\nOnce done, try again.")
144 | return
145 | if not a.can_invite_users:
146 | await m.reply_text(
147 | "💡 To use me, Give me the following permission below:"
148 | + "\n\n» ❌ __Add users__\n\nOnce done, try again.")
149 | return
150 | try:
151 | ubot = (await user.get_me()).id
152 | b = await c.get_chat_member(chat_id, ubot)
153 | if b.status == "kicked":
154 | await c.unban_chat_member(chat_id, ubot)
155 | invitelink = await c.export_chat_invite_link(chat_id)
156 | if invitelink.startswith("https://t.me/+"):
157 | invitelink = invitelink.replace(
158 | "https://t.me/+", "https://t.me/joinchat/"
159 | )
160 | await user.join_chat(invitelink)
161 | except UserNotParticipant:
162 | try:
163 | invitelink = await c.export_chat_invite_link(chat_id)
164 | if invitelink.startswith("https://t.me/+"):
165 | invitelink = invitelink.replace(
166 | "https://t.me/+", "https://t.me/joinchat/"
167 | )
168 | await user.join_chat(invitelink)
169 | except UserAlreadyParticipant:
170 | pass
171 | except Exception as e:
172 | return await m.reply_text(
173 | f"❌ **userbot failed to join**\n\n**reason**: `{e}`"
174 | )
175 |
176 | if replied:
177 | if replied.video or replied.document:
178 | loser = await replied.reply("📥 **downloading video...**")
179 | dl = await replied.download()
180 | link = replied.link
181 | if len(m.command) < 2:
182 | Q = 720
183 | else:
184 | pq = m.text.split(None, 1)[1]
185 | if pq == "720" or "480" or "360":
186 | Q = int(pq)
187 | else:
188 | Q = 720
189 | await loser.edit(
190 | "» __only 720, 480, 360 allowed__ \n💡 **now streaming video in 720p**"
191 | )
192 | try:
193 | if replied.video:
194 | songname = replied.video.file_name[:70]
195 | elif replied.document:
196 | songname = replied.document.file_name[:70]
197 | except BaseException:
198 | songname = "Video"
199 |
200 | if chat_id in QUEUE:
201 | pos = add_to_queue(chat_id, songname, dl, link, "Video", Q)
202 | await loser.delete()
203 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
204 | buttons = stream_markup(user_id)
205 | await m.reply_photo(
206 | photo=thumbnail,
207 | reply_markup=InlineKeyboardMarkup(buttons),
208 | caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({link}) | `video`\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
209 | )
210 | else:
211 | if Q == 720:
212 | amaze = HighQualityVideo()
213 | elif Q == 480:
214 | amaze = MediumQualityVideo()
215 | elif Q == 360:
216 | amaze = LowQualityVideo()
217 | await loser.edit("🔄 **Joining vc...**")
218 | await call_py.join_group_call(
219 | chat_id,
220 | AudioVideoPiped(
221 | dl,
222 | HighQualityAudio(),
223 | amaze,
224 | ),
225 | stream_type=StreamType().local_stream,
226 | )
227 | add_to_queue(chat_id, songname, dl, link, "Video", Q)
228 | await loser.delete()
229 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
230 | buttons = stream_markup(user_id)
231 | await m.reply_photo(
232 | photo=thumbnail,
233 | reply_markup=InlineKeyboardMarkup(buttons),
234 | caption=f"🗂 **Name:** [{songname}]({link}) | `video`\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
235 | )
236 | else:
237 | if len(m.command) < 2:
238 | await m.reply_photo(
239 | photo=f"{IMG_6}",
240 | caption="💬**Usage: /play Give a Title Song To Play Music or /vplay for Video Play**"
241 | ,
242 | reply_markup=InlineKeyboardMarkup(
243 | [
244 | [
245 | InlineKeyboardButton("• Channel", url=f"https://t.me/{UPDATES_CHANNEL}"),
246 | InlineKeyboardButton("• Support", url=f"https://t.me/{GROUP_SUPPORT}")
247 | ],
248 | [
249 | InlineKeyboardButton("🗑 Close", callback_data="cls")
250 | ]
251 | ]
252 | )
253 | )
254 | else:
255 | loser = await c.send_message(chat_id, "🔍 **Searching...**")
256 | query = m.text.split(None, 1)[1]
257 | search = ytsearch(query)
258 | Q = 720
259 | amaze = HighQualityVideo()
260 | if search == 0:
261 | await loser.edit("❌ **no results found.**")
262 | else:
263 | songname = search[0]
264 | title = search[0]
265 | url = search[1]
266 | duration = search[2]
267 | thumbnail = search[3]
268 | userid = m.from_user.id
269 | gcname = m.chat.title
270 | ctitle = await CHAT_TITLE(gcname)
271 | image = await thumb(thumbnail, title, userid, ctitle)
272 | abhi, ytlink = await ytdl(url)
273 | if abhi == 0:
274 | await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
275 | else:
276 | if chat_id in QUEUE:
277 | pos = add_to_queue(
278 | chat_id, songname, ytlink, url, "Video", Q
279 | )
280 | await loser.delete()
281 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
282 | buttons = stream_markup(user_id)
283 | await m.reply_photo(
284 | photo=image,
285 | reply_markup=InlineKeyboardMarkup(buttons),
286 | caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
287 | )
288 | else:
289 | try:
290 | await loser.edit("🔄 **Joining vc...**")
291 | await call_py.join_group_call(
292 | chat_id,
293 | AudioVideoPiped(
294 | ytlink,
295 | HighQualityAudio(),
296 | amaze,
297 | ),
298 | stream_type=StreamType().local_stream,
299 | )
300 | add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
301 | await loser.delete()
302 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
303 | buttons = stream_markup(user_id)
304 | await m.reply_photo(
305 | photo=image,
306 | reply_markup=InlineKeyboardMarkup(buttons),
307 | caption=f"🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
308 | )
309 | except Exception as ep:
310 | await loser.delete()
311 | await m.reply_text(f"🚫 error: `{ep}`")
312 |
313 | else:
314 | if len(m.command) < 2:
315 | await m.reply_photo(
316 | photo=f"{IMG_6}",
317 | caption="💬**Usage: /play Give a Title Song To Play Music or /vplay for Video Play**"
318 | ,
319 | reply_markup=InlineKeyboardMarkup(
320 | [
321 | [
322 | InlineKeyboardButton("• Channel", url=f"https://t.me/{UPDATES_CHANNEL}"),
323 | InlineKeyboardButton("• Support", url=f"https://t.me/{GROUP_SUPPORT}")
324 | ],
325 | [
326 | InlineKeyboardButton("🗑 Close", callback_data="cls")
327 | ]
328 | ]
329 | )
330 | )
331 | else:
332 | loser = await c.send_message(chat_id, "🔍 **Searching...**")
333 | query = m.text.split(None, 1)[1]
334 | search = ytsearch(query)
335 | Q = 720
336 | amaze = HighQualityVideo()
337 | if search == 0:
338 | await loser.edit("❌ **no results found.**")
339 | else:
340 | songname = search[0]
341 | title = search[0]
342 | url = search[1]
343 | duration = search[2]
344 | thumbnail = search[3]
345 | userid = m.from_user.id
346 | gcname = m.chat.title
347 | ctitle = await CHAT_TITLE(gcname)
348 | image = await generate_cover(thumbnail, title, userid, ctitle)
349 | abhi, ytlink = await ytdl(url)
350 | if abhi == 0:
351 | await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
352 | else:
353 | if chat_id in QUEUE:
354 | pos = add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
355 | await loser.delete()
356 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
357 | buttons = stream_markup(user_id)
358 | await m.reply_photo(
359 | photo=image,
360 | reply_markup=InlineKeyboardMarkup(buttons),
361 | caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
362 | )
363 | else:
364 | try:
365 | await loser.edit("🔄 **Joining vc...**")
366 | await call_py.join_group_call(
367 | chat_id,
368 | AudioVideoPiped(
369 | ytlink,
370 | HighQualityAudio(),
371 | amaze,
372 | ),
373 | stream_type=StreamType().local_stream,
374 | )
375 | add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
376 | await loser.delete()
377 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
378 | buttons = stream_markup(user_id)
379 | await m.reply_photo(
380 | photo=image,
381 | reply_markup=InlineKeyboardMarkup(buttons),
382 | caption=f"🗂 **Name:** [{songname}]({url}) |`video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
383 | )
384 | except Exception as ep:
385 | await loser.delete()
386 | await m.reply_text(f"🚫 error: `{ep}`")
387 |
388 |
389 | @Client.on_message(command(["vstream", f"vstream@{BOT_USERNAME}"]) & other_filters)
390 | async def vstream(c: Client, m: Message):
391 | await m.delete()
392 | chat_id = m.chat.id
393 | user_id = m.from_user.id
394 | if m.sender_chat:
395 | return await m.reply_text("you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights.")
396 | try:
397 | aing = await c.get_me()
398 | except Exception as e:
399 | return await m.reply_text(f"error:\n\n{e}")
400 | a = await c.get_chat_member(chat_id, aing.id)
401 | if a.status != "administrator":
402 | await m.reply_text(
403 | f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Invite users__\n» ❌ __Manage video chat__\n\nOnce done, type /reload"
404 | )
405 | return
406 | if not a.can_manage_voice_chats:
407 | await m.reply_text(
408 | "💡 To use me, Give me the following permission below:"
409 | + "\n\n» ❌ __Manage video chat__\n\nOnce done, try again.")
410 | return
411 | if not a.can_delete_messages:
412 | await m.reply_text(
413 | "💡 To use me, Give me the following permission below:"
414 | + "\n\n» ❌ __Delete messages__\n\nOnce done, try again.")
415 | return
416 | if not a.can_invite_users:
417 | await m.reply_text(
418 | "💡 To use me, Give me the following permission below:"
419 | + "\n\n» ❌ __Add users__\n\nOnce done, try again.")
420 | return
421 | try:
422 | ubot = (await user.get_me()).id
423 | b = await c.get_chat_member(chat_id, ubot)
424 | if b.status == "kicked":
425 | await c.unban_chat_member(chat_id, ubot)
426 | invitelink = await c.export_chat_invite_link(chat_id)
427 | if invitelink.startswith("https://t.me/+"):
428 | invitelink = invitelink.replace(
429 | "https://t.me/+", "https://t.me/joinchat/"
430 | )
431 | await user.join_chat(invitelink)
432 | except UserNotParticipant:
433 | try:
434 | invitelink = await c.export_chat_invite_link(chat_id)
435 | if invitelink.startswith("https://t.me/+"):
436 | invitelink = invitelink.replace(
437 | "https://t.me/+", "https://t.me/joinchat/"
438 | )
439 | await user.join_chat(invitelink)
440 | except UserAlreadyParticipant:
441 | pass
442 | except Exception as e:
443 | return await m.reply_text(
444 | f"❌ **userbot failed to join**\n\n**reason**: `{e}`"
445 | )
446 |
447 | if len(m.command) < 2:
448 | await m.reply("» give me a live-link/m3u8 url/youtube link to stream.")
449 | else:
450 | if len(m.command) == 2:
451 | link = m.text.split(None, 1)[1]
452 | Q = 720
453 | loser = await c.send_message(chat_id, "🔄 **processing stream...**")
454 | elif len(m.command) == 3:
455 | op = m.text.split(None, 1)[1]
456 | link = op.split(None, 1)[0]
457 | quality = op.split(None, 1)[1]
458 | if quality == "720" or "480" or "360":
459 | Q = int(quality)
460 | else:
461 | Q = 720
462 | await m.reply(
463 | "» __only 720, 480, 360 allowed__ \n💡 **now streaming video in 720p**"
464 | )
465 | loser = await c.send_message(chat_id, "🔄 **processing stream...**")
466 | else:
467 | await m.reply("**/vstream {link} {720/480/360}**")
468 |
469 | regex = r"^(https?\:\/\/)?(www\.youtube\.com|youtu\.?be)\/.+"
470 | match = re.match(regex, link)
471 | if match:
472 | abhi, livelink = await ytdl(link)
473 | else:
474 | livelink = link
475 | abhi = 1
476 |
477 | if abhi == 0:
478 | await loser.edit(f"❌ yt-dl issues detected\n\n» `{livelink}`")
479 | else:
480 | if chat_id in QUEUE:
481 | pos = add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q)
482 | await loser.delete()
483 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
484 | buttons = stream_markup(user_id)
485 | await m.reply_photo(
486 | photo=f"{IMG_1}",
487 | reply_markup=InlineKeyboardMarkup(buttons),
488 | caption=f"💡 **Track added to queue »** `{pos}`\n\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
489 | )
490 | else:
491 | if Q == 720:
492 | amaze = HighQualityVideo()
493 | elif Q == 480:
494 | amaze = MediumQualityVideo()
495 | elif Q == 360:
496 | amaze = LowQualityVideo()
497 | try:
498 | await loser.edit("🔄 **Joining vc...**")
499 | await call_py.join_group_call(
500 | chat_id,
501 | AudioVideoPiped(
502 | livelink,
503 | HighQualityAudio(),
504 | amaze,
505 | ),
506 | stream_type=StreamType().live_stream,
507 | )
508 | add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q)
509 | await loser.delete()
510 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
511 | buttons = stream_markup(user_id)
512 | await m.reply_photo(
513 | photo=f"{IMG_2}",
514 | reply_markup=InlineKeyboardMarkup(buttons),
515 | caption=f"💡 **[Video Live]({link}) stream started.**\n\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
516 | )
517 | except Exception as ep:
518 | await loser.delete()
519 | await m.reply_text(f"🚫 error: `{ep}`")
520 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------