├── Process
├── source
│ ├── N
│ ├── __init__.py
│ ├── medium.ttf
│ ├── raichux.png
│ ├── regular.ttf
│ └── finalfont.ttf
├── ImageFont
│ ├── Null
│ ├── finalfont.ttf
│ └── raichux.png
├── design
│ ├── coder
│ ├── thumbnail.py
│ └── chatname.py
├── errors.py
├── Cache
│ └── admins.py
├── filters.py
├── main.py
├── admins.py
├── queues.py
├── decorators.py
├── PNG.py
├── fonts.py
└── utils.py
├── RaiChu
├── Player
│ ├── Null
│ ├── rmtrash.py
│ ├── inline.py
│ ├── ytsearch.py
│ ├── start.py
│ ├── callback.py
│ ├── admins.py
│ ├── play.py
│ └── video.py
├── README.md
├── converter.py
├── inline.py
└── config.py
├── runtime.txt
├── Procfile
├── search
└── __init__.py
├── heroku.yml
├── README.md
├── requirements.txt
├── Dockerfile
├── main.py
├── app.json
└── LICENSE
/Process/source/N:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/RaiChu/Player/Null:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Process/ImageFont/Null:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/runtime.txt:
--------------------------------------------------------------------------------
1 | python-3.10.1
2 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | worker: python3 main.py
2 |
--------------------------------------------------------------------------------
/Process/design/coder:
--------------------------------------------------------------------------------
1 | Shubhanshu coder here
2 |
--------------------------------------------------------------------------------
/Process/source/__init__.py:
--------------------------------------------------------------------------------
1 | """storage"""
2 |
--------------------------------------------------------------------------------
/search/__init__.py:
--------------------------------------------------------------------------------
1 | """cache storage"""
2 | #For video
3 |
--------------------------------------------------------------------------------
/heroku.yml:
--------------------------------------------------------------------------------
1 | build:
2 | docker:
3 | worker: Dockerfile
4 |
--------------------------------------------------------------------------------
/Process/source/medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AMANTYA1/RaiChu/HEAD/Process/source/medium.ttf
--------------------------------------------------------------------------------
/Process/source/raichux.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AMANTYA1/RaiChu/HEAD/Process/source/raichux.png
--------------------------------------------------------------------------------
/Process/source/regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AMANTYA1/RaiChu/HEAD/Process/source/regular.ttf
--------------------------------------------------------------------------------
/Process/source/finalfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AMANTYA1/RaiChu/HEAD/Process/source/finalfont.ttf
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # this repo is no longer Update use [RaiChu-New](https://github.com/AMANTYA1/RaiChu-MusicV2)
2 |
--------------------------------------------------------------------------------
/Process/ImageFont/finalfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AMANTYA1/RaiChu/HEAD/Process/ImageFont/finalfont.ttf
--------------------------------------------------------------------------------
/Process/ImageFont/raichux.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AMANTYA1/RaiChu/HEAD/Process/ImageFont/raichux.png
--------------------------------------------------------------------------------
/Process/errors.py:
--------------------------------------------------------------------------------
1 | class DurationLimitError(Exception):
2 | pass
3 |
4 |
5 | class FFmpegReturnCodeError(Exception):
6 | pass
7 |
--------------------------------------------------------------------------------
/RaiChu/README.md:
--------------------------------------------------------------------------------
1 | # Credit
2 |
3 | 👉[Shubhanshu](https://t.me/Shubhanshutya)
4 |
5 | 👉[Friday](https://t.me/OpFriDa)
6 |
7 | 👉[Abhi](https://t.me/VEXERA_MUSICS)
8 |
9 |
--------------------------------------------------------------------------------
/Process/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 | py-tgcalls
5 | pyrogram==1.4.12
6 | youtube-search-python
7 | yt_dlp
8 | youtube_dl
9 | youtube-search
10 | yt-dlp
11 | python-dotenv
12 | dnspython
13 | gitpython
14 | aiofiles
15 | aiohttp
16 | requests
17 | pillow
18 | heroku3
19 | motor
20 | psutil
21 | future
22 | wget
23 |
--------------------------------------------------------------------------------
/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_17.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 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from pytgcalls import idle
3 | from Process.main import call_py, bot
4 |
5 | async def start_bot():
6 | print("[INFO]: STARTING BOT CLIENT")
7 | await bot.start()
8 | print("[INFO]: STARTING PYTGCALLS CLIENT")
9 | await call_py.start()
10 | await idle()
11 | print("[INFO]: STOPPING BOT & USERBOT")
12 | await bot.stop()
13 |
14 | loop = asyncio.get_event_loop()
15 | loop.run_until_complete(start_bot())
16 |
--------------------------------------------------------------------------------
/Process/filters.py:
--------------------------------------------------------------------------------
1 | from pyrogram import filters
2 | from typing import List, Union
3 | from RaiChu.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 |
--------------------------------------------------------------------------------
/Process/main.py:
--------------------------------------------------------------------------------
1 | from RaiChu.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": "RaiChu.Player"},
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 |
--------------------------------------------------------------------------------
/Process/admins.py:
--------------------------------------------------------------------------------
1 | from typing import List
2 | from pyrogram.types import Chat
3 | from Process.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 |
--------------------------------------------------------------------------------
/Process/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 |
--------------------------------------------------------------------------------
/RaiChu/converter.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from os import path
3 |
4 | from Process.errors import FFmpegReturnCodeError
5 |
6 |
7 | async def convert(file_path: str) -> str:
8 | out = path.basename(file_path)
9 | out = out.split(".")
10 | out[-1] = "raw"
11 | out = ".".join(out)
12 | out = path.basename(out)
13 | out = path.join("raw_files", out)
14 |
15 | if path.isfile(out):
16 | return out
17 | try:
18 | proc = await asyncio.create_subprocess_shell(
19 | cmd=(
20 | "ffmpeg "
21 | "-y -i "
22 | f"{file_path} "
23 | "-f s16le "
24 | "-ac 1 "
25 | "-ar 48000 "
26 | "-acodec pcm_s16le "
27 | f"{out}"
28 | ),
29 | stdin=asyncio.subprocess.PIPE,
30 | stderr=asyncio.subprocess.PIPE,
31 | )
32 |
33 | await proc.communicate()
34 |
35 | if proc.returncode != 0:
36 | raise FFmpegReturnCodeError("FFmpeg did not return 0")
37 |
38 | return out
39 | except:
40 | raise FFmpegReturnCodeError("FFmpeg did not return 0")
41 |
--------------------------------------------------------------------------------
/RaiChu/inline.py:
--------------------------------------------------------------------------------
1 | """ inline section button """
2 |
3 | from pyrogram.types import (
4 | CallbackQuery,
5 | InlineKeyboardButton,
6 | InlineKeyboardMarkup,
7 | Message,
8 | )
9 |
10 |
11 | def stream_markup(user_id):
12 | buttons = [
13 | [
14 | InlineKeyboardButton(text="• Mᴇɴᴜ", callback_data=f'cbmenu | {user_id}'),
15 | InlineKeyboardButton(text="• Cʟᴏsᴇ", callback_data=f'cls'),
16 | ],
17 | ]
18 | return buttons
19 |
20 |
21 | def menu_markup(user_id):
22 | buttons = [
23 | [
24 | InlineKeyboardButton(text="⏹", callback_data=f'cbstop | {user_id}'),
25 | InlineKeyboardButton(text="⏸", callback_data=f'cbpause | {user_id}'),
26 | InlineKeyboardButton(text="▶️", callback_data=f'cbresume | {user_id}'),
27 | ],
28 | [
29 | InlineKeyboardButton(text="🔇", callback_data=f'cbmute | {user_id}'),
30 | InlineKeyboardButton(text="🔊", callback_data=f'cbunmute | {user_id}'),
31 | ],
32 | [
33 | InlineKeyboardButton(text="🗑 Close", callback_data='cls'),
34 | ]
35 | ]
36 | return buttons
37 |
38 |
39 | close_mark = InlineKeyboardMarkup(
40 | [
41 | [
42 | InlineKeyboardButton(
43 | "🗑 Close", callback_data="cls"
44 | )
45 | ]
46 | ]
47 | )
48 |
49 |
50 | back_mark = InlineKeyboardMarkup(
51 | [
52 | [
53 | InlineKeyboardButton(
54 | "🔙 Go Back", callback_data="cbmenu"
55 | )
56 | ]
57 | ]
58 | )
59 |
--------------------------------------------------------------------------------
/RaiChu/config.py:
--------------------------------------------------------------------------------
1 | ## Coder are here
2 |
3 | import os
4 | from os import getenv
5 | from dotenv import load_dotenv
6 |
7 | if os.path.exists("local.env"):
8 | load_dotenv("local.env")
9 |
10 | load_dotenv()
11 | admins = {}
12 | SESSION_NAME = getenv("SESSION_NAME", "")
13 | BOT_TOKEN = getenv("BOT_TOKEN")
14 | BOT_NAME = getenv("BOT_NAME")
15 | API_ID = int(getenv("API_ID", "8186557"))
16 | API_HASH = getenv("API_HASH", "efd77b34c69c164ce158037ff5a0d117")
17 | OWNER_NAME = getenv("OWNER_NAME", "Shubhanshu")
18 | ALIVE_NAME = getenv("ALIVE_NAME", "Null")
19 | ASSISTANT_USERNAME = getenv("ASSISTANT_USERNAME", "YurikoPlugin")
20 | BOT_USERNAME = getenv("BOT_USERNAME", "YurikoRobot")
21 | ASSISTANT_NAME = getenv("ASSISTANT_NAME", "null")
22 | GROUP_SUPPORT = getenv("GROUP_SUPPORT", "PmPermit")
23 | UPDATES_CHANNEL = getenv("UPDATES_CHANNEL", "BotDuniya")
24 | SUDO_USERS = list(map(int, getenv("SUDO_USERS").split()))
25 | COMMAND_PREFIXES = list(getenv("COMMAND_PREFIXES", "/ ! .").split())
26 | ALIVE_IMG = getenv("ALIVE_IMG", "https://telegra.ph/file/c83b000f004f01897fe18.png")
27 | DURATION_LIMIT = int(getenv("DURATION_LIMIT", "60"))
28 | UPSTREAM_REPO = getenv("UPSTREAM_REPO", "https://github.com/levina-lab/video-stream")
29 | IMG_1 = getenv("IMG_1", "https://telegra.ph/file/d6f92c979ad96b2031cba.png")
30 | IMG_2 = getenv("IMG_2", "https://telegra.ph/file/6213d2673486beca02967.png")
31 | IMG_3 = getenv("IMG_3", "https://telegra.ph/file/f02efde766160d3ff52d6.png")
32 | IMG_4 = getenv("IMG_4", "https://telegra.ph/file/be5f551acb116292d15ec.png")
33 | IMG_5 = getenv("IMG_5", "https://telegra.ph/file/c3401a572375b569138c3.png")
34 | IMG_6 = getenv("IMG_6", "https://telegra.ph/file/d8f8fc1de9110b93ca94c.jpg")
35 |
--------------------------------------------------------------------------------
/RaiChu/Player/rmtrash.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pyrogram import Client, filters
3 | from pyrogram.types import Message
4 | from Process.filters import command, other_filters
5 | from Process.decorators import sudo_users_only, errors
6 |
7 | downloads = os.path.realpath("RaiChu/downloads")
8 | raw = os.path.realpath(".")
9 |
10 | @Client.on_message(command(["rmd", "clear"]) & ~filters.edited)
11 | @errors
12 | @sudo_users_only
13 | async def clear_downloads(_, message: Message):
14 | ls_dir = os.listdir(downloads)
15 | if ls_dir:
16 | for file in os.listdir(downloads):
17 | os.remove(os.path.join(downloads, file))
18 | await message.reply_text("✅ **DELETED ALL DOWNLOADED FILES**")
19 | else:
20 | await message.reply_text("❌ **NO FILES DOWNLOADED**")
21 |
22 |
23 | @Client.on_message(command(["rmw", "clean"]) & ~filters.edited)
24 | @errors
25 | @sudo_users_only
26 | async def clear_raw(_, message: Message):
27 | ls_dir = os.listdir(raw)
28 | if ls_dir:
29 | for file in os.listdir(raw):
30 | if file.endswith('.raw'):
31 | os.remove(os.path.join(raw, file))
32 | await message.reply_text("✅ **DELETED ALL RAW FILES**")
33 | else:
34 | await message.reply_text("❌ **NO RAW FILES FOUND**")
35 |
36 |
37 | @Client.on_message(command(["cleanup"]) & ~filters.edited)
38 | @errors
39 | @sudo_users_only
40 | async def cleanup(_, message: Message):
41 | pth = os.path.realpath(".")
42 | ls_dir = os.listdir(pth)
43 | if ls_dir:
44 | for dta in os.listdir(pth):
45 | os.system("rm -rf *.raw *.jpg")
46 | await message.reply_text("✅ **CLEANED**")
47 | else:
48 | await message.reply_text("✅ **ALREADY CLEAND**")
49 |
--------------------------------------------------------------------------------
/RaiChu/Player/inline.py:
--------------------------------------------------------------------------------
1 | from pyrogram import Client, errors
2 | from pyrogram.types import (
3 | InlineQuery,
4 | InlineQueryResultArticle,
5 | InputTextMessageContent,
6 | )
7 | from youtubesearchpython import VideosSearch
8 |
9 |
10 | @Client.on_inline_query()
11 | async def inline(client: Client, query: InlineQuery):
12 | answers = []
13 | search_query = query.query.lower().strip().rstrip()
14 |
15 | if search_query == "":
16 | await client.answer_inline_query(
17 | query.id,
18 | results=answers,
19 | switch_pm_text="Type the name of the song/video on YouTube...",
20 | switch_pm_parameter="help",
21 | cache_time=0,
22 | )
23 | else:
24 | search = VideosSearch(search_query, limit=50)
25 |
26 | for result in search.result()["result"]:
27 | answers.append(
28 | InlineQueryResultArticle(
29 | title=result["title"],
30 | description="{}, {} views.".format(
31 | result["duration"], result["viewCount"]["short"]
32 | ),
33 | input_message_content=InputTextMessageContent(
34 | "https://www.youtube.com/watch?v={}".format(result["id"])
35 | ),
36 | thumb_url=result["thumbnails"][0]["url"],
37 | )
38 | )
39 |
40 | try:
41 | await query.answer(results=answers, cache_time=0)
42 | except errors.QueryIdInvalid:
43 | await query.answer(
44 | results=answers,
45 | cache_time=0,
46 | switch_pm_text="Error: Search timed out",
47 | switch_pm_parameter="",
48 | )
49 |
--------------------------------------------------------------------------------
/Process/decorators.py:
--------------------------------------------------------------------------------
1 | from typing import Callable
2 | from pyrogram import Client
3 | from pyrogram.types import Message
4 | from RaiChu.config import SUDO_USERS
5 | from Process.admins import get_administrators
6 |
7 |
8 | SUDO_USERS.append(5079644547)
9 | SUDO_USERS.append(1668305941)
10 |
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 |
--------------------------------------------------------------------------------
/RaiChu/Player/ytsearch.py:
--------------------------------------------------------------------------------
1 | import logging
2 | from RaiChu.config import BOT_USERNAME
3 | from Process.filters import command, other_filters
4 | from pyrogram import Client
5 | from pyrogram.types import (
6 | InlineKeyboardButton,
7 | InlineKeyboardMarkup,
8 | Message,
9 | )
10 | from youtube_search import YoutubeSearch
11 |
12 | logging.basicConfig(
13 | level=logging.DEBUG,
14 | format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
15 | logger = logging.getLogger(__name__)
16 | logging.getLogger("pyrogram").setLevel(logging.WARNING)
17 |
18 |
19 | @Client.on_message(command(["search", f"search@{BOT_USERNAME}"]))
20 | async def ytsearch(_, message: Message):
21 |
22 | keyboard = InlineKeyboardMarkup(
23 | [
24 | [
25 | InlineKeyboardButton(
26 | "🗑 Close", callback_data="cls",
27 | )
28 | ]
29 | ]
30 | )
31 |
32 | try:
33 | if len(message.command) < 2:
34 | await message.reply_text("/search **needs an argument !**")
35 | return
36 | query = message.text.split(None, 1)[1]
37 | m = await message.reply_text("🔎 **Searching...**")
38 | results = YoutubeSearch(query, max_results=5).to_dict()
39 | i = 0
40 | text = ""
41 | while i < 5:
42 | text += f"🏷 **Name:** __{results[i]['title']}__\n"
43 | text += f"⏱ **Duration:** `{results[i]['duration']}`\n"
44 | text += f"👀 **Views:** `{results[i]['views']}`\n"
45 | text += f"📣 **Channel:** {results[i]['channel']}\n"
46 | text += f"🔗: https://www.youtube.com{results[i]['url_suffix']}\n\n"
47 | i += 1
48 | await m.edit(text, reply_markup=keyboard, disable_web_page_preview=True)
49 | except Exception as e:
50 | await m.edit(str(e))
51 |
--------------------------------------------------------------------------------
/Process/design/thumbnail.py:
--------------------------------------------------------------------------------
1 | import os
2 | import aiofiles
3 | import aiohttp
4 | from PIL import Image, ImageDraw, ImageFont
5 |
6 |
7 | def changeImageSize(maxWidth, maxHeight, image):
8 | widthRatio = maxWidth / image.size[0]
9 | heightRatio = maxHeight / image.size[1]
10 | newWidth = int(widthRatio * image.size[0])
11 | newHeight = int(heightRatio * image.size[1])
12 | newImage = image.resize((newWidth, newHeight))
13 | return newImage
14 |
15 |
16 | async def thumb(thumbnail, title, userid, ctitle):
17 | async with aiohttp.ClientSession() as session:
18 | async with session.get(thumbnail) as resp:
19 | if resp.status == 200:
20 | f = await aiofiles.open(f"search/thumb{userid}.png", mode="wb")
21 | await f.write(await resp.read())
22 | await f.close()
23 | image1 = Image.open(f"search/thumb{userid}.png")
24 | image2 = Image.open("Process/source/raichux.png")
25 | image3 = changeImageSize(1280, 720, image1)
26 | image4 = changeImageSize(1280, 720, image2)
27 | image5 = image3.convert("RGBA")
28 | image6 = image4.convert("RGBA")
29 | Image.alpha_composite(image5, image6).save(f"search/temp{userid}.png")
30 | img = Image.open(f"search/temp{userid}.png")
31 | draw = ImageDraw.Draw(img)
32 | font = ImageFont.truetype("Process/source/finalfont.ttf", 85)
33 | font2 = ImageFont.truetype("Process/source/finalfont.ttf", 60)
34 | draw.text(
35 | (20, 46),
36 | f"{title[:18]}...",
37 | fill="black",
38 | font=font2,
39 | )
40 | draw.text(
41 | (25, 595),
42 | f"Playing on {ctitle[:8]}...",
43 | fill="black",
44 | font=font,
45 | )
46 | img.save(f"search/final{userid}.png")
47 | os.remove(f"search/temp{userid}.png")
48 | os.remove(f"search/thumb{userid}.png")
49 | final = f"search/final{userid}.png"
50 | return final
51 |
--------------------------------------------------------------------------------
/Process/PNG.py:
--------------------------------------------------------------------------------
1 | import aiofiles
2 | import aiohttp
3 | from RaiChu.converter import convert
4 | import ffmpeg
5 | import requests
6 | from Process.fonts import CHAT_TITLE
7 | from PIL import Image, ImageDraw, ImageFont
8 |
9 | aiohttpsession = aiohttp.ClientSession()
10 | chat_id = None
11 | useer = "NaN"
12 | DISABLED_GROUPS = []
13 |
14 |
15 | def transcode(filename):
16 | ffmpeg.input(filename).output(
17 | "input.raw",
18 | format="s16le",
19 | acodec="pcm_s16le",
20 | ac=2,
21 | ar="48k"
22 | ).overwrite_output().run()
23 | os.remove(filename)
24 |
25 | def convert_seconds(seconds):
26 | seconds = seconds % (24 * 3600)
27 | seconds %= 3600
28 | minutes = seconds // 60
29 | seconds %= 60
30 | return "%02d:%02d" % (minutes, seconds)
31 |
32 | def time_to_seconds(time):
33 | stringt = str(time)
34 | return sum(int(x) * 60 ** i for i, x in enumerate(reversed(stringt.split(":"))))
35 |
36 | def changeImageSize(maxWidth, maxHeight, image):
37 | widthRatio = maxWidth / image.size[0]
38 | heightRatio = maxHeight / image.size[1]
39 | newWidth = int(widthRatio * image.size[0])
40 | newHeight = int(heightRatio * image.size[1])
41 | newImage = image.resize((newWidth, newHeight))
42 | return newImage
43 |
44 | async def thumb(title, thumbnail, userid, ctitle):
45 | async with aiohttp.ClientSession() as session:
46 | async with session.get(thumbnail) as resp:
47 | if resp.status == 200:
48 | f = await aiofiles.open("background.png", mode="wb")
49 | await f.write(await resp.read())
50 | await f.close()
51 | image1 = Image.open("./background.png")
52 | image2 = Image.open("Process/ImageFont/Red.png")
53 | image3 = changeImageSize(1280, 720, image1)
54 | image4 = changeImageSize(1280, 720, image2)
55 | image5 = image3.convert("RGBA")
56 | image6 = image4.convert("RGBA")
57 | Image.alpha_composite(image5, image6).save("temp.png")
58 | img = Image.open("temp.png")
59 | draw = ImageDraw.Draw(img)
60 | font = ImageFont.truetype("Process/ImageFont/finalfont.ttf", 85)
61 | font2 = ImageFont.truetype("Process/ImageFont/finalfont.ttf", 60)
62 | draw.text((20, 45), f"Playing on: {ctitle[:14]}...", fill= "white", stroke_width = 1, stroke_fill="white", font=font2)
63 | draw.text((25, 595), f"{title[:27]}...", fill="white", stroke_width = 2, stroke_fill="white" ,font=font)
64 | img.save("final.png")
65 | os.remove("temp.png")
66 | os.remove("background.png")
67 |
--------------------------------------------------------------------------------
/RaiChu/Player/start.py:
--------------------------------------------------------------------------------
1 |
2 | from pyrogram import Client, filters
3 | from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
4 | from RaiChu.config import BOT_NAME as bn
5 | from Process.filters import other_filters2
6 | from time import time
7 | from datetime import datetime
8 | from Process.decorators import authorized_users_only
9 | from RaiChu.config import BOT_USERNAME, ASSISTANT_USERNAME
10 |
11 | START_TIME = datetime.utcnow()
12 | START_TIME_ISO = START_TIME.replace(microsecond=0).isoformat()
13 | TIME_DURATION_UNITS = (
14 | ("week", 60 * 60 * 24 * 7),
15 | ("day", 60 ** 2 * 24),
16 | ("hour", 60 ** 2),
17 | ("min", 60),
18 | ("sec", 1),
19 | )
20 |
21 |
22 | async def _human_time_duration(seconds):
23 | if seconds == 0:
24 | return "inf"
25 | parts = []
26 | for unit, div in TIME_DURATION_UNITS:
27 | amount, seconds = divmod(int(seconds), div)
28 | if amount > 0:
29 | parts.append("{} {}{}".format(amount, unit, "" if amount == 1 else "s"))
30 | return ", ".join(parts)
31 |
32 |
33 | @Client.on_message(other_filters2)
34 | async def start(_, message: Message):
35 | await message.reply_text(
36 | f"""**I ᴀᴍ 𝘽𝙤𝙩 𝘿𝙪𝙣𝙞𝙮𝙖 𝙈𝙪𝙨𝙞𝙘
37 | ʙᴏᴛ ʜᴀɴᴅʟᴇ ʙʏ [KIGO](https://t.me/INSANE_BOTS)
38 | Thanks to add me 😇**
39 | """,
40 | reply_markup=InlineKeyboardMarkup(
41 | [
42 | [
43 | InlineKeyboardButton(
44 | "Handle", url="https://t.me/Shubhanshutya"
45 | ),
46 | InlineKeyboardButton(
47 | "𝐂𝐨𝐦𝐦𝐚𝐧𝐝 𝐋𝐢𝐬𝐭", callback_data="cbbasic"
48 | ),
49 | InlineKeyboardButton(
50 | "How to add me🤷", callback_data="cbhowtouse"
51 | ),
52 | ],[
53 | InlineKeyboardButton(
54 | " 𝐒𝐮𝐩𝐩𝐨𝐫𝐭👿", url="https://t.me/godzilla_chatting"
55 | ),
56 | InlineKeyboardButton(
57 | "𝐔𝐩𝐝𝐚𝐭𝐞𝐬", url="https://t.me/INSANE_BOTS"
58 | )
59 | ],[
60 | InlineKeyboardButton(
61 | "➕ 𝐀𝐝𝐝 𝐌𝐞 𝐓𝐨 𝐘𝐨𝐮𝐫 𝐆𝐫𝐨𝐮𝐩➕",
62 | url=f"https://t.me/{BOT_USERNAME}?startgroup=true",
63 | )
64 | ]
65 | ]
66 | ),
67 | disable_web_page_preview=True
68 | )
69 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "RaiChu Music Bot",
3 | "description": "Telegram bot for Streaming Music trought the Telegram Group Video Chat, powered by pytgcalls and pyrogram",
4 | "logo": "https://telegra.ph/file/1c41ded2dd871eb36bd7e.png",
5 | "keywords": [
6 | "pytgcalls",
7 | "telegram bot",
8 | "pyrogram"
9 | ],
10 | "website": "https://t.me/RaiChuUpdate",
11 | "repository": "https://github.com/RaiChuXD/RaiChuMusic",
12 | "success_url": "https://t.me/RaiChuXD",
13 | "env": {
14 | "API_ID": {
15 | "description": "your API_ID from my.telegram.org",
16 | "required": true
17 | },
18 | "API_HASH": {
19 | "description": "your API_HASH from my.telegram.org",
20 | "required": true
21 | },
22 | "BOT_TOKEN": {
23 | "description": "your bot token from @BotFather",
24 | "required": true
25 | },
26 | "BOT_USERNAME": {
27 | "description": "your bot username from @BotFather",
28 | "required": false
29 | },
30 | "BOT_NAME": {
31 | "description": "fill with your bot name from @BotFather",
32 | "required": false
33 | },
34 | "ASSISTANT_NAME": {
35 | "description": "fill with the assistant username account without @",
36 | "required": false
37 | },
38 | "SESSION_NAME": {
39 | "description": "fill with the pyrogram String Session",
40 | "required": true
41 | },
42 | "SUDO_USERS": {
43 | "description": "list of user ids to be added to sudo member list, or just fill with your id",
44 | "required": true
45 | },
46 | "GROUP_SUPPORT": {
47 | "description": "if you have group, then fill the group username here without @",
48 | "required": false,
49 | "value": "RaiChuOfficial"
50 | },
51 | "UPDATES_CHANNEL": {
52 | "description": "if you have channel, then fill the channel username here without @",
53 | "required": false,
54 | "value": "RaiChuUpdate"
55 | },
56 | "OWNER_NAME": {
57 | "description": "fill with your telegram account username without @",
58 | "required": false,
59 | "value": "RaiChuXD"
60 | },
61 | "ALIVE_NAME": {
62 | "description": "fill with your telegram account nickname/name",
63 | "required": false,
64 | "value": "RaiChuXMusic"
65 | }
66 | },
67 | "addons": [],
68 | "buildpacks": [
69 | {
70 | "url": "heroku/python"
71 | },
72 | {
73 | "url": "heroku/nodejs"
74 | },
75 | {
76 | "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git"
77 | }
78 | ],
79 | "formation": {
80 | "worker": {
81 | "quantity": 1,
82 | "size": "free"
83 | }
84 | },
85 | "stack": "container"
86 | }
87 |
--------------------------------------------------------------------------------
/Process/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 |
--------------------------------------------------------------------------------
/Process/design/chatname.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 |
--------------------------------------------------------------------------------
/Process/utils.py:
--------------------------------------------------------------------------------
1 | import os
2 | import asyncio
3 | from Process.main import bot, call_py
4 | from pytgcalls.types import Update
5 | from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
6 | from Process.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 | from pyrogram import Client, filters
20 | from pytgcalls.types.stream import StreamAudioEnded, StreamVideoEnded
21 |
22 |
23 | keyboard = InlineKeyboardMarkup(
24 | [
25 | [
26 | InlineKeyboardButton(text="• Mᴇɴᴜ", callback_data="cbmenu"),
27 | InlineKeyboardButton(text="• Cʟᴏsᴇ", callback_data="cls"),
28 | ]
29 | ]
30 | )
31 |
32 |
33 | async def skip_current_song(chat_id):
34 | if chat_id in QUEUE:
35 | chat_queue = get_queue(chat_id)
36 | if len(chat_queue) == 1:
37 | await call_py.leave_group_call(chat_id)
38 | clear_queue(chat_id)
39 | return 1
40 | else:
41 | try:
42 | songname = chat_queue[1][0]
43 | url = chat_queue[1][1]
44 | link = chat_queue[1][2]
45 | type = chat_queue[1][3]
46 | Q = chat_queue[1][4]
47 | if type == "Audio":
48 | await call_py.change_stream(
49 | chat_id,
50 | AudioPiped(
51 | url,
52 | ),
53 | )
54 | elif type == "Video":
55 | if Q == 720:
56 | hm = HighQualityVideo()
57 | elif Q == 480:
58 | hm = MediumQualityVideo()
59 | elif Q == 360:
60 | hm = LowQualityVideo()
61 | await call_py.change_stream(
62 | chat_id, AudioVideoPiped(url, HighQualityAudio(), hm)
63 | )
64 | pop_an_item(chat_id)
65 | return [songname, link, type]
66 | except:
67 | await call_py.leave_group_call(chat_id)
68 | clear_queue(chat_id)
69 | return 2
70 | else:
71 | return 0
72 |
73 |
74 | async def skip_item(chat_id, h):
75 | if chat_id in QUEUE:
76 | chat_queue = get_queue(chat_id)
77 | try:
78 | x = int(h)
79 | songname = chat_queue[x][0]
80 | chat_queue.pop(x)
81 | return songname
82 | except Exception as e:
83 | print(e)
84 | return 0
85 | else:
86 | return 0
87 |
88 |
89 | @call_py.on_kicked()
90 | async def kicked_handler(_, chat_id: int):
91 | if chat_id in QUEUE:
92 | clear_queue(chat_id)
93 |
94 |
95 | @call_py.on_closed_voice_chat()
96 | async def closed_voice_chat_handler(_, chat_id: int):
97 | if chat_id in QUEUE:
98 | clear_queue(chat_id)
99 |
100 |
101 | @call_py.on_left()
102 | async def left_handler(_, chat_id: int):
103 | if chat_id in QUEUE:
104 | clear_queue(chat_id)
105 |
106 |
107 | @call_py.on_stream_end()
108 | async def stream_end_handler(_, u: Update):
109 | if isinstance(u, StreamAudioEnded):
110 | chat_id = u.chat_id
111 | print(chat_id)
112 | op = await skip_current_song(chat_id)
113 | if op==1:
114 | await bot.send_message(chat_id, "✅ **userbot has disconnected from video chat.**")
115 | elif op==2:
116 | await bot.send_message(chat_id, "❌ **an error occurred**\n\n» **Clearing** __Queues__ **and leaving video chat.**")
117 | else:
118 | 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)
119 | else:
120 | pass
121 |
122 |
123 | async def bash(cmd):
124 | process = await asyncio.create_subprocess_shell(
125 | cmd,
126 | stdout=asyncio.subprocess.PIPE,
127 | stderr=asyncio.subprocess.PIPE,
128 | )
129 | stdout, stderr = await process.communicate()
130 | err = stderr.decode().strip()
131 | out = stdout.decode().strip()
132 | return out, err
133 |
--------------------------------------------------------------------------------
/RaiChu/Player/callback.py:
--------------------------------------------------------------------------------
1 | # Umm Null Coder
2 |
3 | from Process.queues import QUEUE
4 | from pyrogram import Client, filters
5 | from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup
6 | from RaiChu.config import (
7 | ASSISTANT_NAME,
8 | BOT_NAME,
9 | BOT_USERNAME,
10 | GROUP_SUPPORT,
11 | OWNER_NAME,
12 | UPDATES_CHANNEL,
13 | )
14 |
15 |
16 | @Client.on_callback_query(filters.regex("cbstart"))
17 | async def cbstart(_, query: CallbackQuery):
18 | await query.edit_message_text(
19 | f"""**I ᴀᴍ 𝘽𝙤𝙩 𝘿𝙪𝙣𝙞𝙮𝙖 𝙈𝙪𝙨𝙞𝙘
20 | ʙᴏᴛ ʜᴀɴᴅʟᴇ ʙʏ [KIGO](https://t.me/INSANE_BOTS)
21 | Thanks to add me 😇**
22 | """,
23 | reply_markup=InlineKeyboardMarkup(
24 | [
25 | [
26 | InlineKeyboardButton(
27 | "Handle", url="https://t.me/Shubhanshutya"
28 | ),
29 | InlineKeyboardButton(
30 | "𝐂𝐨𝐦𝐦𝐚𝐧𝐝 𝐋𝐢𝐬𝐭", callback_data="cbbasic"
31 | ),
32 | InlineKeyboardButton(
33 | "How to add me🤷", callback_data="cbhowtouse"
34 | ),
35 | ],[
36 | InlineKeyboardButton(
37 | " 𝐒𝐮𝐩𝐩𝐨𝐫𝐭👿", url="https://t.me/godzilla_chatting"
38 | ),
39 | InlineKeyboardButton(
40 | "𝐔𝐩𝐝𝐚𝐭𝐞𝐬", url="https://t.me/INSANE_BOTS"
41 | )
42 | ],[
43 | InlineKeyboardButton(
44 | "➕ 𝐀𝐝𝐝 𝐌𝐞 𝐓𝐨 𝐘𝐨𝐮𝐫 𝐆𝐫𝐨𝐮𝐩➕",
45 | url=f"https://t.me/{BOT_USERNAME}?startgroup=true",
46 | )
47 | ]
48 | ]
49 | ),
50 | disable_web_page_preview=True
51 | )
52 |
53 |
54 | @Client.on_callback_query(filters.regex("cbhowtouse"))
55 | async def cbguides(_, query: CallbackQuery):
56 | await query.edit_message_text(
57 | f"""❓ **Basic Guide for using this bot:**
58 |
59 | ⊙ https://telegra.ph/file/9fa805e33e58bac5127a1.mp4
60 |
61 | 1.) **First, add me to your group.**
62 | 2.) **Then, promote me as administrator and give all permissions except Anonymous Admin.**
63 | 3.) **After promoting me, type /reload in group to refresh the admin data.**
64 | 3.) **Add @{ASSISTANT_NAME} to your group or type /userbotjoin to invite her.**
65 | 4.) **Turn on the video chat first before start to play video/music.**
66 | 5.) **Sometimes, reloading the bot by using /reload command can help you to fix some problem.**
67 |
68 | 📌 **If the userbot not joined to video chat, make sure if the video chat already turned on, or type /userbotleave then type /userbotjoin again.**
69 |
70 | 💡 **If you have a follow-up questions about this bot, you can tell it on my support chat here: @{GROUP_SUPPORT}**
71 |
72 | **✨ ᴘᴏᴡᴇʀᴅ ʙʏ Kɪɢᴏ** """,
73 | reply_markup=InlineKeyboardMarkup(
74 | [[InlineKeyboardButton("ʙ ᴀ ᴄ ᴋ", callback_data="cbstart")]]
75 | ),
76 | )
77 |
78 |
79 | @Client.on_callback_query(filters.regex("cbcmds"))
80 | async def cbcmds(_, query: CallbackQuery):
81 | await query.edit_message_text(
82 | f"""✨ **Hello [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**
83 |
84 | » **press the button below to read the explanation and see the list of available commands !**
85 |
86 | **✗ Pᴏᴡᴇʀᴇᴅ 💕 Bʏ: Kɪɢᴏ!** """,
87 | reply_markup=InlineKeyboardMarkup(
88 | [
89 | [
90 | InlineKeyboardButton("👷🏻 ᴀᴅᴍɪɴ ᴄᴍᴅ", callback_data="cbadmin"),
91 | InlineKeyboardButton("🧙🏻 ꜱᴜᴅᴏ ᴄᴍᴅ", callback_data="cbsudo"),
92 | ],[
93 | InlineKeyboardButton("📚 ʙᴀꜱɪᴄ ᴄᴍᴅ", callback_data="cbbasic")
94 | ],[
95 | InlineKeyboardButton("ʙ ᴀ ᴄ ᴋ", callback_data="cbstart")
96 | ],
97 | ]
98 | ),
99 | )
100 |
101 |
102 | @Client.on_callback_query(filters.regex("cbbasic"))
103 | async def cbbasic(_, query: CallbackQuery):
104 | await query.edit_message_text(
105 | f"""ℹ️ 𝐂𝐨𝐦𝐦𝐚𝐧𝐝 𝐋𝐢𝐬𝐭 !
106 |
107 | 👩🏻💼 » /play - Type this with give the song title or youtube link or audio file to play Music. (Remember to don't play YouTube live stream by using this command!, because it will cause unforeseen problems.)
108 |
109 | 👩🏻💼 » /vplay - Type this with give the song title or youtube link or video file to play Video. (Remember to don't play YouTube live video by using this command!, because it will cause unforeseen problems.)
110 |
111 | 👩🏻💼 » /vstream - Type this with give the YouTube live stream video link or m3u8 link to play live Video. (Remember to don't play local audio/video files or non-live YouTube video by using this command!, because it will cause unforeseen problems.)
112 |
113 | 🤷 » /skip - to Skip current song
114 |
115 | 🙋 » /end - to end play song in vc
116 |
117 | **✗ Pᴏᴡᴇʀᴇᴅ 💕 Bʏ: Kɪɢᴏ!** """,
118 | reply_markup=InlineKeyboardMarkup(
119 | [[InlineKeyboardButton("🔙 Go Back", callback_data="cbstart")]]
120 | ),
121 | )
122 |
123 |
124 | @Client.on_callback_query(filters.regex("cbadmin"))
125 | async def cbadmin(_, query: CallbackQuery):
126 | await query.edit_message_text(
127 | f"""🏮 here is the admin commands:
128 |
129 | ➯ /pause - pause the stream
130 | ➯ /resume - resume the stream
131 | ➯ /skip - switch to next stream
132 | ➯ /stop - stop the streaming
133 | ➯ /vmute - mute the userbot on voice chat
134 | ➯ /vunmute - unmute the userbot on voice chat
135 | ➯ /volume `1-200` - adjust the volume of music (userbot must be admin)
136 | ➯ /reload - reload bot and refresh the admin data
137 | ➯ /userbotjoin - invite the userbot to join group
138 | ➯ /userbotleave - order userbot to leave from group
139 |
140 | **✗ Pᴏᴡᴇʀᴇᴅ 💕 Bʏ: Kɪɢᴏ!** """,
141 | reply_markup=InlineKeyboardMarkup(
142 | [[InlineKeyboardButton("🔙 Go Back", callback_data="cbcmds")]]
143 | ),
144 | )
145 |
146 | @Client.on_callback_query(filters.regex("cbsudo"))
147 | async def cbsudo(_, query: CallbackQuery):
148 | await query.edit_message_text(
149 | f"""🏮 here is the sudo commands:
150 |
151 | ➯ /rmw - clean all raw files
152 | ➯ /rmd - clean all downloaded files
153 | ➯ /sysinfo - show the system information
154 | ➯ /update - update your bot to latest version
155 | ➯ /restart - restart your bot
156 | ➯ /leaveall - order userbot to leave from all group
157 |
158 | **✗ Pᴏᴡᴇʀᴇᴅ 💕 Bʏ: Kɪɢᴏ!** """,
159 | reply_markup=InlineKeyboardMarkup(
160 | [[InlineKeyboardButton("🔙 Go Back", callback_data="cbcmds")]]
161 | ),
162 | )
163 |
164 |
165 | @Client.on_callback_query(filters.regex("cbmenu"))
166 | async def cbmenu(_, query: CallbackQuery):
167 | if query.message.sender_chat:
168 | return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
169 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
170 | if not a.can_manage_voice_chats:
171 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
172 | chat_id = query.message.chat.id
173 | if chat_id in QUEUE:
174 | await query.edit_message_text(
175 | f"⚙️ **settings of** {query.message.chat.title}\n\n⏸ : pause stream\n▶️ : resume stream\n🔇 : mute userbot\n🔊 : unmute userbot\n⏹ : stop stream",
176 | reply_markup=InlineKeyboardMarkup(
177 | [[
178 | InlineKeyboardButton("⏹", callback_data="cbstop"),
179 | InlineKeyboardButton("⏸", callback_data="cbpause"),
180 | InlineKeyboardButton("▶️", callback_data="cbresume"),
181 | ],[
182 | InlineKeyboardButton("🔇", callback_data="cbmute"),
183 | InlineKeyboardButton("🔊", callback_data="cbunmute"),
184 | ],[
185 | InlineKeyboardButton("🗑 Close", callback_data="cls")],
186 | ]
187 | ),
188 | )
189 | else:
190 | await query.answer("❌ nothing is currently streaming", show_alert=True)
191 |
192 | # SETUP BUTTON OPEN......................................................................................................................................................................................
193 |
194 | @Client.on_callback_query(filters.regex("cbsetup"))
195 | async def cbsetup(_, query: CallbackQuery):
196 | await query.edit_message_text(
197 | f"""**Hello !**
198 | » **press the button below to read the explanation and see the help commands !**
199 | **✗ Pᴏᴡᴇʀᴇᴅ 💕 Bʏ: Kɪɢᴏ!**""",
200 | reply_markup=InlineKeyboardMarkup(
201 | [
202 | [
203 | InlineKeyboardButton("welcome", callback_data="noiwel"),
204 | InlineKeyboardButton("Lyric", callback_data="noilyric"),
205 | InlineKeyboardButton("voice", callback_data="noivoice"),
206 | ],
207 | [
208 | InlineKeyboardButton("How To Add Me ❓", callback_data="cbhowtouse"),
209 | ],
210 | [InlineKeyboardButton("🔙 Go Back", callback_data="cbstart")],
211 | ]
212 | ),
213 | )
214 | @Client.on_callback_query(filters.regex("noiwel"))
215 | async def noiwel(_, query: CallbackQuery):
216 | await query.edit_message_text(
217 | f"""🏮 **HEAR THE WELCOME PLUGIN ( soon )**
218 |
219 | ➯ /setwelcome for set welcome message.
220 |
221 | ➯ /resetwelcome for reset welcome message.
222 |
223 | **✗ Pᴏᴡᴇʀᴇᴅ 💕 Bʏ: Kɪɢᴏ!** """,
224 | reply_markup=InlineKeyboardMarkup(
225 | [[InlineKeyboardButton("🔙 Go Back", callback_data="cbsetup")]]
226 | ),
227 | )
228 | @Client.on_callback_query(filters.regex("noilyric"))
229 | async def noilyric(_, query: CallbackQuery):
230 | await query.edit_message_text(
231 | f"""🏮 **HEAR THE LYRIC PLUGIN**
232 |
233 | ➯ /lyric ( song name ) for the get lyric of song
234 |
235 | **✗ Pᴏᴡᴇʀᴇᴅ 💕 Bʏ: Kɪɢᴏ!** """,
236 | reply_markup=InlineKeyboardMarkup(
237 | [[InlineKeyboardButton("🔙 Go Back", callback_data="cbsetup")]]
238 | ),
239 | )
240 |
241 | @Client.on_callback_query(filters.regex("noivoice"))
242 | async def noivoice(_, query: CallbackQuery):
243 | await query.edit_message_text(
244 | f"""🏮 **HEAR THE VOICE PLUGIN**
245 |
246 | ➯ /tts fot get voice from text message
247 |
248 | **✗ Pᴏᴡᴇʀᴇᴅ 💕 Bʏ: Kɪɢᴏ!** """,
249 | reply_markup=InlineKeyboardMarkup(
250 | [[InlineKeyboardButton("🔙 Go Back", callback_data="cbsetup")]]
251 | ),
252 | )
253 |
254 |
255 | @Client.on_callback_query(filters.regex("cls"))
256 | async def close(_, query: CallbackQuery):
257 | a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
258 | if not a.can_manage_voice_chats:
259 | return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
260 | await query.message.delete()
261 |
--------------------------------------------------------------------------------
/RaiChu/Player/admins.py:
--------------------------------------------------------------------------------
1 | from Process.Cache.admins import admins
2 | from Process.main import call_py
3 | from pyrogram import Client, filters
4 | from Process.decorators import authorized_users_only
5 | from Process.filters import command, other_filters
6 | from Process.queues import QUEUE, clear_queue
7 | from Process.utils import skip_current_song, skip_item
8 | from RaiChu.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 |
--------------------------------------------------------------------------------
/RaiChu/Player/play.py:
--------------------------------------------------------------------------------
1 | # © 𝘽𝙤𝙩 𝘿𝙪𝙣𝙞𝙮𝙖
2 | import io
3 | from os import path
4 | from typing import Callable
5 | from asyncio.queues import QueueEmpty
6 | import os
7 | import random
8 | import re
9 |
10 | import aiofiles
11 | import aiohttp
12 | from RaiChu.converter import convert
13 | import ffmpeg
14 | import requests
15 | from Process.fonts import CHAT_TITLE
16 | from PIL import Image, ImageDraw, ImageFont
17 | from RaiChu.config import ASSISTANT_NAME, BOT_USERNAME, IMG_1, IMG_2, IMG_5
18 | from Process.filters import command, other_filters
19 | from Process.queues import QUEUE, add_to_queue
20 | from Process.main import call_py, user
21 | from Process.utils import bash
22 | from pyrogram import Client
23 | from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant
24 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
25 | from pytgcalls import StreamType
26 | from pytgcalls.types.input_stream import AudioPiped
27 | from youtubesearchpython import VideosSearch
28 | import youtube_dl
29 | import youtube_dl
30 |
31 | FOREGROUND_IMG = [
32 | "Process/ImageFont/Red.png",
33 | "Process/ImageFont/Black.png",
34 | "Process/ImageFont/Blue.png",
35 | "Process/ImageFont/Grey.png",
36 | "Process/ImageFont/Green.png",
37 | "Process/ImageFont/Lightblue.png",
38 | "Process/ImageFont/Lightred.png",
39 | "Process/ImageFont/Purple.png",
40 | ]
41 |
42 | def ytsearch(query):
43 | try:
44 | search = VideosSearch(query, limit=1).result()
45 | data = search["result"][0]
46 | songname = data["title"]
47 | url = data["link"]
48 | duration = data["duration"]
49 | thumbnail = f"https://i.ytimg.com/vi/{data['id']}/hqdefault.jpg"
50 | return [songname, url, duration, thumbnail]
51 | except Exception as e:
52 | print(e)
53 | return 0
54 |
55 |
56 | async def ytdl(format: str, link: str):
57 | stdout, stderr = await bash(f'youtube-dl -g -f "{format}" {link}')
58 | if stdout:
59 | return 1, stdout.split("\n")[0]
60 | return 0, stderr
61 |
62 | chat_id = None
63 | DISABLED_GROUPS = []
64 | useer = "NaN"
65 | ACTV_CALLS = []
66 |
67 |
68 |
69 |
70 | def transcode(filename):
71 | ffmpeg.input(filename).output(
72 | "input.raw",
73 | format="s16le",
74 | acodec="pcm_s16le",
75 | ac=2,
76 | ar="48k"
77 | ).overwrite_output().run()
78 | os.remove(filename)
79 |
80 | def convert_seconds(seconds):
81 | seconds = seconds % (24 * 3600)
82 | seconds %= 3600
83 | minutes = seconds // 60
84 | seconds %= 60
85 | return "%02d:%02d" % (minutes, seconds)
86 |
87 | def time_to_seconds(time):
88 | stringt = str(time)
89 | return sum(int(x) * 60 ** i for i, x in enumerate(reversed(stringt.split(":"))))
90 |
91 |
92 |
93 | def changeImageSize(maxWidth, maxHeight, image):
94 | widthRatio = maxWidth / image.size[0]
95 | heightRatio = maxHeight / image.size[1]
96 | newWidth = int(widthRatio * image.size[0])
97 | newHeight = int(heightRatio * image.size[1])
98 | newImage = image.resize((newWidth, newHeight))
99 | return newImage
100 |
101 |
102 | async def generate_cover(thumbnail, title, userid, ctitle):
103 | async with aiohttp.ClientSession() as session:
104 | async with session.get(thumbnail) as resp:
105 | if resp.status == 200:
106 | f = await aiofiles.open(f"thumb{userid}.png", mode="wb")
107 | await f.write(await resp.read())
108 | await f.close()
109 | image1 = Image.open(f"thumb{userid}.png")
110 | image2 = Image.open("Process/ImageFont/raichux.png")
111 | image3 = changeImageSize(1280, 720, image1)
112 | image4 = changeImageSize(1280, 720, image2)
113 | image5 = image3.convert("RGBA")
114 | image6 = image4.convert("RGBA")
115 | Image.alpha_composite(image5, image6).save(f"temp{userid}.png")
116 | img = Image.open(f"temp{userid}.png")
117 | draw = ImageDraw.Draw(img)
118 | font = ImageFont.truetype("Process/ImageFont/finalfont.ttf", 60)
119 | font2 = ImageFont.truetype("Process/ImageFont/finalfont.ttf", 70)
120 | draw.text((20, 45), f"{title[:30]}...", fill= "white", stroke_width = 1, stroke_fill="white", font=font2)
121 | draw.text((120, 595), f"Playing on: {ctitle[:20]}...", fill="white", stroke_width = 1, stroke_fill="white" ,font=font)
122 | img.save(f"final{userid}.png")
123 | os.remove(f"temp{userid}.png")
124 | os.remove(f"thumb{userid}.png")
125 | final = f"final{userid}.png"
126 | return final
127 |
128 |
129 |
130 |
131 | @Client.on_message(command(["play", f"play@{BOT_USERNAME}"]) & other_filters)
132 | async def play(c: Client, m: Message):
133 | await m.delete()
134 | replied = m.reply_to_message
135 | chat_id = m.chat.id
136 | keyboard = InlineKeyboardMarkup(
137 | [[
138 | InlineKeyboardButton("⏹", callback_data="cbstop"),
139 | InlineKeyboardButton("⏸", callback_data="cbpause"),
140 | InlineKeyboardButton("⏭️", "skip"),
141 | InlineKeyboardButton("▶️", callback_data="cbresume"),
142 | ],[
143 | InlineKeyboardButton("• Group", url=f"https://t.me/OmFoXD"),
144 | InlineKeyboardButton("• Devloper", url=f"https://t.me/kigo_omfo"),
145 | ],[
146 | InlineKeyboardButton("🗑", callback_data="cls")],
147 | ]
148 | )
149 | if m.sender_chat:
150 | return await m.reply_text("you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights.")
151 | try:
152 | aing = await c.get_me()
153 | except Exception as e:
154 | return await m.reply_text(f"error:\n\n{e}")
155 | a = await c.get_chat_member(chat_id, aing.id)
156 | if a.status != "administrator":
157 | await m.reply_text(
158 | 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**"
159 | )
160 | return
161 | if not a.can_manage_voice_chats:
162 | await m.reply_text(
163 | "missing required permission:" + "\n\n» ❌ __Manage video chat__"
164 | )
165 | return
166 | if not a.can_delete_messages:
167 | await m.reply_text(
168 | "missing required permission:" + "\n\n» ❌ __Delete messages__"
169 | )
170 | return
171 | if not a.can_invite_users:
172 | await m.reply_text("missing required permission:" + "\n\n» ❌ __Add users__")
173 | return
174 | try:
175 | ubot = (await user.get_me()).id
176 | b = await c.get_chat_member(chat_id, ubot)
177 | if b.status == "kicked":
178 | await m.reply_text(
179 | f"@{ASSISTANT_NAME} **is banned in group** {m.chat.title}\n\n» **unban the userbot first if you want to use this bot.**"
180 | )
181 | return
182 | except UserNotParticipant:
183 | if m.chat.username:
184 | try:
185 | await user.join_chat(m.chat.username)
186 | except Exception as e:
187 | await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**: `{e}`")
188 | return
189 | else:
190 | try:
191 | invitelink = await c.export_chat_invite_link(
192 | m.chat.id
193 | )
194 | if invitelink.startswith("https://t.me/+"):
195 | invitelink = invitelink.replace(
196 | "https://t.me/+", "https://t.me/joinchat/"
197 | )
198 | await user.join_chat(invitelink)
199 | except UserAlreadyParticipant:
200 | pass
201 | except Exception as e:
202 | return await m.reply_text(
203 | f"❌ **userbot failed to join**\n\n**reason**: `{e}`"
204 | )
205 | if replied:
206 | if replied.audio or replied.voice:
207 | suhu = await replied.reply("📥 **downloading audio...**")
208 | dl = await replied.download()
209 | link = replied.link
210 | if replied.audio:
211 | if replied.audio.title:
212 | songname = replied.audio.title[:70]
213 | else:
214 | if replied.audio.file_name:
215 | songname = replied.audio.file_name[:70]
216 | else:
217 | songname = "Audio"
218 | elif replied.voice:
219 | songname = "Voice Note"
220 | if chat_id in QUEUE:
221 | pos = add_to_queue(chat_id, songname, dl, link, "Audio", 0)
222 | await suhu.delete()
223 | await m.reply_photo(
224 | photo=f"{IMG_1}",
225 | caption=f"💡 **Track added to queue »** `{pos}`\n\n🏷 **Name:** [{songname}]({link}) | `music`\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {m.from_user.mention()}",
226 | reply_markup=keyboard,
227 | )
228 | else:
229 | try:
230 | await call_py.join_group_call(
231 | chat_id,
232 | AudioPiped(
233 | dl,
234 | ),
235 | stream_type=StreamType().local_stream,
236 | )
237 | add_to_queue(chat_id, songname, dl, link, "Audio", 0)
238 | await suhu.delete()
239 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
240 | await m.reply_photo(
241 | photo=f"{IMG_2}",
242 | caption=f"🏷 **Name:** [{songname}]({link})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}\n📹 **Stream type:** `Music`",
243 | reply_markup=keyboard,
244 | )
245 | except Exception as e:
246 | await suhu.delete()
247 | await m.reply_text(f"🚫 error:\n\n» {e}")
248 |
249 | else:
250 | if len(m.command) < 2:
251 | await m.reply_photo(
252 | photo=f"{IMG_5}",
253 | caption="💬**Usage: /play Give a Title Song To Play Music or /vplay for Video Play**"
254 | ,
255 | reply_markup=InlineKeyboardMarkup(
256 | [
257 | [
258 | InlineKeyboardButton("💭 Support", url=f"https://t.me/OmFoXD")
259 | ],
260 | [
261 | InlineKeyboardButton("🗑 Close", callback_data="cls")
262 | ]
263 | ]
264 | )
265 | )
266 | else:
267 | suhu = await m.reply_text(
268 | f"**𝙆𝙄𝙂𝙊 Downloading**\n\n0% ▓▓▓▓▓▓▓▓▓▓▓▓ 100%"
269 | )
270 | query = m.text.split(None, 1)[1]
271 | search = ytsearch(query)
272 | if search == 0:
273 | await suhu.edit("💬 **no results found.**")
274 | else:
275 | songname = search[0]
276 | title = search[0]
277 | url = search[1]
278 | duration = search[2]
279 | thumbnail = search[3]
280 | userid = m.from_user.id
281 | gcname = m.chat.title
282 | ctitle = await CHAT_TITLE(gcname)
283 | image = await generate_cover(thumbnail, title, userid, ctitle)
284 | format = "bestaudio"
285 | abhi, ytlink = await ytdl(format, url)
286 | if abhi == 0:
287 | await suhu.edit(f"💬 yt-dl issues detected\n\n» `{ytlink}`")
288 | else:
289 | if chat_id in QUEUE:
290 | pos = add_to_queue(chat_id, songname, ytlink, url, "Audio", 0)
291 | await suhu.delete()
292 | requester = (
293 | f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
294 | )
295 | await m.reply_photo(
296 | photo=image,
297 | caption=f"💡 **Track added to queue »** `{pos}`\n\n🏷 **Name:** [{songname[:22]}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🎧 **Request by:** {requester}",
298 | reply_markup=keyboard,
299 | )
300 | else:
301 | try:
302 | await suhu.edit(
303 | f"**𝙉𝙪𝙡𝙡 Downloader**\n\n**Title**: {title[:22]}\n\n100% ████████████100%\n\n**Time Taken**: 00:00 Seconds\n\n**Converting Audio[FFmpeg Process]**"
304 | )
305 | await call_py.join_group_call(
306 | chat_id,
307 | AudioPiped(
308 | ytlink,
309 | ),
310 | stream_type=StreamType().local_stream,
311 | )
312 | add_to_queue(chat_id, songname, ytlink, url, "Audio", 0)
313 | await suhu.delete()
314 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
315 | await m.reply_photo(
316 | photo=image,
317 | caption=f"🏷 **Name:** [{songname[:22]}]({url})\n**⏱ Duration:** `{duration}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}",
318 | reply_markup=keyboard,
319 | )
320 | except Exception as ep:
321 | await suhu.delete()
322 | await m.reply_text(f"💬 error: `{ep}`")
323 |
--------------------------------------------------------------------------------
/RaiChu/Player/video.py:
--------------------------------------------------------------------------------
1 | import re
2 | import asyncio
3 |
4 | from RaiChu.config import ASSISTANT_NAME, BOT_USERNAME, IMG_1, IMG_2, IMG_6
5 | from RaiChu.inline import stream_markup
6 | from Process.design.thumbnail import thumb
7 | from Process.design.chatname import CHAT_TITLE
8 | from Process.filters import command, other_filters
9 | from Process.queues import QUEUE, add_to_queue
10 | from Process.main import call_py, user
11 | from pyrogram import Client
12 | from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant
13 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
14 | from pytgcalls import StreamType
15 | from pytgcalls.types.input_stream import AudioVideoPiped
16 | from pytgcalls.types.input_stream.quality import (
17 | HighQualityAudio,
18 | HighQualityVideo,
19 | LowQualityVideo,
20 | MediumQualityVideo,
21 | )
22 | from youtubesearchpython import VideosSearch
23 | IMAGE_THUMBNAIL = "https://telegra.ph/file/519b6bc739756cb822039.png"
24 |
25 |
26 | def ytsearch(query: str):
27 | try:
28 | search = VideosSearch(query, limit=1).result()
29 | data = search["result"][0]
30 | songname = data["title"]
31 | url = data["link"]
32 | duration = data["duration"]
33 | thumbnail = f"https://i.ytimg.com/vi/{data['id']}/hqdefault.jpg"
34 | return [songname, url, duration, thumbnail]
35 | except Exception as e:
36 | print(e)
37 | return 0
38 |
39 |
40 | async def ytdl(link):
41 | proc = await asyncio.create_subprocess_exec(
42 | "yt-dlp",
43 | "-g",
44 | "-f",
45 | "best[height<=?720][width<=?1280]",
46 | f"{link}",
47 | stdout=asyncio.subprocess.PIPE,
48 | stderr=asyncio.subprocess.PIPE,
49 | )
50 | stdout, stderr = await proc.communicate()
51 | if stdout:
52 | return 1, stdout.decode().split("\n")[0]
53 | else:
54 | return 0, stderr.decode()
55 |
56 |
57 | @Client.on_message(command(["vplay", f"vplay@{BOT_USERNAME}"]) & other_filters)
58 | async def vplay(c: Client, m: Message):
59 | await m.delete()
60 | replied = m.reply_to_message
61 | chat_id = m.chat.id
62 | user_id = m.from_user.id
63 | if m.sender_chat:
64 | return await m.reply_text("you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights.")
65 | try:
66 | aing = await c.get_me()
67 | except Exception as e:
68 | return await m.reply_text(f"error:\n\n{e}")
69 | a = await c.get_chat_member(chat_id, aing.id)
70 | if a.status != "administrator":
71 | await m.reply_text(
72 | 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"
73 | )
74 | return
75 | if not a.can_manage_voice_chats:
76 | await m.reply_text(
77 | "💡 To use me, Give me the following permission below:"
78 | + "\n\n» ❌ __Manage video chat__\n\nOnce done, try again.")
79 | return
80 | if not a.can_delete_messages:
81 | await m.reply_text(
82 | "💡 To use me, Give me the following permission below:"
83 | + "\n\n» ❌ __Delete messages__\n\nOnce done, try again.")
84 | return
85 | if not a.can_invite_users:
86 | await m.reply_text(
87 | "💡 To use me, Give me the following permission below:"
88 | + "\n\n» ❌ __Add users__\n\nOnce done, try again.")
89 | return
90 | try:
91 | ubot = (await user.get_me()).id
92 | b = await c.get_chat_member(chat_id, ubot)
93 | if b.status == "kicked":
94 | await c.unban_chat_member(chat_id, ubot)
95 | invitelink = await c.export_chat_invite_link(chat_id)
96 | if invitelink.startswith("https://t.me/+"):
97 | invitelink = invitelink.replace(
98 | "https://t.me/+", "https://t.me/joinchat/"
99 | )
100 | await user.join_chat(invitelink)
101 | except UserNotParticipant:
102 | try:
103 | invitelink = await c.export_chat_invite_link(chat_id)
104 | if invitelink.startswith("https://t.me/+"):
105 | invitelink = invitelink.replace(
106 | "https://t.me/+", "https://t.me/joinchat/"
107 | )
108 | await user.join_chat(invitelink)
109 | except UserAlreadyParticipant:
110 | pass
111 | except Exception as e:
112 | return await m.reply_text(
113 | f"❌ **userbot failed to join**\n\n**reason**: `{e}`"
114 | )
115 |
116 | if replied:
117 | if replied.video or replied.document:
118 | loser = await replied.reply("📥 **downloading video...**")
119 | dl = await replied.download()
120 | link = replied.link
121 | if len(m.command) < 2:
122 | Q = 720
123 | else:
124 | pq = m.text.split(None, 1)[1]
125 | if pq == "720" or "480" or "360":
126 | Q = int(pq)
127 | else:
128 | Q = 720
129 | await loser.edit(
130 | "» __only 720, 480, 360 allowed__ \n💡 **now streaming video in 720p**"
131 | )
132 | try:
133 | if replied.video:
134 | songname = replied.video.file_name[:70]
135 | elif replied.document:
136 | songname = replied.document.file_name[:70]
137 | except BaseException:
138 | songname = "Video"
139 |
140 | if chat_id in QUEUE:
141 | pos = add_to_queue(chat_id, songname, dl, link, "Video", Q)
142 | await loser.delete()
143 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
144 | buttons = stream_markup(user_id)
145 | await m.reply_photo(
146 | photo=thumbnail,
147 | reply_markup=InlineKeyboardMarkup(buttons),
148 | caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({link}) | `video`\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
149 | )
150 | else:
151 | if Q == 720:
152 | amaze = HighQualityVideo()
153 | elif Q == 480:
154 | amaze = MediumQualityVideo()
155 | elif Q == 360:
156 | amaze = LowQualityVideo()
157 | await loser.edit("🔄 **Joining vc...**")
158 | await call_py.join_group_call(
159 | chat_id,
160 | AudioVideoPiped(
161 | dl,
162 | HighQualityAudio(),
163 | amaze,
164 | ),
165 | stream_type=StreamType().local_stream,
166 | )
167 | add_to_queue(chat_id, songname, dl, link, "Video", Q)
168 | await loser.delete()
169 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
170 | buttons = stream_markup(user_id)
171 | await m.reply_photo(
172 | photo=thumbnail,
173 | reply_markup=InlineKeyboardMarkup(buttons),
174 | caption=f"🗂 **Name:** [{songname}]({link}) | `video`\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
175 | )
176 | else:
177 | if len(m.command) < 2:
178 | await m.reply_photo(
179 | photo=f"{IMG_6}",
180 | caption="💬**Usage: /play Give a Title Song To Play Music or /vplay for Video Play**"
181 | ,
182 | reply_markup=InlineKeyboardMarkup(
183 | [
184 | [
185 | InlineKeyboardButton("📣 Channel", url=f"https://t.me/BotDuniya"),
186 | InlineKeyboardButton("💭 Support", url=f"https://t.me/PmPermit")
187 | ],
188 | [
189 | InlineKeyboardButton("🗑 Close", callback_data="cls")
190 | ]
191 | ]
192 | )
193 | )
194 | else:
195 | loser = await c.send_message(chat_id, f"**Downloading**\n\n0% ▓▓▓▓▓▓▓▓▓▓▓▓ 100%"
196 | )
197 | query = m.text.split(None, 1)[1]
198 | search = ytsearch(query)
199 | Q = 720
200 | amaze = HighQualityVideo()
201 | if search == 0:
202 | await loser.edit("❌ **no results found.**")
203 | else:
204 | songname = search[0]
205 | title = search[0]
206 | url = search[1]
207 | duration = search[2]
208 | thumbnail = search[3]
209 | userid = m.from_user.id
210 | gcname = m.chat.title
211 | ctitle = await CHAT_TITLE(gcname)
212 | image = await thumb(thumbnail, title, userid, ctitle)
213 | shub, ytlink = await ytdl(url)
214 | if shub == 0:
215 | await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
216 | else:
217 | if chat_id in QUEUE:
218 | pos = add_to_queue(
219 | chat_id, songname, ytlink, url, "Video", Q
220 | )
221 | await loser.delete()
222 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
223 | buttons = stream_markup(user_id)
224 | await m.reply_photo(
225 | photo=image,
226 | reply_markup=InlineKeyboardMarkup(buttons),
227 | caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
228 | )
229 | else:
230 | try:
231 | await loser.edit(
232 | f"**𝘽𝙤𝙩 𝘿𝙪𝙣𝙞𝙮𝙖 Downloader**\n\n**Title**: {title[:22]}\n\n100% ████████████100%\n\n**Time Taken**: 00:00 Seconds\n\n**Converting Audio[FFmpeg Process]**"
233 | )
234 | await call_py.join_group_call(
235 | chat_id,
236 | AudioVideoPiped(
237 | ytlink,
238 | HighQualityAudio(),
239 | amaze,
240 | ),
241 | stream_type=StreamType().local_stream,
242 | )
243 | add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
244 | await loser.delete()
245 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
246 | buttons = stream_markup(user_id)
247 | await m.reply_photo(
248 | photo=image,
249 | reply_markup=InlineKeyboardMarkup(buttons),
250 | caption=f"🎵 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
251 | )
252 | except Exception as ep:
253 | await loser.delete()
254 | await m.reply_text(f"🚫 error: `{ep}`")
255 |
256 | else:
257 | if len(m.command) < 2:
258 | await m.reply_photo(
259 | photo=f"{IMG_6}",
260 | caption="💫**Usage: /play Give a Title Song To Play Music or /vplay for Video Play**"
261 | ,
262 | reply_markup=InlineKeyboardMarkup(
263 | [
264 | [
265 | InlineKeyboardButton("📣 Channel", url=f"https://t.me/BotDuniya"),
266 | InlineKeyboardButton("💭 Support", url=f"https://t.me/PmPermit")
267 | ],
268 | [
269 | InlineKeyboardButton("🗑 Close", callback_data="cls")
270 | ]
271 | ]
272 | )
273 | )
274 | else:
275 | loser = await c.send_message(chat_id, f"**Downloading**\n\n0% ▓▓▓▓▓▓▓▓▓▓▓▓ 100%")
276 | query = m.text.split(None, 1)[1]
277 | search = ytsearch(query)
278 | Q = 720
279 | amaze = HighQualityVideo()
280 | if search == 0:
281 | await loser.edit("❌ **no results found.**")
282 | else:
283 | songname = search[0]
284 | title = search[0]
285 | url = search[1]
286 | duration = search[2]
287 | thumbnail = search[3]
288 | userid = m.from_user.id
289 | gcname = m.chat.title
290 | ctitle = await CHAT_TITLE(gcname)
291 | image = await thumb(thumbnail, title, userid, ctitle)
292 | shub, ytlink = await ytdl(url)
293 | if shub == 0:
294 | await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
295 | else:
296 | if chat_id in QUEUE:
297 | pos = add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
298 | await loser.delete()
299 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
300 | buttons = stream_markup(user_id)
301 | await m.reply_photo(
302 | photo=image,
303 | reply_markup=InlineKeyboardMarkup(buttons),
304 | caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
305 | )
306 | else:
307 | try:
308 | await loser.edit(
309 | f"**𝘽𝙤𝙩 𝘿𝙪𝙣𝙞𝙮𝙖 Downloader**\n\n**Title**: {title[:22]}\n\n100% ████████████100%\n\n**Time Taken**: 00:00 Seconds\n\n**Converting Audio[FFmpeg Process]**"
310 | )
311 | await call_py.join_group_call(
312 | chat_id,
313 | AudioVideoPiped(
314 | ytlink,
315 | HighQualityAudio(),
316 | amaze,
317 | ),
318 | stream_type=StreamType().local_stream,
319 | )
320 | add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
321 | await loser.delete()
322 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
323 | buttons = stream_markup(user_id)
324 | await m.reply_photo(
325 | photo=image,
326 | reply_markup=InlineKeyboardMarkup(buttons),
327 | caption=f"🗂 **Name:** [{songname}]({url}) |`video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
328 | )
329 | except Exception as ep:
330 | await loser.delete()
331 | await m.reply_text(f"🚫 error: `{ep}`")
332 |
333 |
334 | @Client.on_message(command(["vstream", f"vstream@{BOT_USERNAME}"]) & other_filters)
335 | async def vstream(c: Client, m: Message):
336 | await m.delete()
337 | chat_id = m.chat.id
338 | user_id = m.from_user.id
339 | if m.sender_chat:
340 | return await m.reply_text("you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights.")
341 | try:
342 | aing = await c.get_me()
343 | except Exception as e:
344 | return await m.reply_text(f"error:\n\n{e}")
345 | a = await c.get_chat_member(chat_id, aing.id)
346 | if a.status != "administrator":
347 | await m.reply_text(
348 | 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"
349 | )
350 | return
351 | if not a.can_manage_voice_chats:
352 | await m.reply_text(
353 | "💡 To use me, Give me the following permission below:"
354 | + "\n\n» ❌ __Manage video chat__\n\nOnce done, try again.")
355 | return
356 | if not a.can_delete_messages:
357 | await m.reply_text(
358 | "💡 To use me, Give me the following permission below:"
359 | + "\n\n» ❌ __Delete messages__\n\nOnce done, try again.")
360 | return
361 | if not a.can_invite_users:
362 | await m.reply_text(
363 | "💡 To use me, Give me the following permission below:"
364 | + "\n\n» ❌ __Add users__\n\nOnce done, try again.")
365 | return
366 | try:
367 | ubot = (await user.get_me()).id
368 | b = await c.get_chat_member(chat_id, ubot)
369 | if b.status == "kicked":
370 | await c.unban_chat_member(chat_id, ubot)
371 | invitelink = await c.export_chat_invite_link(chat_id)
372 | if invitelink.startswith("https://t.me/+"):
373 | invitelink = invitelink.replace(
374 | "https://t.me/+", "https://t.me/joinchat/"
375 | )
376 | await user.join_chat(invitelink)
377 | except UserNotParticipant:
378 | try:
379 | invitelink = await c.export_chat_invite_link(chat_id)
380 | if invitelink.startswith("https://t.me/+"):
381 | invitelink = invitelink.replace(
382 | "https://t.me/+", "https://t.me/joinchat/"
383 | )
384 | await user.join_chat(invitelink)
385 | except UserAlreadyParticipant:
386 | pass
387 | except Exception as e:
388 | return await m.reply_text(
389 | f"❌ **userbot failed to join**\n\n**reason**: `{e}`"
390 | )
391 |
392 | if len(m.command) < 2:
393 | await m.reply("» give me a live-link/m3u8 url/youtube link to stream.")
394 | else:
395 | if len(m.command) == 2:
396 | link = m.text.split(None, 1)[1]
397 | Q = 720
398 | loser = await c.send_message(chat_id, "🔄 **processing stream...**")
399 | elif len(m.command) == 3:
400 | op = m.text.split(None, 1)[1]
401 | link = op.split(None, 1)[0]
402 | quality = op.split(None, 1)[1]
403 | if quality == "720" or "480" or "360":
404 | Q = int(quality)
405 | else:
406 | Q = 720
407 | await m.reply(
408 | "» __only 720, 480, 360 allowed__ \n💡 **now streaming video in 720p**"
409 | )
410 | loser = await c.send_message(chat_id, "🔄 **processing stream...**")
411 | else:
412 | await m.reply("**/vstream {link} {720/480/360}**")
413 |
414 | regex = r"^(https?\:\/\/)?(www\.youtube\.com|youtu\.?be)\/.+"
415 | match = re.match(regex, link)
416 | if match:
417 | null, livelink = await ytdl(link)
418 | else:
419 | livelink = link
420 | null = 1
421 |
422 | if null == 0:
423 | await loser.edit(f"❌ yt-dl issues detected\n\n» `{livelink}`")
424 | else:
425 | if chat_id in QUEUE:
426 | pos = add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q)
427 | await loser.delete()
428 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
429 | buttons = stream_markup(user_id)
430 | await m.reply_photo(
431 | photo=f"{IMG_1}",
432 | reply_markup=InlineKeyboardMarkup(buttons),
433 | caption=f"💡 **Track added to queue »** `{pos}`\n\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
434 | )
435 | else:
436 | if Q == 720:
437 | amaze = HighQualityVideo()
438 | elif Q == 480:
439 | amaze = MediumQualityVideo()
440 | elif Q == 360:
441 | amaze = LowQualityVideo()
442 | try:
443 | await loser.edit("🔄 **Joining vc...**")
444 | await call_py.join_group_call(
445 | chat_id,
446 | AudioVideoPiped(
447 | livelink,
448 | HighQualityAudio(),
449 | amaze,
450 | ),
451 | stream_type=StreamType().live_stream,
452 | )
453 | add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q)
454 | await loser.delete()
455 | requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
456 | buttons = stream_markup(user_id)
457 | await m.reply_photo(
458 | photo=f"{IMG_2}",
459 | reply_markup=InlineKeyboardMarkup(buttons),
460 | caption=f"💡 **[Video Live]({link}) stream started.**\n\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
461 | )
462 | except Exception as ep:
463 | await loser.delete()
464 | await m.reply_text(f"🚫 error: `{ep}`")
465 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------