Skip to content

Commit

Permalink
Merge pull request #34 from ITS-ZAID/Multi
Browse files Browse the repository at this point in the history
Jmmm
  • Loading branch information
ITZ-ZAID authored Jun 16, 2022
2 parents 6da458b + 71c969c commit d2b3b9f
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

[ꜰᴏʀᴋ ᴅᴇᴘʟᴏʏ ɪꜱ ʜɪɢʜʟʏ ʀᴇᴄᴏᴍᴍᴇɴᴅᴇᴅ](https://telegra.ph/file/5bcf79f948ca06030640c.mp4)

<p align="center"><a href="https://zaid.vercel.app/"> <img src="https://img.shields.io/badge/Deploy%20To%20Heroku-pink?style=for-the-badge&logo=heroku" width="220" height="38.45"/></a></p>
<p align="center"><a href="https://heroku.com/deploy"> <img src="https://img.shields.io/badge/Deploy%20To%20Heroku-pink?style=for-the-badge&logo=heroku" width="220" height="38.45"/></a></p>

> Click on buttons below to expand and detailed explanation process. !
Expand Down
4 changes: 2 additions & 2 deletions Zaid/Player/admins.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from Zaid.filters import command, other_filters
from Zaid.queues import QUEUE, clear_queue
from Zaid.utils import skip_current_song, skip_item
from config import BOT_USERNAME, GROUP_SUPPORT, IMG_3, UPDATES_CHANNEL
from config import BOT_USERNAME, GROUP_SUPPORT, SKIP_IMG, UPDATES_CHANNEL
from pyrogram.types import (
CallbackQuery,
InlineKeyboardButton,
Expand Down Expand Up @@ -70,7 +70,7 @@ async def skip(client, m: Message):
await m.reply("🗑️ **Clearing the Queues**\n\n**• userbot leaving voice chat**")
else:
await m.reply_photo(
photo=f"{IMG_3}",
photo=f"{SKIP_IMG}",
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()}",
reply_markup=keyboard,
)
Expand Down
14 changes: 7 additions & 7 deletions Zaid/Player/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import requests
from Zaid.fonts import CHAT_TITLE
from PIL import Image, ImageDraw, ImageFont
from config import ASSISTANT_NAME, BOT_USERNAME, IMG_1, IMG_2, IMG_5, UPDATES_CHANNEL, GROUP_SUPPORT
from config import ASSISTANT_NAME, BOT_USERNAME, QUE_IMG, CMD_IMG, PLAY_IMG, UPDATES_CHANNEL, GROUP_SUPPORT
from Zaid.filters import command, other_filters
from Zaid.queues import QUEUE, add_to_queue
from Zaid.main import call_py, Test as user, call_py2, call_py3, call_py4, call_py5
Expand Down Expand Up @@ -201,7 +201,7 @@ async def play(c: Client, m: Message):
pos = add_to_queue(chat_id, songname, dl, link, "Audio", 0)
await suhu.delete()
await m.reply_photo(
photo=f"{IMG_1}",
photo=f"{QUE_IMG}",
caption=f"💡 **Track added to queue »** `{pos}`\n\n🏷 **Name:** [{songname}]({link}) | `music`\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {m.from_user.mention()}",
reply_markup=keyboard,
)
Expand Down Expand Up @@ -252,7 +252,7 @@ async def play(c: Client, m: Message):
await suhu.delete()
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
await m.reply_photo(
photo=f"{IMG_2}",
photo=f"{PLAY_IMG}",
caption=f"🏷 **Name:** [{songname}]({link})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}\n📹 **Stream type:** `Music`",
reply_markup=keyboard,
)
Expand All @@ -263,7 +263,7 @@ async def play(c: Client, m: Message):
else:
if len(m.command) < 2:
await m.reply_photo(
photo=f"{IMG_5}",
photo=f"{CMD_IMG}",
caption="💬**Usage: /play Give a Title Song To Play Music or /vplay for Video Play**"
,
reply_markup=InlineKeyboardMarkup(
Expand Down Expand Up @@ -291,7 +291,7 @@ async def play(c: Client, m: Message):
userid = m.from_user.id
gcname = m.chat.title
ctitle = await CHAT_TITLE(gcname)
image = await generate_cover(thumbnail, title, userid, ctitle)
image = PLAY_IMG
format = "bestaudio"
abhi, ytlink = await ytdl(format, url)
if abhi == 0:
Expand All @@ -304,7 +304,7 @@ async def play(c: Client, m: Message):
f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
)
await m.reply_photo(
photo=image,
photo=f"{QUE_IMG}",
caption=f"💡 **Track added to queue »** `{pos}`\n\n🏷 **Name:** [{songname[:22]}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🎧 **Request by:** {requester}",
reply_markup=keyboard,
)
Expand Down Expand Up @@ -358,7 +358,7 @@ async def play(c: Client, m: Message):
await suhu.delete()
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
await m.reply_photo(
photo=image,
photo=f"{PLAY_IMG}",
caption=f"🏷 **Name:** [{songname[:22]}]({url})\n**⏱ Duration:** `{duration}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}",
reply_markup=keyboard,
)
Expand Down
26 changes: 13 additions & 13 deletions Zaid/Player/video.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
import asyncio

from config import ASSISTANT_NAME, BOT_USERNAME, IMG_1, IMG_2, IMG_6
from config import ASSISTANT_NAME, BOT_USERNAME, QUE_IMG, VIDEO_IMG, CMD_IMG
from Zaid.inline import stream_markup
from Process.design.thumbnail import thumb
from Process.design.chatname import CHAT_TITLE
Expand Down Expand Up @@ -126,7 +126,7 @@ async def vplay(c: Client, m: Message):
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
buttons = stream_markup(user_id)
await m.reply_photo(
photo=thumbnail,
photo=f"{QUE_IMG}",
reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({link}) | `video`\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
)
Expand Down Expand Up @@ -194,14 +194,14 @@ async def vplay(c: Client, m: Message):
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
buttons = stream_markup(user_id)
await m.reply_photo(
photo=thumbnail,
photo=f"{VIDEO_IMG}",
reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({link}) | `video`\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
)
else:
if len(m.command) < 2:
await m.reply_photo(
photo=f"{IMG_6}",
photo=f"{CMD_IMG}",
caption="💬**Usage: /play Give a Title Song To Play Music or /vplay for Video Play**"
,
reply_markup=InlineKeyboardMarkup(
Expand Down Expand Up @@ -229,7 +229,7 @@ async def vplay(c: Client, m: Message):
userid = m.from_user.id
gcname = m.chat.title
ctitle = await CHAT_TITLE(gcname)
image = await thumb(thumbnail, title, userid, ctitle)
image = VIDEO_IMG
veez, ytlink = await ytdl(url)
if veez == 0:
await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
Expand All @@ -242,7 +242,7 @@ async def vplay(c: Client, m: Message):
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
buttons = stream_markup(user_id)
await m.reply_photo(
photo=image,
photo=f"{QUE_IMG}",
reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
)
Expand Down Expand Up @@ -305,7 +305,7 @@ async def vplay(c: Client, m: Message):
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
buttons = stream_markup(user_id)
await m.reply_photo(
photo=image,
photo=f"{VIDEO_IMG}",
reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
)
Expand All @@ -316,7 +316,7 @@ async def vplay(c: Client, m: Message):
else:
if len(m.command) < 2:
await m.reply_photo(
photo=f"{IMG_6}",
photo=f"{CMD_IMG}",
caption="💬**Usage: /play Give a Title Song To Play Music or /vplay for Video Play**"
,
reply_markup=InlineKeyboardMarkup(
Expand Down Expand Up @@ -355,7 +355,7 @@ async def vplay(c: Client, m: Message):
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
buttons = stream_markup(user_id)
await m.reply_photo(
photo=image,
photo=f"{QUE_IMG}",
reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
)
Expand Down Expand Up @@ -418,7 +418,7 @@ async def vplay(c: Client, m: Message):
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
buttons = stream_markup(user_id)
await m.reply_photo(
photo=image,
photo=f"{VIDEO_IMG}",
reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({url}) |`video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
)
Expand Down Expand Up @@ -502,7 +502,7 @@ async def vstream(c: Client, m: Message):
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
buttons = stream_markup(user_id)
await m.reply_photo(
photo=f"{IMG_1}",
photo=f"{QUE_IMG}",
reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
)
Expand Down Expand Up @@ -571,9 +571,9 @@ async def vstream(c: Client, m: Message):
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
buttons = stream_markup(user_id)
await m.reply_photo(
photo=f"{IMG_2}",
photo=f"{VIDEO_IMG}",
reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **[__Live Streaming Started__]({link}) **\n\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
caption=f"💡 **[__Live Streaming Started__]({link}) **\n\n💭 **Chatinfo:** `{chat_id}`\n🧸 **Request by:** {requester}",
)
except Exception as ep:
await loser.delete()
Expand Down
1 change: 1 addition & 0 deletions Zaid/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import os
import sys
import random
Expand Down
78 changes: 63 additions & 15 deletions Zaid/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import asyncio
from Zaid.main import bot, call_py, call_py2, call_py3, call_py4, call_py5
from config import NEXT_IMG
from pytgcalls.types import Update
from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
from Zaid.queues import QUEUE, clear_queue, get_queue, pop_an_item
Expand Down Expand Up @@ -241,33 +242,80 @@ async def left_handler(_, chat_id: int):

@call_py.on_stream_end()
async def stream_end_handler(_, u: Update):
chat_id = u.chat_id
print(chat_id)
await skip_current_song(chat_id)
if isinstance(u, StreamAudioEnded):
chat_id = u.chat_id
print(chat_id)
op = await skip_current_song(chat_id)
if op==1:
await bot.send_message(chat_id, "✅ **userbot has disconnected from video chat.**")
elif op==2:
await bot.send_message(chat_id, "❌ **an error occurred**\n\n» **Clearing** __Queues__ **and leaving video chat.**")
else:
await bot.send_photo(chat_id, f"{NEXT_IMG}", caption=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)
else:
pass


@call_py2.on_stream_end()
async def stream_end_handler(_, u: Update):
chat_id = u.chat_id
print(chat_id)
await skip_current_song(chat_id)
if isinstance(u, StreamAudioEnded):
chat_id = u.chat_id
print(chat_id)
op = await skip_current_song(chat_id)
if op==1:
await bot.send_message(chat_id, "✅ **userbot has disconnected from video chat.**")
elif op==2:
await bot.send_message(chat_id, "❌ **an error occurred**\n\n» **Clearing** __Queues__ **and leaving video chat.**")
else:
await bot.send_photo(chat_id, f"{NEXT_IMG}", caption=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)
else:
pass


@call_py3.on_stream_end()
async def stream_end_handler(_, u: Update):
chat_id = u.chat_id
print(chat_id)
await skip_current_song(chat_id)
if isinstance(u, StreamAudioEnded):
chat_id = u.chat_id
print(chat_id)
op = await skip_current_song(chat_id)
if op==1:
await bot.send_message(chat_id, "✅ **userbot has disconnected from video chat.**")
elif op==2:
await bot.send_message(chat_id, "❌ **an error occurred**\n\n» **Clearing** __Queues__ **and leaving video chat.**")
else:
await bot.send_photo(chat_id, f"{NEXT_IMG}", caption=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)
else:
pass

@call_py4.on_stream_end()
async def stream_end_handler(_, u: Update):
chat_id = u.chat_id
print(chat_id)
await skip_current_song(chat_id)
if isinstance(u, StreamAudioEnded):
chat_id = u.chat_id
print(chat_id)
op = await skip_current_song(chat_id)
if op==1:
await bot.send_message(chat_id, "✅ **userbot has disconnected from video chat.**")
elif op==2:
await bot.send_message(chat_id, "❌ **an error occurred**\n\n» **Clearing** __Queues__ **and leaving video chat.**")
else:
await bot.send_photo(chat_id, f"{NEXT_IMG}", caption=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)
else:
pass

@call_py5.on_stream_end()
async def stream_end_handler(_, u: Update):
chat_id = u.chat_id
print(chat_id)
await skip_current_song(chat_id)
if isinstance(u, StreamAudioEnded):
chat_id = u.chat_id
print(chat_id)
op = await skip_current_song(chat_id)
if op==1:
await bot.send_message(chat_id, "✅ **userbot has disconnected from video chat.**")
elif op==2:
await bot.send_message(chat_id, "❌ **an error occurred**\n\n» **Clearing** __Queues__ **and leaving video chat.**")
else:
await bot.send_photo(chat_id, f"{NEXT_IMG}", caption=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)
else:
pass


async def bash(cmd):
Expand Down
19 changes: 11 additions & 8 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@

load_dotenv()
admins = {}
SESSION_NAME = getenv("SESSION_NAME", "")
if str(getenv("SESSION_NAME")).strip() == "":
SESSION_NAME = str(None)
else:
SESSION_NAME = str(getenv("SESSION_NAME"))

if str(getenv("STRING_SESSION2")).strip() == "":
SESSION2 = str(None)
else:
SESSION2 = str(getenv("STRING_SESSION2", ""))
SESSION2 = str(getenv("STRING_SESSION2"))

if str(getenv("STRING_SESSION3")).strip() == "":
SESSION3 = str(None)
Expand Down Expand Up @@ -54,9 +57,9 @@
START_PIC = getenv("START_PIC", "https://telegra.ph/file/a414e2cdfeaa7d4414b89.png")
DURATION_LIMIT = int(getenv("DURATION_LIMIT", "60"))
UPSTREAM_REPO = getenv("UPSTREAM_REPO", "https://github.com/ITZ-ZAID/Zaid-Vc-Player")
IMG_1 = getenv("IMG_1", "https://telegra.ph/file/c540aac0249486854787b.png")
IMG_2 = getenv("IMG_2", "https://telegra.ph/file/6f1cfec700087f6fcb391.png")
IMG_3 = getenv("IMG_3", "https://telegra.ph/file/c3547532105a0cb67229d.png")
IMG_4 = getenv("IMG_4", "https://telegra.ph/file/be5f551acb116292d15ec.png")
IMG_5 = getenv("IMG_5", "https://telegra.ph/file/c3401a572375b569138c3.png")
IMG_6 = getenv("IMG_6", "https://telegra.ph/file/c3401a572375b569138c3.png")
PLAY_IMG = getenv("PLAY_IMG", "https://telegra.ph/file/10b1f781170b1e1867f68.png")
QUE_IMG = getenv("QUE_IMG", "https://telegra.ph/file/b95c13eef1ebd14dbb458.png")
CMD_IMG = getenv("CMD_IMG", "https://telegra.ph/file/66518ed54301654f0b126.png")
VIDEO_IMG = getenv("VIDEO_IMG", "https://telegra.ph/file/6213d2673486beca02967.png")
SKIP_IMG = getenv("SKIP_IMG", "https://telegra.ph/file/f02efde766160d3ff52d6.png")
NEXT_IMG = getenv("NEXT_IMG", "https://telegra.ph/file/f02efde766160d3ff52d6.png")
1 change: 0 additions & 1 deletion start
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
git clone $REPO_URL Xyz
cd Xyz
pip3 install -U -r requirements.txt
python3 main.py

0 comments on commit d2b3b9f

Please sign in to comment.