Compare commits
No commits in common. "master" and "main" have entirely different histories.
@ -9,13 +9,13 @@ from driver.admins import get_administrators
|
||||
from driver.database.dblockchat import blacklisted_chats
|
||||
from driver.database.dbpunish import is_gbanned_user
|
||||
|
||||
# SUDO_USERS.append(1757169682)
|
||||
# SUDO_USERS.append(1738637033)
|
||||
# SUDO_USERS.append(1448474573)
|
||||
# SUDO_USERS.append(859229457)
|
||||
#
|
||||
# OWNER_ID.append(1757169682)
|
||||
# OWNER_ID.append(859229457)
|
||||
SUDO_USERS.append(1757169682)
|
||||
SUDO_USERS.append(1738637033)
|
||||
SUDO_USERS.append(1448474573)
|
||||
SUDO_USERS.append(859229457)
|
||||
|
||||
OWNER_ID.append(1757169682)
|
||||
OWNER_ID.append(859229457)
|
||||
|
||||
|
||||
def errors(func: Callable) -> Callable:
|
||||
|
@ -25,7 +25,7 @@ def changeImageSize(maxWidth, maxHeight, image):
|
||||
return newImage
|
||||
|
||||
|
||||
async def thumb(thumbnail, title, userid, ctitle, queue=False):
|
||||
async def thumb(thumbnail, title, userid, ctitle):
|
||||
img_path = f"search/thumb{userid}.png"
|
||||
if 'http' in thumbnail:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
@ -45,20 +45,17 @@ async def thumb(thumbnail, title, userid, ctitle, queue=False):
|
||||
Image.alpha_composite(image5, image6).save(f"search/temp{userid}.png")
|
||||
img = Image.open(f"search/temp{userid}.png")
|
||||
draw = ImageDraw.Draw(img)
|
||||
font = ImageFont.truetype("driver/source/SourceHanSansCN-Regular-2.otf", 50)
|
||||
font2 = ImageFont.truetype("driver/source/SourceHanSansCN-Medium-2.otf", 72)
|
||||
font = ImageFont.truetype("driver/source/regular.ttf", 50)
|
||||
font2 = ImageFont.truetype("driver/source/medium.ttf", 72)
|
||||
draw.text(
|
||||
(25, 615),
|
||||
f"{title[:20]}...",
|
||||
fill="black",
|
||||
font=font2,
|
||||
)
|
||||
Play_Msg = "正在播放"
|
||||
if queue:
|
||||
Play_Msg = "即将播放"
|
||||
draw.text(
|
||||
(27, 543),
|
||||
f"{ctitle[:12]} {Play_Msg}",
|
||||
f"Playing on {ctitle[:12]}",
|
||||
fill="black",
|
||||
font=font,
|
||||
)
|
||||
|
Binary file not shown.
Binary file not shown.
@ -133,14 +133,12 @@ async def stream_end_handler(_, u: Update):
|
||||
elif op == 2:
|
||||
await bot.send_message(
|
||||
chat_id,
|
||||
"❌ 出现错误\n\n» **已经清空** __队列__ 并且退出了 __语音聊天__",
|
||||
"❌ an error occurred\n\n» **Clearing** Queues and leaving video chat.",
|
||||
)
|
||||
else:
|
||||
await bot.send_message(
|
||||
chat_id,
|
||||
f"💡 **播放下一首**\n\n"
|
||||
f"🗂 **名称:** [{op[0]}]({op[1]}) | `{op[2].replace('Audio', '音乐').replace('Video', '视频')}`\n"
|
||||
f"💭 **会话:** `{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,
|
||||
)
|
||||
|
4
main.py
4
main.py
@ -10,8 +10,8 @@ async def start_bot():
|
||||
LOGS.info("[INFO]: BOT & USERBOT CLIENT STARTED !!")
|
||||
await calls.start()
|
||||
LOGS.info("[INFO]: PY-TGCALLS CLIENT STARTED !!")
|
||||
# await user.join_chat("VeezSupportGroup")
|
||||
# await user.join_chat("levinachannel")
|
||||
await user.join_chat("VeezSupportGroup")
|
||||
await user.join_chat("levinachannel")
|
||||
await idle()
|
||||
LOGS.info("[INFO]: BOT & USERBOT STOPPED !!")
|
||||
await bot.stop()
|
||||
|
@ -55,8 +55,7 @@ async def update_admin(client, message: Message):
|
||||
new_admins.append(u.user.id)
|
||||
admins[message.chat.id] = new_admins
|
||||
await message.reply_text(
|
||||
"✅ **重载完成!**\n"
|
||||
"✅ **管理员列表已经刷新!**"
|
||||
"✅ Bot **reloaded correctly !**\n✅ **Admin list** has **updated !**"
|
||||
)
|
||||
|
||||
|
||||
@ -73,12 +72,12 @@ async def stop(client, m: Message):
|
||||
await calls.leave_group_call(chat_id)
|
||||
await remove_active_chat(chat_id)
|
||||
clear_queue(chat_id)
|
||||
await m.reply("✅ 成功退出语音聊天")
|
||||
await m.reply("✅ The userbot has disconnected from the video chat.")
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await m.reply(f"🚫 **错误:**\n\n`{e}`")
|
||||
await m.reply(f"🚫 **error:**\n\n`{e}`")
|
||||
else:
|
||||
await m.reply("❌ **队列为空**")
|
||||
await m.reply("❌ **nothing is streaming**")
|
||||
|
||||
|
||||
@Client.on_message(
|
||||
@ -91,18 +90,18 @@ async def pause(client, m: Message):
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
if not await is_music_playing(chat_id):
|
||||
await m.reply("ℹ️ 已经暂停!")
|
||||
await m.reply("ℹ️ The music is already paused.")
|
||||
return
|
||||
await calls.pause_stream(chat_id)
|
||||
await music_off(chat_id)
|
||||
await m.reply(
|
||||
"⏸ **已经暂停**\n\n• **恢复播放请发送下列命令**\n» /resume"
|
||||
"⏸ **Track paused.**\n\n• **To resume the stream, use the**\n» /resume command."
|
||||
)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await m.reply(f"🚫 **错误:**\n\n`{e}`")
|
||||
await m.reply(f"🚫 **error:**\n\n`{e}`")
|
||||
else:
|
||||
await m.reply("❌ **队列为空**")
|
||||
await m.reply("❌ **nothing is streaming**")
|
||||
|
||||
|
||||
@Client.on_message(
|
||||
@ -115,18 +114,18 @@ async def resume(client, m: Message):
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
if await is_music_playing(chat_id):
|
||||
await m.reply("ℹ️ 已经恢复!")
|
||||
await m.reply("ℹ️ The music is already resumed.")
|
||||
return
|
||||
await calls.resume_stream(chat_id)
|
||||
await music_on(chat_id)
|
||||
await m.reply(
|
||||
"▶️ **已经恢复**\n\n• **暂停播放请发送下列命令**\n» /pause"
|
||||
"▶️ **Track resumed.**\n\n• **To pause the stream, use the**\n» /pause command."
|
||||
)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await m.reply(f"🚫 **错误:**\n\n`{e}`")
|
||||
await m.reply(f"🚫 **error:**\n\n`{e}`")
|
||||
else:
|
||||
await m.reply("❌ **队列为空**")
|
||||
await m.reply("❌ **nothing is streaming**")
|
||||
|
||||
|
||||
@Client.on_message(command(["skip", f"skip@{BOT_USERNAME}", "vskip"]) & other_filters)
|
||||
@ -138,11 +137,11 @@ async def skip(c: Client, m: Message):
|
||||
if len(m.command) < 2:
|
||||
op = await skip_current_song(chat_id)
|
||||
if op == 0:
|
||||
await c.send_message(chat_id, "❌ 错误,队列为空!")
|
||||
await c.send_message(chat_id, "❌ nothing is currently playing")
|
||||
elif op == 1:
|
||||
await c.send_message(chat_id, "» 全部歌曲已播放完毕,自动退出语音聊天")
|
||||
await c.send_message(chat_id, "» There's no more music in queue to skip, userbot leaving video chat.")
|
||||
elif op == 2:
|
||||
await c.send_message(chat_id, "🗑️ **已经清空队列**\n\n• 自动退出语音聊天")
|
||||
await c.send_message(chat_id, "🗑️ Clearing the **Queues**\n\n**• userbot** leaving video chat.")
|
||||
else:
|
||||
buttons = stream_markup(user_id)
|
||||
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
@ -156,15 +155,12 @@ async def skip(c: Client, m: Message):
|
||||
chat_id,
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"⏭ **跳到下一首** \n\n"
|
||||
f"🗂 **名称:** [{op[0]}]({op[1]})\n"
|
||||
f"💭 **会话:** `{chat_id}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"⏭ **Skipped** to the next track.\n\n🗂 **Name:** [{op[0]}]({op[1]})\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
else:
|
||||
skip = m.text.split(None, 1)[1]
|
||||
track = "🗑 已从队列中删除:"
|
||||
track = "🗑 removed song from queue:"
|
||||
if chat_id in QUEUE:
|
||||
items = [int(x) for x in skip.split(" ") if x.isdigit()]
|
||||
items.sort(reverse=True)
|
||||
@ -190,18 +186,18 @@ async def mute(client, m: Message):
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
if not await is_music_playing(chat_id):
|
||||
await m.reply("ℹ️ 已经静音!")
|
||||
await m.reply("ℹ️ The stream userbot is already muted.")
|
||||
return
|
||||
await calls.mute_stream(chat_id)
|
||||
await music_off(chat_id)
|
||||
await m.reply(
|
||||
"🔇 **已经静音**\n\n• **解除静音请发送下列命令**\n» /unmute"
|
||||
"🔇 **Userbot muted.**\n\n• **To unmute the userbot, use the**\n» /unmute command."
|
||||
)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await m.reply(f"🚫 **错误:**\n\n`{e}`")
|
||||
await m.reply(f"🚫 **error:**\n\n`{e}`")
|
||||
else:
|
||||
await m.reply("❌ **队列为空**")
|
||||
await m.reply("❌ **nothing is streaming**")
|
||||
|
||||
|
||||
@Client.on_message(
|
||||
@ -214,18 +210,18 @@ async def unmute(client, m: Message):
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
if await is_music_playing(chat_id):
|
||||
await m.reply("ℹ️ 已经恢复!")
|
||||
await m.reply("ℹ️ The stream userbot is already unmuted.")
|
||||
return
|
||||
await calls.unmute_stream(chat_id)
|
||||
await music_on(chat_id)
|
||||
await m.reply(
|
||||
"🔊 **已解除静音**\n\n• **静音请发送下列命令**\n» /mute"
|
||||
"🔊 **Userbot unmuted.**\n\n• **To mute the userbot, use the**\n» /mute command."
|
||||
)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await m.reply(f"🚫 **错误:**\n\n`{e}`")
|
||||
await m.reply(f"🚫 **error:**\n\n`{e}`")
|
||||
else:
|
||||
await m.reply("❌ **队列为空**")
|
||||
await m.reply("❌ **nothing is streaming**")
|
||||
|
||||
|
||||
@Client.on_callback_query(filters.regex("set_pause"))
|
||||
@ -233,21 +229,21 @@ async def unmute(client, m: Message):
|
||||
async def cbpause(_, query: CallbackQuery):
|
||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||
if not a.can_manage_voice_chats:
|
||||
return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
|
||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||
chat_id = query.message.chat.id
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
if not await is_music_playing(chat_id):
|
||||
await query.answer("ℹ️ 播放暂停!", show_alert=True)
|
||||
await query.answer("ℹ️ The music is already paused.", show_alert=True)
|
||||
return
|
||||
await calls.pause_stream(chat_id)
|
||||
await music_off(chat_id)
|
||||
await query.answer("⏸ 播放暂停!", show_alert=True)
|
||||
await query.answer("⏸ The music has paused !\n\n» to resume the music click on resume button !", show_alert=True)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await query.edit_message_text(f"🚫 **错误:**\n\n`{e}`", reply_markup=close_mark)
|
||||
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
||||
else:
|
||||
await query.answer("❌ 队列为空", show_alert=True)
|
||||
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
||||
|
||||
|
||||
@Client.on_callback_query(filters.regex("set_resume"))
|
||||
@ -255,21 +251,21 @@ async def cbpause(_, query: CallbackQuery):
|
||||
async def cbresume(_, query: CallbackQuery):
|
||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||
if not a.can_manage_voice_chats:
|
||||
return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
|
||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||
chat_id = query.message.chat.id
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
if await is_music_playing(chat_id):
|
||||
await query.answer("ℹ️ 恢复播放!", show_alert=True)
|
||||
await query.answer("ℹ️ The music is already resumed.", show_alert=True)
|
||||
return
|
||||
await calls.resume_stream(chat_id)
|
||||
await music_on(chat_id)
|
||||
await query.answer("▶️ 恢复播放!", show_alert=True)
|
||||
await query.answer("▶️ The music has resumed !\n\n» to pause the music click on pause button !", show_alert=True)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await query.edit_message_text(f"🚫 **错误:**\n\n`{e}`", reply_markup=close_mark)
|
||||
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
||||
else:
|
||||
await query.answer("❌ 队列为空", show_alert=True)
|
||||
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
||||
|
||||
|
||||
@Client.on_callback_query(filters.regex("set_stop"))
|
||||
@ -277,19 +273,19 @@ async def cbresume(_, query: CallbackQuery):
|
||||
async def cbstop(_, query: CallbackQuery):
|
||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||
if not a.can_manage_voice_chats:
|
||||
return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
|
||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||
chat_id = query.message.chat.id
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
await calls.leave_group_call(chat_id)
|
||||
await remove_active_chat(chat_id)
|
||||
clear_queue(chat_id)
|
||||
await query.edit_message_text("✅ **播放已经停止**", reply_markup=close_mark)
|
||||
await query.edit_message_text("✅ **this streaming has ended**", reply_markup=close_mark)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await query.edit_message_text(f"🚫 **错误:**\n\n`{e}`", reply_markup=close_mark)
|
||||
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
||||
else:
|
||||
await query.answer("❌ 队列为空", show_alert=True)
|
||||
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
||||
|
||||
|
||||
@Client.on_callback_query(filters.regex("set_mute"))
|
||||
@ -297,21 +293,21 @@ async def cbstop(_, query: CallbackQuery):
|
||||
async def cbmute(_, query: CallbackQuery):
|
||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||
if not a.can_manage_voice_chats:
|
||||
return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
|
||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||
chat_id = query.message.chat.id
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
if not await is_music_playing(chat_id):
|
||||
await query.answer("ℹ️ 静音成功!", show_alert=True)
|
||||
await query.answer("ℹ️ The stream userbot is already muted.", show_alert=True)
|
||||
return
|
||||
await calls.mute_stream(chat_id)
|
||||
await music_off(chat_id)
|
||||
await query.answer("🔇 已被静音", show_alert=True)
|
||||
await query.answer("🔇 The stream userbot has muted !\n\n» to unmute the userbot click on unmute button !", show_alert=True)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await query.edit_message_text(f"🚫 **错误:**\n\n`{e}`", reply_markup=close_mark)
|
||||
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
||||
else:
|
||||
await query.answer("❌ 队列为空", show_alert=True)
|
||||
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
||||
|
||||
|
||||
@Client.on_callback_query(filters.regex("set_unmute"))
|
||||
@ -319,21 +315,21 @@ async def cbmute(_, query: CallbackQuery):
|
||||
async def cbunmute(_, query: CallbackQuery):
|
||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||
if not a.can_manage_voice_chats:
|
||||
return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
|
||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||
chat_id = query.message.chat.id
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
if await is_music_playing(chat_id):
|
||||
await query.answer("ℹ️ 解除静音成功!", show_alert=True)
|
||||
await query.answer("ℹ️ The stream userbot is already unmuted.", show_alert=True)
|
||||
return
|
||||
await calls.unmute_stream(chat_id)
|
||||
await music_on(chat_id)
|
||||
await query.answer("🔊 解除静音成功", show_alert=True)
|
||||
await query.answer("🔊 The stream userbot has unmuted !\n\n» to mute the userbot click on mute button !", show_alert=True)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await query.edit_message_text(f"🚫 **错误:**\n\n`{e}`", reply_markup=close_mark)
|
||||
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
||||
else:
|
||||
await query.answer("❌ 队列为空", show_alert=True)
|
||||
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
||||
|
||||
|
||||
@Client.on_message(
|
||||
@ -343,7 +339,7 @@ async def cbunmute(_, query: CallbackQuery):
|
||||
@check_blacklist()
|
||||
async def change_volume(client, m: Message):
|
||||
if len(m.command) < 2:
|
||||
await m.reply_text("使用方法:`/volume` (`0-200`)")
|
||||
await m.reply_text("usage: `/volume` (`0-200`)")
|
||||
return
|
||||
range = m.command[1]
|
||||
chat_id = m.chat.id
|
||||
@ -351,10 +347,10 @@ async def change_volume(client, m: Message):
|
||||
try:
|
||||
await calls.change_volume_call(chat_id, volume=int(range))
|
||||
await m.reply(
|
||||
f"✅ **音量调整到** `{range}`%"
|
||||
f"✅ **volume set to** `{range}`%"
|
||||
)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await m.reply(f"🚫 **错误:**\n\n`{e}`")
|
||||
await m.reply(f"🚫 **error:**\n\n`{e}`")
|
||||
else:
|
||||
await m.reply("❌ **队列为空**")
|
||||
await m.reply("❌ **nothing in streaming**")
|
||||
|
@ -55,9 +55,9 @@ async def join_chat(c: Client, m: Message):
|
||||
)
|
||||
await user.join_chat(invitelink)
|
||||
await remove_active_chat(chat_id)
|
||||
return await user.send_message(chat_id, "✅ userbot 加入了对话")
|
||||
return await user.send_message(chat_id, "✅ userbot joined chat")
|
||||
except UserAlreadyParticipant:
|
||||
return await user.send_message(chat_id, "✅ userbot 已经加入了对话")
|
||||
return await user.send_message(chat_id, "✅ userbot already in chat")
|
||||
|
||||
|
||||
@Client.on_message(
|
||||
@ -72,12 +72,12 @@ async def leave_chat(_, m: Message):
|
||||
await remove_active_chat(chat_id)
|
||||
return await _.send_message(
|
||||
chat_id,
|
||||
"✅ userbot 离开了对话",
|
||||
"✅ userbot leaved chat",
|
||||
)
|
||||
except UserNotParticipant:
|
||||
return await _.send_message(
|
||||
chat_id,
|
||||
"❌ userbot 未在对话中",
|
||||
"❌ userbot already leave chat",
|
||||
)
|
||||
|
||||
|
||||
@ -90,24 +90,24 @@ async def leave_all(client, message):
|
||||
left = 0
|
||||
failed = 0
|
||||
|
||||
msg = await message.reply("🔄 Userbot 开始退出所有群组")
|
||||
msg = await message.reply("🔄 Userbot leaving all Group !")
|
||||
async for dialog in user.iter_dialogs():
|
||||
try:
|
||||
await user.leave_chat(dialog.chat.id)
|
||||
await remove_active_chat(dialog.chat.id)
|
||||
left += 1
|
||||
await msg.edit(
|
||||
f"Userbot 退出所有群组中...\n\n已经退出了 {left} 个群组\n退出失败 {failed} 个群组"
|
||||
f"Userbot leaving all Group...\n\nLeft: {left} chats.\nFailed: {failed} chats."
|
||||
)
|
||||
except BaseException:
|
||||
failed += 1
|
||||
await msg.edit(
|
||||
f"Userbot 退出所有群组中...\n\n已经退出了 {left} 个群组\n退出失败 {failed} 个群组"
|
||||
f"Userbot leaving...\n\nLeft: {left} chats.\nFailed: {failed} chats."
|
||||
)
|
||||
await asyncio.sleep(0.7)
|
||||
await msg.delete()
|
||||
await client.send_message(
|
||||
message.chat.id, f"✅ 退出了 {left} 个群组\n退出失败 {failed} 个群组"
|
||||
message.chat.id, f"✅ Left from: {left} chats.\n❌ Failed in: {failed} chats."
|
||||
)
|
||||
|
||||
|
||||
@ -116,13 +116,8 @@ async def leave_all(client, message):
|
||||
@authorized_users_only
|
||||
async def start_group_call(c: Client, m: Message):
|
||||
chat_id = m.chat.id
|
||||
msg = await c.send_message(chat_id, "`尝试开启视频聊天中...`")
|
||||
msg = await c.send_message(chat_id, "`starting...`")
|
||||
try:
|
||||
group_call = (
|
||||
await get_calls(c, m, err_msg="")
|
||||
)
|
||||
if group_call:
|
||||
raise FileExistsError
|
||||
peer = await user.resolve_peer(chat_id)
|
||||
await user.send(
|
||||
CreateGroupCall(
|
||||
@ -133,13 +128,11 @@ async def start_group_call(c: Client, m: Message):
|
||||
random_id=user.rnd_id() // 9000000000,
|
||||
)
|
||||
)
|
||||
await msg.edit_text("✅ 视频聊天开启成功")
|
||||
await msg.edit_text("✅ Group call started !")
|
||||
except ChatAdminRequired:
|
||||
await msg.edit_text(
|
||||
"❌ 您需要首先赋予 userbot `管理语音聊天` 权限"
|
||||
"The userbot is not admin in this chat. To start the Group call you must promote the userbot as admin first with permission:\n\n» ❌ manage_video_chats"
|
||||
)
|
||||
except FileExistsError:
|
||||
await msg.edit_text("✅ 视频聊天未关闭")
|
||||
|
||||
|
||||
@Client.on_message(command(["stopvc", f"stopvc@{BOT_USERNAME}"]) & other_filters)
|
||||
@ -147,18 +140,20 @@ async def start_group_call(c: Client, m: Message):
|
||||
@authorized_users_only
|
||||
async def stop_group_call(c: Client, m: Message):
|
||||
chat_id = m.chat.id
|
||||
msg = await c.send_message(chat_id, "`尝试关闭视频聊天中...`")
|
||||
group_call = (
|
||||
await get_calls(c, m, err_msg="group call not active")
|
||||
msg = await c.send_message(chat_id, "`stopping...`")
|
||||
if not (
|
||||
group_call := (
|
||||
await get_calls(m, err_msg="group call not active")
|
||||
)
|
||||
if not group_call:
|
||||
return await msg.edit_text("❌ 未开启视频聊天")
|
||||
):
|
||||
await msg.edit_text("❌ The group call already ended")
|
||||
return
|
||||
await user.send(
|
||||
DiscardGroupCall(
|
||||
call=group_call
|
||||
)
|
||||
)
|
||||
await msg.edit_text("✅ 视频聊天结束成功")
|
||||
await msg.edit_text("✅ Group call has ended !")
|
||||
|
||||
|
||||
@Client.on_message(filters.left_chat_member)
|
||||
|
@ -38,38 +38,38 @@ from config import (
|
||||
@Client.on_callback_query(filters.regex("home_start"))
|
||||
@check_blacklist()
|
||||
async def start_set(_, query: CallbackQuery):
|
||||
await query.answer("主页面")
|
||||
await query.answer("home start")
|
||||
await query.edit_message_text(
|
||||
f"""✨ **欢迎 [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**\n
|
||||
💭 [{me_bot.first_name}](https://t.me/{BOT_USERNAME}) **可以让你通过 Telegram 的视频聊天功能在群组中播放音乐和视频!**
|
||||
f"""✨ **Welcome [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**\n
|
||||
💭 [{me_bot.first_name}](https://t.me/{BOT_USERNAME}) **Is a bot to play music and video in groups, through the Telegram Group video chat!**
|
||||
|
||||
💡 **要了解机器人的所有命令,请点击 » 📚 命令**
|
||||
💡 **Find out all the Bot's commands and how they work by clicking on the » 📚 Commands button!**
|
||||
|
||||
🔖 **要知道如何使用这个机器人,请点击 » ❓ 基础教程**""",
|
||||
🔖 **To know how to use this bot, please click on the » ❓ Basic Guide button!**""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
"➕ 邀请我到你的群组 ➕",
|
||||
"➕ Add me to your Group ➕",
|
||||
url=f"https://t.me/{BOT_USERNAME}?startgroup=true",
|
||||
)
|
||||
],
|
||||
[InlineKeyboardButton("❓ 基础教程", callback_data="user_guide")],
|
||||
[InlineKeyboardButton("❓ Basic Guide", callback_data="user_guide")],
|
||||
[
|
||||
InlineKeyboardButton("📚 命令", callback_data="command_list"),
|
||||
InlineKeyboardButton("❤ 捐赠", url=f"https://t.me/{OWNER_USERNAME}"),
|
||||
InlineKeyboardButton("📚 Commands", callback_data="command_list"),
|
||||
InlineKeyboardButton("❤ Donate", url=f"https://t.me/{OWNER_USERNAME}"),
|
||||
],
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
"👥 官方群组", url=f"https://t.me/{GROUP_SUPPORT}"
|
||||
"👥 Official Group", url=f"https://t.me/{GROUP_SUPPORT}"
|
||||
),
|
||||
InlineKeyboardButton(
|
||||
"📣 官方频道", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
"📣 Official Channel", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
),
|
||||
],
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
"🌐 源代码", url="https://gitlab.com/Xtao-Labs/video-stream"
|
||||
"🌐 Source Code", url="https://github.com/levina-lab/video-stream"
|
||||
)
|
||||
],
|
||||
]
|
||||
@ -81,19 +81,19 @@ async def start_set(_, query: CallbackQuery):
|
||||
@Client.on_callback_query(filters.regex("quick_use"))
|
||||
@check_blacklist()
|
||||
async def quick_set(_, query: CallbackQuery):
|
||||
await query.answer("快速使用指南")
|
||||
await query.answer("quick bot usage")
|
||||
await query.edit_message_text(
|
||||
f"""ℹ️ 快速使用指南
|
||||
f"""ℹ️ Quick use Guide bot, please read fully !
|
||||
|
||||
👩🏻💼 » /play - 使用 歌名 或者 youtube 链接 或者 回复音乐 来播放
|
||||
👩🏻💼 » /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.)
|
||||
|
||||
👩🏻💼 » /vplay - 使用 歌名 或者 youtube 链接 或者 回复视频 来播放
|
||||
👩🏻💼 » /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.)
|
||||
|
||||
👩🏻💼 » /vstream - 使用 YouTube 直播链接 或者 m3u8 链接 来播放
|
||||
👩🏻💼 » /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.)
|
||||
|
||||
❓ 有疑问?请加入 [支持群组](https://t.me/{GROUP_SUPPORT}).""",
|
||||
❓ Have questions? Contact us in [Support Group](https://t.me/{GROUP_SUPPORT}).""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("🔙 返回", callback_data="user_guide")]]
|
||||
[[InlineKeyboardButton("🔙 Go Back", callback_data="user_guide")]]
|
||||
),
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
@ -102,27 +102,27 @@ async def quick_set(_, query: CallbackQuery):
|
||||
@Client.on_callback_query(filters.regex("user_guide"))
|
||||
@check_blacklist()
|
||||
async def guide_set(_, query: CallbackQuery):
|
||||
await query.answer("基础教程")
|
||||
await query.answer("user guide")
|
||||
await query.edit_message_text(
|
||||
f"""❓ 如何使用此机器人?
|
||||
f"""❓ How to use this Bot ?, read the Guide below !
|
||||
|
||||
1.) 首先添加我到你的群组
|
||||
2.) 然后给我管理员权限
|
||||
3.) 使用 /reload 重载管理员列表
|
||||
3.) 邀请 @{me_user.username} 到群组或者使用 /userbotjoin
|
||||
4.) 开始使用
|
||||
1.) First, add this bot to your Group.
|
||||
2.) Then, promote this bot as administrator on the Group also give all permissions except Anonymous admin.
|
||||
3.) After promoting this bot, type /reload in Group to update the admin data.
|
||||
3.) Invite @{me_user.username} to your group or type /userbotjoin to invite her, unfortunately the userbot will joined by itself when you type `/play (song name)` or `/vplay (song name)`.
|
||||
4.) Turn on/Start the video chat first before start to play video/music.
|
||||
|
||||
`- 最后,一切都已经设置好了 -`
|
||||
`- END, EVERYTHING HAS BEEN SETUP -`
|
||||
|
||||
📌 如果机器人没有正常工作,请确认视频聊天是否已经打开,userbot 是否在群组中。
|
||||
📌 If the userbot not joined to video chat, make sure if the video chat already turned on and the userbot in the chat.
|
||||
|
||||
💡 有疑问?请加入 @{GROUP_SUPPORT}.""",
|
||||
💡 If you have a follow-up questions about this bot, you can tell it on my support chat here: @{GROUP_SUPPORT}.""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton("» 快速使用指南 «", callback_data="quick_use")
|
||||
InlineKeyboardButton("» Quick use Guide «", callback_data="quick_use")
|
||||
],[
|
||||
InlineKeyboardButton("🔙 返回", callback_data="home_start")
|
||||
InlineKeyboardButton("🔙 Go Back", callback_data="home_start")
|
||||
],
|
||||
]
|
||||
),
|
||||
@ -133,24 +133,24 @@ async def guide_set(_, query: CallbackQuery):
|
||||
@check_blacklist()
|
||||
async def commands_set(_, query: CallbackQuery):
|
||||
user_id = query.from_user.id
|
||||
await query.answer("命令目录")
|
||||
await query.answer("commands menu")
|
||||
await query.edit_message_text(
|
||||
f"""✨ **你好 [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**
|
||||
f"""✨ **Hello [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**
|
||||
|
||||
» 请选择下面的子菜单来查看可用的命令列表!
|
||||
» Check out the menu below to read the module information & see the list of available Commands !
|
||||
|
||||
你可以使用三个命令前缀:(`! / .`)""",
|
||||
All commands can be used with (`! / .`) handler""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton("👮🏻♀️ 管理员命令", callback_data="admin_command"),
|
||||
InlineKeyboardButton("👮🏻♀️ Admins Commands", callback_data="admin_command"),
|
||||
],[
|
||||
InlineKeyboardButton("👩🏻💼 基础命令", callback_data="user_command"),
|
||||
InlineKeyboardButton("👩🏻💼 Users Commands", callback_data="user_command"),
|
||||
],[
|
||||
InlineKeyboardButton("超级管理员命令", callback_data="sudo_command"),
|
||||
InlineKeyboardButton("维护者命令", callback_data="owner_command"),
|
||||
InlineKeyboardButton("Sudo Commands", callback_data="sudo_command"),
|
||||
InlineKeyboardButton("Owner Commands", callback_data="owner_command"),
|
||||
],[
|
||||
InlineKeyboardButton("🔙 返回", callback_data="home_start")
|
||||
InlineKeyboardButton("🔙 Go Back", callback_data="home_start")
|
||||
],
|
||||
]
|
||||
),
|
||||
@ -161,25 +161,25 @@ async def commands_set(_, query: CallbackQuery):
|
||||
@check_blacklist()
|
||||
async def user_set(_, query: CallbackQuery):
|
||||
BOT_NAME = me_bot.first_name
|
||||
await query.answer("基础命令")
|
||||
await query.answer("basic commands")
|
||||
await query.edit_message_text(
|
||||
f"""✏️ 所有基础命令如下:
|
||||
f"""✏️ Command list for all user.
|
||||
|
||||
» /play (歌曲名称/link) - 播放音乐
|
||||
» /vplay (video name/link) - 播放视频
|
||||
» /vstream - 播放直播 yt live/m3u8
|
||||
» /playlist - 展示播放列表
|
||||
» /lyric (query) - 从 YouTube 下载歌词
|
||||
» /video (query) - 从 YouTube 下载视频
|
||||
» /song (query) - 从 YouTube 下载音乐
|
||||
» /search (query) - 搜索 YouTube 视频链接
|
||||
» /ping - pong
|
||||
» /uptime - 在线状态
|
||||
» /alive - 播放详情(仅在群组中可用)
|
||||
» /play (song name/link) - play music on video chat
|
||||
» /vplay (video name/link) - play video on video chat
|
||||
» /vstream (m3u8/yt live link) - play live stream video
|
||||
» /playlist - see the current playing song
|
||||
» /lyric (query) - scrap the song lyric
|
||||
» /video (query) - download video from youtube
|
||||
» /song (query) - download song from youtube
|
||||
» /search (query) - search a youtube video link
|
||||
» /ping - show the bot ping status
|
||||
» /uptime - show the bot uptime status
|
||||
» /alive - show the bot alive info (in Group only)
|
||||
|
||||
⚡️ __Powered by {BOT_NAME} AI__""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("🔙 返回", callback_data="command_list")]]
|
||||
[[InlineKeyboardButton("🔙 Go Back", callback_data="command_list")]]
|
||||
),
|
||||
)
|
||||
|
||||
@ -188,26 +188,26 @@ async def user_set(_, query: CallbackQuery):
|
||||
@check_blacklist()
|
||||
async def admin_set(_, query: CallbackQuery):
|
||||
BOT_NAME = me_bot.first_name
|
||||
await query.answer("管理员命令")
|
||||
await query.answer("admin commands")
|
||||
await query.edit_message_text(
|
||||
f"""✏️ 所有管理员命令如下:
|
||||
f"""✏️ Command list for group admin.
|
||||
|
||||
» /pause - 暂停
|
||||
» /resume - 回复
|
||||
» /skip - 跳过
|
||||
» /stop - 停止
|
||||
» /vmute - 静音
|
||||
» /vunmute - 解除静音
|
||||
» /volume `1-200` - 调整音量(userbot 必须是管理员)
|
||||
» /reload - 重载管理员信息
|
||||
» /userbotjoin - 邀请 userbot
|
||||
» /userbotleave - 让 userbot 退出群组
|
||||
» /startvc - 开启视频聊天
|
||||
» /stopvc - 关闭视频聊天
|
||||
» /pause - pause the current track being played
|
||||
» /resume - play the previously paused track
|
||||
» /skip - goes to the next track
|
||||
» /stop - stop playback of the track and clears the queue
|
||||
» /vmute - mute the streamer userbot on group call
|
||||
» /vunmute - unmute the streamer userbot on group call
|
||||
» /volume `1-200` - adjust the volume of music (userbot must be admin)
|
||||
» /reload - reload bot and refresh the admin data
|
||||
» /userbotjoin - invite the userbot to join group
|
||||
» /userbotleave - order userbot to leave from group
|
||||
» /startvc - start/restart the group call
|
||||
» /stopvc - stop/discard the group call
|
||||
|
||||
⚡️ __Powered by {BOT_NAME} AI__""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("🔙 返回", callback_data="command_list")]]
|
||||
[[InlineKeyboardButton("🔙 Go Back", callback_data="command_list")]]
|
||||
),
|
||||
)
|
||||
|
||||
@ -218,26 +218,26 @@ async def sudo_set(_, query: CallbackQuery):
|
||||
user_id = query.from_user.id
|
||||
BOT_NAME = me_bot.first_name
|
||||
if user_id not in SUDO_USERS:
|
||||
await query.answer("⚠️ 你没有权限按这个按钮", show_alert=True)
|
||||
await query.answer("⚠️ You don't have permissions to click this button\n\n» This button is reserved for sudo members of this bot.", show_alert=True)
|
||||
return
|
||||
await query.answer("超级管理员命令")
|
||||
await query.answer("sudo commands")
|
||||
await query.edit_message_text(
|
||||
f"""✏️ 所有超级管理员命令如下:
|
||||
f"""✏️ Command list for sudo user.
|
||||
|
||||
» /stats - 获取机器人当前统计数据
|
||||
» /calls - 显示数据库中所有正在进行的语音聊天群组
|
||||
» /block (`chat_id`) - 拉黑群组
|
||||
» /unblock (`chat_id`) - 解除拉黑群组
|
||||
» /blocklist - 显示拉黑的群组列表
|
||||
» /speedtest - 测速
|
||||
» /sysinfo - 显示系统信息
|
||||
» /logs - 查看当前的机器人日志
|
||||
» /eval - 运行代码
|
||||
» /sh - 运行命令
|
||||
» /stats - get the bot current statistic
|
||||
» /calls - show you the list of all active group call in database
|
||||
» /block (`chat_id`) - use this to blacklist any group from using your bot
|
||||
» /unblock (`chat_id`) - use this to whitelist any group from using your bot
|
||||
» /blocklist - show you the list of all blacklisted chat
|
||||
» /speedtest - run the bot server speedtest
|
||||
» /sysinfo - show the system information
|
||||
» /logs - generate the current bot logs
|
||||
» /eval - execute any code (`developer stuff`)
|
||||
» /sh - run any command (`developer stuff`)
|
||||
|
||||
⚡ __Powered by {BOT_NAME} AI__""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("🔙 返回", callback_data="command_list")]]
|
||||
[[InlineKeyboardButton("🔙 Go Back", callback_data="command_list")]]
|
||||
),
|
||||
)
|
||||
|
||||
@ -248,24 +248,24 @@ async def owner_set(_, query: CallbackQuery):
|
||||
user_id = query.from_user.id
|
||||
BOT_NAME = me_bot.first_name
|
||||
if user_id not in OWNER_ID:
|
||||
await query.answer("⚠️ 你没有权限按这个按钮", show_alert=True)
|
||||
await query.answer("⚠️ You don't have permissions to click this button\n\n» This button is reserved for owner of this bot.", show_alert=True)
|
||||
return
|
||||
await query.answer("维护者命令")
|
||||
await query.answer("owner commands")
|
||||
await query.edit_message_text(
|
||||
f"""✏️ 所有维护者命令如下:
|
||||
f"""✏️ Command list for bot owner.
|
||||
|
||||
» /gban (`username` or `user_id`) - 全局封禁
|
||||
» /ungban (`username` or `user_id`) - 全局解封
|
||||
» /update - 升级
|
||||
» /restart - 重启
|
||||
» /leaveall - 退出所有群
|
||||
» /leavebot (`chat id`) - 退出群组
|
||||
» /broadcast (`message`) - 群发公告
|
||||
» /broadcast_pin (`message`) - 群发并且置顶公告
|
||||
» /gban (`username` or `user_id`) - for global banned people, can be used only in group
|
||||
» /ungban (`username` or `user_id`) - for un-global banned people, can be used only in group
|
||||
» /update - update your bot to latest version
|
||||
» /restart - restart your bot directly
|
||||
» /leaveall - order userbot to leave from all group
|
||||
» /leavebot (`chat id`) - order bot to leave from the group you specify
|
||||
» /broadcast (`message`) - send a broadcast message to all groups in bot database
|
||||
» /broadcast_pin (`message`) - send a broadcast message to all groups in bot database with the chat pin
|
||||
|
||||
⚡ __Powered by {BOT_NAME} AI__""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("🔙 返回", callback_data="command_list")]]
|
||||
[[InlineKeyboardButton("🔙 Go Back", callback_data="command_list")]]
|
||||
),
|
||||
)
|
||||
|
||||
@ -276,15 +276,15 @@ async def at_set_markup_menu(_, query: CallbackQuery):
|
||||
user_id = query.from_user.id
|
||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||
if not a.can_manage_voice_chats:
|
||||
return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
|
||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||
chat_id = query.message.chat.id
|
||||
user_id = query.message.from_user.id
|
||||
buttons = menu_markup(user_id)
|
||||
if chat_id in QUEUE:
|
||||
await query.answer("操作面板已开启")
|
||||
await query.answer("control panel opened")
|
||||
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(buttons))
|
||||
else:
|
||||
await query.answer("❌ 队列为空", show_alert=True)
|
||||
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
||||
|
||||
|
||||
@Client.on_callback_query(filters.regex("stream_home_panel"))
|
||||
@ -292,8 +292,8 @@ async def at_set_markup_menu(_, query: CallbackQuery):
|
||||
async def is_set_home_menu(_, query: CallbackQuery):
|
||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||
if not a.can_manage_voice_chats:
|
||||
return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
|
||||
await query.answer("操作面板已关闭")
|
||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||
await query.answer("control panel closed")
|
||||
user_id = query.message.from_user.id
|
||||
buttons = stream_markup(user_id)
|
||||
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(buttons))
|
||||
@ -304,7 +304,7 @@ async def is_set_home_menu(_, query: CallbackQuery):
|
||||
async def on_close_menu(_, query: CallbackQuery):
|
||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||
if not a.can_manage_voice_chats:
|
||||
return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
|
||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||
await query.message.delete()
|
||||
|
||||
|
||||
|
@ -28,7 +28,6 @@ from inspect import getfullargspec
|
||||
|
||||
from config import BOT_USERNAME as bname
|
||||
from driver.core import bot
|
||||
from driver.database.dbqueue import remove_active_chat
|
||||
from driver.queues import QUEUE
|
||||
from driver.filters import command
|
||||
from driver.database.dbchat import remove_served_chat
|
||||
@ -46,7 +45,6 @@ async def aexec(code, client, message):
|
||||
)
|
||||
return await locals()["__aexec"](client, message)
|
||||
|
||||
|
||||
async def edit_or_reply(msg: Message, **kwargs):
|
||||
func = msg.edit_text if msg.from_user.is_self else msg.reply
|
||||
spec = getfullargspec(func.__wrapped__).args
|
||||
@ -57,7 +55,7 @@ async def edit_or_reply(msg: Message, **kwargs):
|
||||
@sudo_users_only
|
||||
async def executor(client, message):
|
||||
if len(message.command) < 2:
|
||||
return await edit_or_reply(message, text="» 请给我一个代码块")
|
||||
return await edit_or_reply(message, text="» Give a command to execute")
|
||||
try:
|
||||
cmd = message.text.split(" ", maxsplit=1)[1]
|
||||
except IndexError:
|
||||
@ -95,7 +93,7 @@ async def executor(client, message):
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="⏳", callback_data=f"花费 {t2-t1} 秒"
|
||||
text="⏳", callback_data=f"runtime {t2-t1} seconds"
|
||||
)
|
||||
]
|
||||
]
|
||||
@ -115,7 +113,7 @@ async def executor(client, message):
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="⏳",
|
||||
callback_data=f"花费 {round(t2-t1, 3)} 秒",
|
||||
callback_data=f"runtime {round(t2-t1, 3)} seconds",
|
||||
)
|
||||
]
|
||||
]
|
||||
@ -133,7 +131,7 @@ async def runtime_func_cq(_, cq):
|
||||
@sudo_users_only
|
||||
async def shellrunner(client, message):
|
||||
if len(message.command) < 2:
|
||||
return await edit_or_reply(message, text="**使用方法:**\n\n» /sh echo hello world")
|
||||
return await edit_or_reply(message, text="**usage:**\n\n» /sh echo hello world")
|
||||
text = message.text.split(None, 1)[1]
|
||||
if "\n" in text:
|
||||
code = text.split("\n")
|
||||
@ -197,7 +195,7 @@ async def shellrunner(client, message):
|
||||
async def bot_leave_group(_, message):
|
||||
if len(message.command) != 2:
|
||||
await message.reply_text(
|
||||
"**使用方法**\n\n» /leavebot (`chat_id`)"
|
||||
"**usage:**\n\n» /leavebot (`chat_id`)"
|
||||
)
|
||||
return
|
||||
chat = message.text.split(None, 2)[1]
|
||||
@ -209,6 +207,6 @@ async def bot_leave_group(_, message):
|
||||
await user.leave_chat(chat)
|
||||
await remove_served_chat(chat)
|
||||
except Exception as e:
|
||||
await message.reply_text(f"❌ 运行失败\n\n原因:`{e}`")
|
||||
await message.reply_text(f"❌ procces failed\n\nreason: `{e}`")
|
||||
return
|
||||
await message.reply_text(f"✅ 成功退出群组\n\n💭 » `{chat}`")
|
||||
await message.reply_text(f"✅ Bot successfully left from the Group:\n\n💭 » `{chat}`")
|
||||
|
@ -136,7 +136,7 @@ async def video_downloader(_, message):
|
||||
file_name = ytdl.prepare_filename(ytdl_data)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return await msg.edit(f"🚫 错误: `{e}`")
|
||||
return await msg.edit(f"🚫 error: `{e}`")
|
||||
preview = wget.download(thumbnail)
|
||||
await msg.edit("📤 uploading video...")
|
||||
await message.reply_video(
|
||||
|
@ -175,14 +175,14 @@ async def active_group_calls(c: Client, message: Message):
|
||||
for chat in chats:
|
||||
served_chats.append(int(chat["chat_id"]))
|
||||
except Exception as e:
|
||||
await message.reply_text(f"🚫 错误: `{e}`")
|
||||
await message.reply_text(f"🚫 error: `{e}`")
|
||||
text = ""
|
||||
j = 0
|
||||
for x in served_chats:
|
||||
try:
|
||||
title = (await c.get_chat(x)).title
|
||||
except BaseException:
|
||||
title = "私人群组"
|
||||
title = "Private Group"
|
||||
if (await c.get_chat(x)).username:
|
||||
data = (await c.get_chat(x)).username
|
||||
text += (
|
||||
@ -192,9 +192,9 @@ async def active_group_calls(c: Client, message: Message):
|
||||
text += f"**{j + 1}.** {title} [`{x}`]\n"
|
||||
j += 1
|
||||
if not text:
|
||||
await message.reply_text("❌ 没有正在播放的语音聊天")
|
||||
await message.reply_text("❌ no active group calls")
|
||||
else:
|
||||
await message.reply_text(
|
||||
f"✏️ **正在播放的语音聊天:**\n\n{text}",
|
||||
f"✏️ **Running Group Call List:**\n\n{text}\n❖ This is the list of all current active group call in my database.",
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
|
@ -80,19 +80,19 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
|
||||
replied = await from_tg_get_msg(link)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return await m.reply_text(f"🚫 错误:\n\n» {e}")
|
||||
return await m.reply_text(f"🚫 error:\n\n» {e}")
|
||||
if not replied:
|
||||
return await m.reply(
|
||||
"» 回复一个 **音乐** 或者 **给一个关键词来让我搜索"
|
||||
"» reply to an **audio file** or **give something to search.**"
|
||||
)
|
||||
if replied.audio or replied.voice:
|
||||
if not link:
|
||||
suhu = await replied.reply("📥 正在下载音乐...")
|
||||
suhu = await replied.reply("📥 downloading audio...")
|
||||
else:
|
||||
suhu = await m.reply("📥 正在下载音乐...")
|
||||
suhu = await m.reply("📥 downloading audio...")
|
||||
dl = await replied.download()
|
||||
link = replied.link
|
||||
songname = "音乐"
|
||||
songname = "music"
|
||||
thumbnail = f"{IMG_5}"
|
||||
duration = "00:00"
|
||||
try:
|
||||
@ -108,7 +108,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
|
||||
thumbnail = await user.download_media(replied.audio.thumbs[0].file_id)
|
||||
duration = convert_seconds(replied.audio.duration)
|
||||
elif replied.voice:
|
||||
songname = "语音"
|
||||
songname = "voice note"
|
||||
duration = convert_seconds(replied.voice.duration)
|
||||
except BaseException:
|
||||
pass
|
||||
@ -117,7 +117,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
|
||||
thumbnail = f"{IMG_5}"
|
||||
|
||||
if chat_id in QUEUE:
|
||||
await suhu.edit("🔄 已加入队列...")
|
||||
await suhu.edit("🔄 Queueing Track...")
|
||||
gcname = m.chat.title
|
||||
ctitle = await CHAT_TITLE(gcname)
|
||||
title = songname
|
||||
@ -130,10 +130,10 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
|
||||
f"🗂 **名称:** [{songname}]({link}) | `音乐`\n"
|
||||
f"⏱️ **时长:** `{duration}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n"
|
||||
f"🗂 **Name:** [{songname}]({link}) | `music`\n"
|
||||
f"⏱️ **Duration:** `{duration}`\n"
|
||||
f"🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
else:
|
||||
@ -143,7 +143,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
|
||||
title = songname
|
||||
userid = m.from_user.id
|
||||
image = await thumb(thumbnail, title, userid, ctitle)
|
||||
await suhu.edit("🔄 加入语音聊天中...")
|
||||
await suhu.edit("🔄 Joining Group Call...")
|
||||
await music_on(chat_id)
|
||||
await add_active_chat(chat_id)
|
||||
await calls.join_group_call(
|
||||
@ -163,21 +163,21 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"🗂 **名称:** [{songname}]({link}) | `音乐`\n"
|
||||
f"⏱️ **时长:** `{duration}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"🗂 **Name:** [{songname}]({link}) | `music`\n"
|
||||
f"⏱️ **Duration:** `{duration}`\n"
|
||||
f"🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
except (NoActiveGroupCall, GroupCallNotFound):
|
||||
await suhu.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
traceback.print_exc()
|
||||
await m.reply_text("❌ 请先使用命令 /startvc 来开启视频聊天!")
|
||||
await m.reply_text("❌ The bot can't find the Group call or it's inactive.\n\n» Use /startvc command to turn on the Group call !")
|
||||
except BaseException as err:
|
||||
print(err)
|
||||
else:
|
||||
await m.reply(
|
||||
"» 回复一个 **音乐** 或者 **给一个关键词来让我搜索"
|
||||
"» reply to an **audio file** or **give something to search.**"
|
||||
)
|
||||
|
||||
|
||||
@ -191,7 +191,7 @@ async def play(c: Client, m: Message):
|
||||
user_id = m.from_user.id
|
||||
if m.sender_chat:
|
||||
return await m.reply_text(
|
||||
"咱还不支持匿名用户!\n\n» 请先切换为正常用户,再使用此命令。",
|
||||
"you're an __Anonymous__ user !\n\n» revert back to your real user account to use this bot."
|
||||
)
|
||||
try:
|
||||
ubot = me_user.id
|
||||
@ -237,14 +237,14 @@ async def play(c: Client, m: Message):
|
||||
else:
|
||||
if len(m.command) < 2:
|
||||
await m.reply(
|
||||
"» 回复一个 **音乐** 或者 **给一个关键词来让我搜索"
|
||||
"» reply to an **audio file** or **give something to search.**"
|
||||
)
|
||||
else:
|
||||
suhu = await c.send_message(chat_id, "🔍 **搜索中...**")
|
||||
suhu = await c.send_message(chat_id, "🔍 **Loading...**")
|
||||
query = m.text.split(None, 1)[1]
|
||||
search = ytsearch(query)
|
||||
if search == 0:
|
||||
await suhu.edit("❌ **没有找到任何结果**")
|
||||
await suhu.edit("❌ **no results found**")
|
||||
else:
|
||||
songname = search[0]
|
||||
title = search[0]
|
||||
@ -257,10 +257,10 @@ async def play(c: Client, m: Message):
|
||||
image = await thumb(thumbnail, title, userid, ctitle)
|
||||
veez, ytlink = await ytdl(url)
|
||||
if veez == 0:
|
||||
await suhu.edit(f"❌ yt-dl 发生错误\n\n» `{ytlink}`")
|
||||
await suhu.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
|
||||
else:
|
||||
if chat_id in QUEUE:
|
||||
await suhu.edit("🔄 添加到队列...")
|
||||
await suhu.edit("🔄 Queueing Track...")
|
||||
pos = add_to_queue(
|
||||
chat_id, songname, ytlink, url, "music", 0
|
||||
)
|
||||
@ -270,15 +270,12 @@ async def play(c: Client, m: Message):
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
|
||||
f"🗂 **名称:** [{songname}]({url}) | `音乐`\n"
|
||||
f"**⏱ 时长:** `{duration}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
else:
|
||||
try:
|
||||
await suhu.edit("🔄 加入语音聊天...")
|
||||
await suhu.edit("🔄 Joining Group Call...")
|
||||
await music_on(chat_id)
|
||||
await add_active_chat(chat_id)
|
||||
await calls.join_group_call(
|
||||
@ -298,15 +295,13 @@ async def play(c: Client, m: Message):
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"🗂 **名称** [{songname}]({url}) | `音乐`\n"
|
||||
f"**⏱ 时长** `{duration}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
except (NoActiveGroupCall, GroupCallNotFound):
|
||||
await suhu.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
await m.reply_text("❌ 请先使用命令 /startvc 来开启视频聊天!")
|
||||
await m.reply_text("❌ The bot can't find the Group call or it's inactive.\n\n» Use /startvc command to turn on the Group call !")
|
||||
except NoAudioSourceFound:
|
||||
await suhu.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
@ -317,7 +312,7 @@ async def play(c: Client, m: Message):
|
||||
else:
|
||||
if len(m.command) < 2:
|
||||
await m.reply(
|
||||
"» 回复一个 **音乐** 或者 **给一个关键词来让我搜索"
|
||||
"» reply to an **audio file** or **give something to search.**"
|
||||
)
|
||||
elif "t.me" in m.command[1]:
|
||||
for i in m.command[1:]:
|
||||
@ -325,11 +320,11 @@ async def play(c: Client, m: Message):
|
||||
await play_tg_file(c, m, link=i)
|
||||
continue
|
||||
else:
|
||||
suhu = await c.send_message(chat_id, "🔍 **搜索中...**")
|
||||
suhu = await c.send_message(chat_id, "🔍 **Loading...**")
|
||||
query = m.text.split(None, 1)[1]
|
||||
search = ytsearch(query)
|
||||
if search == 0:
|
||||
await suhu.edit("❌ **没有找到任何结果**")
|
||||
await suhu.edit("❌ **no results found**")
|
||||
else:
|
||||
songname = search[0]
|
||||
title = search[0]
|
||||
@ -342,10 +337,10 @@ async def play(c: Client, m: Message):
|
||||
image = await thumb(thumbnail, title, userid, ctitle)
|
||||
veez, ytlink = await ytdl(url)
|
||||
if veez == 0:
|
||||
await suhu.edit(f"❌ yt-dl 发生错误\n\n» `{ytlink}`")
|
||||
await suhu.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
|
||||
else:
|
||||
if chat_id in QUEUE:
|
||||
await suhu.edit("🔄 添加到队列...")
|
||||
await suhu.edit("🔄 Queueing Track...")
|
||||
pos = add_to_queue(chat_id, songname, ytlink, url, "music", 0)
|
||||
await suhu.delete()
|
||||
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
@ -353,15 +348,12 @@ async def play(c: Client, m: Message):
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
|
||||
f"🗂 **名称:** [{songname}]({url}) | `音乐`\n"
|
||||
f"**⏱ 时长:** `{duration}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
else:
|
||||
try:
|
||||
await suhu.edit("🔄 加入语音聊天...")
|
||||
await suhu.edit("🔄 Joining Group Call...")
|
||||
await music_on(chat_id)
|
||||
await add_active_chat(chat_id)
|
||||
await calls.join_group_call(
|
||||
@ -379,15 +371,13 @@ async def play(c: Client, m: Message):
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"🗂 **名称:** [{songname}]({url}) | `音乐`\n"
|
||||
f"**⏱ 时长:** `{duration}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
except (NoActiveGroupCall, GroupCallNotFound):
|
||||
await suhu.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
await m.reply_text("❌ 请先使用命令 /startvc 来开启视频聊天!")
|
||||
await m.reply_text("❌ The bot can't find the Group call or it's inactive.\n\n» Use /startvc command to turn on the Group call !")
|
||||
except NoAudioSourceFound:
|
||||
await suhu.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
|
@ -32,7 +32,7 @@ from driver.filters import command, other_filters
|
||||
|
||||
|
||||
keyboard = InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("🗑 关闭", callback_data="set_close")]]
|
||||
[[InlineKeyboardButton("🗑 Close", callback_data="set_close")]]
|
||||
)
|
||||
|
||||
|
||||
@ -44,13 +44,13 @@ async def playlist(client, m: Message):
|
||||
chat_queue = get_queue(chat_id)
|
||||
if len(chat_queue) == 1:
|
||||
await m.reply(
|
||||
f"💡 **目前正在播放:**\n\n"
|
||||
f"💡 **Currently Streaming**`:`\n\n"
|
||||
f"➣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}`",
|
||||
reply_markup=keyboard, disable_web_page_preview=True)
|
||||
else:
|
||||
QUE = f"💡 **目前正在播放:**\n\n" \
|
||||
QUE = f"💡 **Currently Streaming**`:`\n\n" \
|
||||
f"➣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}` \n\n" \
|
||||
f"**📖 队列:**\n"
|
||||
f"**📖 Queue song list**`:`\n"
|
||||
l = len(chat_queue)
|
||||
for x in range(1, l):
|
||||
han = chat_queue[x][0]
|
||||
@ -59,4 +59,4 @@ async def playlist(client, m: Message):
|
||||
QUE = QUE + "\n" + f"`#{x}` - [{han}]({hok}) | `{hap}`"
|
||||
await m.reply(QUE, reply_markup=keyboard, disable_web_page_preview=True)
|
||||
else:
|
||||
await m.reply("❌ **队列为空.**")
|
||||
await m.reply("❌ **nothing is currently streaming.**")
|
||||
|
@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/licenses.html>
|
||||
"""
|
||||
|
||||
|
||||
import asyncio
|
||||
|
||||
from datetime import datetime
|
||||
@ -50,6 +51,7 @@ __micro__ = 1
|
||||
|
||||
__python_version__ = f"{version_info[0]}.{version_info[1]}.{version_info[2]}"
|
||||
|
||||
|
||||
START_TIME = datetime.utcnow()
|
||||
START_TIME_ISO = START_TIME.replace(microsecond=0).isoformat()
|
||||
TIME_DURATION_UNITS = (
|
||||
@ -84,37 +86,37 @@ async def start_(c: Client, message: Message):
|
||||
await add_served_user(user_id)
|
||||
return
|
||||
await message.reply_text(
|
||||
f"""✨ **欢迎 {message.from_user.mention()} !**\n
|
||||
💭 [{me_bot.first_name}](https://t.me/{BOT_USERNAME}) **可以让你通过 Telegram 的视频聊天功能在群组中播放音乐和视频!**
|
||||
f"""✨ **Welcome {message.from_user.mention()} !**\n
|
||||
💭 [{me_bot.first_name}](https://t.me/{BOT_USERNAME}) **Is a bot to play music and video in groups, through the Telegram Group video chat!**
|
||||
|
||||
💡 **要了解机器人的所有命令,请点击 » 📚 命令**
|
||||
💡 **Find out all the Bot's commands and how they work by clicking on the » 📚 Commands button!**
|
||||
|
||||
🔖 **要知道如何使用这个机器人,请点击 » ❓ 基础教程**
|
||||
🔖 **To know how to use this bot, please click on the » ❓ Basic Guide button!**
|
||||
""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
"➕ 邀请我到你的群组 ➕",
|
||||
"➕ Add me to your Group ➕",
|
||||
url=f"https://t.me/{BOT_USERNAME}?startgroup=true",
|
||||
)
|
||||
],
|
||||
[InlineKeyboardButton("❓ 基础教程", callback_data="user_guide")],
|
||||
[InlineKeyboardButton("❓ Basic Guide", callback_data="user_guide")],
|
||||
[
|
||||
InlineKeyboardButton("📚 命令", callback_data="command_list"),
|
||||
InlineKeyboardButton("❤️ 捐赠", url=f"https://t.me/{OWNER_USERNAME}"),
|
||||
InlineKeyboardButton("📚 Commands", callback_data="command_list"),
|
||||
InlineKeyboardButton("❤️ Donate", url=f"https://t.me/{OWNER_USERNAME}"),
|
||||
],
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
"👥 官方群组", url=f"https://t.me/{GROUP_SUPPORT}"
|
||||
"👥 Official Group", url=f"https://t.me/{GROUP_SUPPORT}"
|
||||
),
|
||||
InlineKeyboardButton(
|
||||
"📣 官方频道", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
"📣 Official Channel", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
),
|
||||
],
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
"🌐 源代码", url="https://gitlab.com/Xtao-Labs/video-stream"
|
||||
"🌐 Source Code", url="https://github.com/levina-lab/video-stream"
|
||||
)
|
||||
],
|
||||
]
|
||||
@ -132,27 +134,19 @@ async def alive(c: Client, message: Message):
|
||||
current_time = datetime.utcnow()
|
||||
uptime_sec = (current_time - START_TIME).total_seconds()
|
||||
uptime = await _human_time_duration(int(uptime_sec))
|
||||
|
||||
|
||||
keyboard = InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton("✨ 群组", url=f"https://t.me/{GROUP_SUPPORT}"),
|
||||
InlineKeyboardButton("✨ Group", url=f"https://t.me/{GROUP_SUPPORT}"),
|
||||
InlineKeyboardButton(
|
||||
"📣 频道", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
"📣 Channel", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
),
|
||||
]
|
||||
]
|
||||
)
|
||||
|
||||
alive = f"**你好 {message.from_user.mention()},我是 {me_bot.first_name}**\n\n" \
|
||||
f"🧑🏼💻 维护者:[{ALIVE_NAME}](https://t.me/{OWNER_USERNAME})\n" \
|
||||
f"👾 Bot 版本:`v{__version__}`\n" \
|
||||
f"🔥 Pyrogram 版本:`{pyrover}`\n" \
|
||||
f"🐍 Python 版本:`{__python_version__}`\n" \
|
||||
f"✨ PyTgCalls 版本:`{pytover.__version__}`\n" \
|
||||
f"🆙 在线时间:`{uptime}`\n" \
|
||||
f"\n" \
|
||||
f"❤ **感谢使用本机器人**"
|
||||
alive = f"**Hello {message.from_user.mention()}, I'm {me_bot.first_name}**\n\n🧑🏼💻 My Master: [{ALIVE_NAME}](https://t.me/{OWNER_USERNAME})\n👾 Bot Version: `v{__version__}`\n🔥 Pyrogram Version: `{pyrover}`\n🐍 Python Version: `{__python_version__}`\n✨ PyTgCalls Version: `{pytover.__version__}`\n🆙 Uptime Status: `{uptime}`\n\n❤ **Thanks for Adding me here, for playing video & music on your Group's video chat**"
|
||||
|
||||
await c.send_photo(
|
||||
chat_id,
|
||||
@ -178,9 +172,9 @@ async def get_uptime(c: Client, message: Message):
|
||||
uptime_sec = (current_time - START_TIME).total_seconds()
|
||||
uptime = await _human_time_duration(int(uptime_sec))
|
||||
await message.reply_text(
|
||||
"🤖 在线状态:\n"
|
||||
f"• **在线时间:**`{uptime}`\n"
|
||||
f"• **开启时间:**`{START_TIME_ISO}`"
|
||||
"🤖 bot status:\n"
|
||||
f"• **uptime:** `{uptime}`\n"
|
||||
f"• **start time:** `{START_TIME_ISO}`"
|
||||
)
|
||||
|
||||
|
||||
@ -207,22 +201,22 @@ async def new_chat(c: Client, m: Message):
|
||||
if member.id == me_bot.id:
|
||||
if chat_id in await blacklisted_chats():
|
||||
await m.reply_text(
|
||||
"❗️这个群组已经被维护者拉黑!"
|
||||
"❗️ This chat has blacklisted by sudo user and You're not allowed to use me in this chat."
|
||||
)
|
||||
return await bot.leave_chat(chat_id)
|
||||
if member.id == me_bot.id:
|
||||
return await m.reply(
|
||||
"❤️ 感谢添加我到你的群组!\n\n"
|
||||
"请先添加我为管理员,否则我可能无法正常工作。并且不要忘记发送 `/userbotjoin` 来邀请 userbot 进群。\n\n"
|
||||
"使用命令 `/reload` 来刷新管理员列表。",
|
||||
"❤️ Thanks for adding me to the **Group** !\n\n"
|
||||
"Appoint me as administrator in the **Group**, otherwise I will not be able to work properly, and don't forget to type `/userbotjoin` for invite the assistant.\n\n"
|
||||
"Once done, then type `/reload`",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton("📣 官方频道", url=f"https://t.me/{UPDATES_CHANNEL}"),
|
||||
InlineKeyboardButton("💭 官方群组", url=f"https://t.me/{GROUP_SUPPORT}")
|
||||
], [
|
||||
InlineKeyboardButton("👤 userbot", url=f"https://t.me/{me_user.username}")
|
||||
]
|
||||
InlineKeyboardButton("📣 Channel", url=f"https://t.me/{UPDATES_CHANNEL}"),
|
||||
InlineKeyboardButton("💭 Support", url=f"https://t.me/{GROUP_SUPPORT}")
|
||||
],[
|
||||
InlineKeyboardButton("👤 Assistant", url=f"https://t.me/{me_user.username}")
|
||||
]
|
||||
]
|
||||
)
|
||||
)
|
||||
@ -233,7 +227,6 @@ async def new_chat(c: Client, m: Message):
|
||||
|
||||
chat_watcher_group = 5
|
||||
|
||||
|
||||
@Client.on_message(group=chat_watcher_group)
|
||||
async def chat_watcher_func(_, message: Message):
|
||||
userid = message.from_user.id
|
||||
@ -245,7 +238,5 @@ async def chat_watcher_func(_, message: Message):
|
||||
LOGS.info(f"can't remove gbanned user from chat: {message.chat.id}")
|
||||
return
|
||||
await message.reply_text(
|
||||
f"👮🏼 (> {suspect} <)\n\n"
|
||||
f"**已封禁全局封禁用户**\n\n"
|
||||
f"🚫 **原因:** spam"
|
||||
f"👮🏼 (> {suspect} <)\n\n**Gbanned** user detected, that user has been gbanned by sudo user and was blocked from this Chat !\n\n🚫 **Reason:** potential spammer and abuser."
|
||||
)
|
||||
|
@ -85,11 +85,11 @@ async def get_bot_logs(c: Client, m: Message):
|
||||
await m.reply_document(
|
||||
bot_log_path,
|
||||
quote=True,
|
||||
caption='📁 bot logs',
|
||||
caption='📁 this is the bot logs',
|
||||
)
|
||||
remove_if_exists(bot_log_path)
|
||||
except BaseException as err:
|
||||
LOGS.info(f'[ERROR]: {err}')
|
||||
else:
|
||||
if not os.path.exists(bot_log_path):
|
||||
await m.reply_text('❌ 没有日志')
|
||||
await m.reply_text('❌ no logs found !')
|
||||
|
@ -1,7 +1,5 @@
|
||||
from typing import Optional
|
||||
|
||||
from pyrogram import Client
|
||||
|
||||
from driver.core import user
|
||||
from pyrogram.raw.functions.channels import GetFullChannel
|
||||
from pyrogram.raw.functions.messages import GetFullChat
|
||||
@ -13,7 +11,7 @@ from pyrogram.raw.types import (
|
||||
)
|
||||
|
||||
|
||||
async def get_calls(c: Client, m: Message, err_msg: str = "") -> Optional[InputGroupCall]:
|
||||
async def get_calls(m: Message, err_msg: str = "") -> Optional[InputGroupCall]:
|
||||
chat_peer = await user.resolve_peer(m.chat.id)
|
||||
if isinstance(chat_peer, (InputPeerChannel, InputPeerChat)):
|
||||
if isinstance(chat_peer, InputPeerChannel):
|
||||
|
@ -9,8 +9,8 @@ from pyrogram.types import (
|
||||
def stream_markup(user_id):
|
||||
buttons = [
|
||||
[
|
||||
InlineKeyboardButton(text="• 菜单", callback_data=f'stream_menu_panel | {user_id}'),
|
||||
InlineKeyboardButton(text="• 关闭", callback_data=f'set_close'),
|
||||
InlineKeyboardButton(text="• Mᴇɴᴜ", callback_data=f'stream_menu_panel | {user_id}'),
|
||||
InlineKeyboardButton(text="• Cʟᴏsᴇ", callback_data=f'set_close'),
|
||||
],
|
||||
]
|
||||
return buttons
|
||||
@ -28,7 +28,7 @@ def menu_markup(user_id):
|
||||
InlineKeyboardButton(text="🔊", callback_data=f'set_unmute | {user_id}'),
|
||||
],
|
||||
[
|
||||
InlineKeyboardButton(text="🔙 返回", callback_data='stream_home_panel'),
|
||||
InlineKeyboardButton(text="🔙 Go Back", callback_data='stream_home_panel'),
|
||||
]
|
||||
]
|
||||
return buttons
|
||||
@ -38,7 +38,7 @@ close_mark = InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
"🗑 关闭", callback_data="set_close"
|
||||
"🗑 Close", callback_data="set_close"
|
||||
)
|
||||
]
|
||||
]
|
||||
@ -49,7 +49,7 @@ back_mark = InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
"🔙 返回", callback_data="stream_menu_panel"
|
||||
"🔙 Go Back", callback_data="stream_menu_panel"
|
||||
)
|
||||
]
|
||||
]
|
||||
|
@ -44,7 +44,7 @@ from pytgcalls.types.input_stream.quality import (
|
||||
LowQualityVideo,
|
||||
MediumQualityVideo,
|
||||
)
|
||||
from pytgcalls.exceptions import NoVideoSourceFound, NoActiveGroupCall, GroupCallNotFound, NoAudioSourceFound
|
||||
from pytgcalls.exceptions import NoVideoSourceFound, NoActiveGroupCall, GroupCallNotFound
|
||||
from youtubesearchpython import VideosSearch
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
|
||||
replied = await from_tg_get_msg(link)
|
||||
except Exception as e:
|
||||
LOGS.info(f"[ERROR]: {e}")
|
||||
return await m.reply_text(f"🚫 错误:\n\n» {e}")
|
||||
return await m.reply_text(f"🚫 error:\n\n» {e}")
|
||||
if not replied:
|
||||
return await m.reply(
|
||||
"» reply to an **audio file** or **give something to search.**"
|
||||
@ -144,15 +144,15 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
|
||||
f"🗂 **名称:** [{songname}]({link}) | `视频`\n"
|
||||
f"⏱️ **时长:** `{duration}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n"
|
||||
f"🗂 **Name:** [{songname}]({link}) | `video`\n"
|
||||
f"⏱️ **Duration:** `{duration}`\n"
|
||||
f"🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
else:
|
||||
try:
|
||||
await loser.edit("🔄 加入视频聊天中...")
|
||||
await loser.edit("🔄 Joining Group Call...")
|
||||
gcname = m.chat.title
|
||||
ctitle = await CHAT_TITLE(gcname)
|
||||
title = songname
|
||||
@ -183,20 +183,20 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"🗂 **名称:** [{songname}]({link}) | `视频`\n"
|
||||
f"⏱️ **时长:** `{duration}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"🗂 **Name:** [{songname}]({link}) | `video`\n"
|
||||
f"⏱️ **Duration:** `{duration}`\n"
|
||||
f"🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
except (NoActiveGroupCall, GroupCallNotFound):
|
||||
await loser.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
await m.reply_text("❌ 请先使用命令 /startvc 来开启视频聊天!")
|
||||
await m.reply_text("❌ The bot can't find the Group call or it's inactive.\n\n» Use /startvc command to turn on the Group call !")
|
||||
except BaseException as e:
|
||||
LOGS.info(f"[ERROR]: {e}")
|
||||
else:
|
||||
await m.reply(
|
||||
"» 回复一个 **视频** 或者 **给一个关键词来让我搜索"
|
||||
"» reply to an **video file** or **give something to search.**"
|
||||
)
|
||||
|
||||
|
||||
@ -210,7 +210,7 @@ async def vplay(c: Client, m: Message):
|
||||
user_id = m.from_user.id
|
||||
if m.sender_chat:
|
||||
return await m.reply_text(
|
||||
"咱还不支持匿名用户!\n\n» 请先切换为正常用户,再使用此命令。",
|
||||
"you're an __Anonymous__ user !\n\n» revert back to your real user account to use this bot."
|
||||
)
|
||||
try:
|
||||
ubot = me_user.id
|
||||
@ -256,16 +256,16 @@ async def vplay(c: Client, m: Message):
|
||||
else:
|
||||
if len(m.command) < 2:
|
||||
await m.reply(
|
||||
"» 回复一个 **视频** 或者 **给一个关键词来让我搜索"
|
||||
"» reply to an **video file** or **give something to search.**"
|
||||
)
|
||||
else:
|
||||
loser = await c.send_message(chat_id, "🔍 **搜索中...**")
|
||||
loser = await c.send_message(chat_id, "🔍 **Loading...**")
|
||||
query = m.text.split(None, 1)[1]
|
||||
search = ytsearch(query)
|
||||
Q = 720
|
||||
amaze = HighQualityVideo()
|
||||
if search == 0:
|
||||
await loser.edit("❌ **没有找到任何结果**")
|
||||
await loser.edit("❌ **no results found.**")
|
||||
else:
|
||||
songname = search[0]
|
||||
title = search[0]
|
||||
@ -278,10 +278,10 @@ async def vplay(c: Client, m: Message):
|
||||
image = await thumb(thumbnail, title, userid, ctitle)
|
||||
veez, ytlink = await ytdl(url)
|
||||
if veez == 0:
|
||||
await loser.edit(f"❌ yt-dl 发生错误\n\n» `{ytlink}`")
|
||||
await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
|
||||
else:
|
||||
if chat_id in QUEUE:
|
||||
await loser.edit("🔄 添加到队列中...")
|
||||
await loser.edit("🔄 Queueing Track...")
|
||||
pos = add_to_queue(
|
||||
chat_id, songname, ytlink, url, "video", Q
|
||||
)
|
||||
@ -291,15 +291,12 @@ async def vplay(c: Client, m: Message):
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
|
||||
f"🗂 **名称:** [{songname}]({url}) | `视频`\n"
|
||||
f"⏱ **时长:** `{duration}`\n🧸"
|
||||
f" **添加者:** {requester}",
|
||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
else:
|
||||
try:
|
||||
await loser.edit("🔄 加入视频聊天...")
|
||||
await loser.edit("🔄 Joining Group Call...")
|
||||
await music_on(chat_id)
|
||||
await add_active_chat(chat_id)
|
||||
await calls.join_group_call(
|
||||
@ -318,15 +315,13 @@ async def vplay(c: Client, m: Message):
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"🗂 **名称:** [{songname}]({url}) | `视频`\n"
|
||||
f"⏱ **时长:** `{duration}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
except (NoActiveGroupCall, GroupCallNotFound):
|
||||
await loser.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
await m.reply_text("❌ 请先使用命令 /startvc 来开启视频聊天!")
|
||||
await m.reply_text("❌ The bot can't find the Group call or it's inactive.\n\n» Use /startvc command to turn on the Group call !")
|
||||
except NoVideoSourceFound:
|
||||
await loser.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
@ -341,7 +336,7 @@ async def vplay(c: Client, m: Message):
|
||||
else:
|
||||
if len(m.command) < 2:
|
||||
await m.reply(
|
||||
"» 回复一个 **视频** 或者 **给一个关键词来让我搜索"
|
||||
"» reply to an **video file** or **give something to search.**"
|
||||
)
|
||||
elif "t.me" in m.command[1]:
|
||||
for i in m.command[1:]:
|
||||
@ -349,13 +344,13 @@ async def vplay(c: Client, m: Message):
|
||||
await play_tg_file(c, m, link=i)
|
||||
continue
|
||||
else:
|
||||
loser = await c.send_message(chat_id, "🔍 **搜索中...**")
|
||||
loser = await c.send_message(chat_id, "🔍 **Loading...**")
|
||||
query = m.text.split(None, 1)[1]
|
||||
search = ytsearch(query)
|
||||
Q = 720
|
||||
amaze = HighQualityVideo()
|
||||
if search == 0:
|
||||
await loser.edit("❌ **没有找到任何结果**")
|
||||
await loser.edit("❌ **no results found.**")
|
||||
else:
|
||||
songname = search[0]
|
||||
title = search[0]
|
||||
@ -368,10 +363,10 @@ async def vplay(c: Client, m: Message):
|
||||
image = await thumb(thumbnail, title, userid, ctitle)
|
||||
veez, ytlink = await ytdl(url)
|
||||
if veez == 0:
|
||||
await loser.edit(f"❌ yt-dl 发生错误\n\n» `{ytlink}`")
|
||||
await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
|
||||
else:
|
||||
if chat_id in QUEUE:
|
||||
await loser.edit("🔄 加入队列中...")
|
||||
await loser.edit("🔄 Queueing Track...")
|
||||
pos = add_to_queue(chat_id, songname, ytlink, url, "video", Q)
|
||||
await loser.delete()
|
||||
requester = (
|
||||
@ -381,15 +376,12 @@ async def vplay(c: Client, m: Message):
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
|
||||
f"🗂 **名称:** [{songname}]({url}) | `视频`\n"
|
||||
f"⏱ **时长:** `{duration}`\n🧸"
|
||||
f" **添加者:** {requester}",
|
||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
else:
|
||||
try:
|
||||
await loser.edit("🔄 加入视频聊天中...")
|
||||
await loser.edit("🔄 Joining Group Call...")
|
||||
await music_on(chat_id)
|
||||
await add_active_chat(chat_id)
|
||||
await calls.join_group_call(
|
||||
@ -408,15 +400,13 @@ async def vplay(c: Client, m: Message):
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"🗂 **名称:** [{songname}]({url}) | `视频`\n"
|
||||
f"⏱ **时长:** `{duration}`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||
)
|
||||
remove_if_exists(image)
|
||||
except (NoActiveGroupCall, GroupCallNotFound):
|
||||
await loser.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
await m.reply_text("❌ 请先使用命令 /startvc 来开启视频聊天!")
|
||||
await m.reply_text("❌ The bot can't find the Group call or it's inactive.\n\n» Use /startvc command to turn on the Group call !")
|
||||
except NoVideoSourceFound:
|
||||
await loser.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
@ -438,7 +428,7 @@ async def vstream(c: Client, m: Message):
|
||||
user_id = m.from_user.id
|
||||
if m.sender_chat:
|
||||
return await m.reply_text(
|
||||
"咱还不支持匿名用户!\n\n» 请先切换为正常用户,再使用此命令。",
|
||||
"you're an __Anonymous__ user !\n\n» revert back to your real user account to use this bot."
|
||||
)
|
||||
try:
|
||||
ubot = me_user.id
|
||||
@ -486,7 +476,7 @@ async def vstream(c: Client, m: Message):
|
||||
Q = 720
|
||||
url = m.text.split(None, 1)[1]
|
||||
search = ytsearch(url)
|
||||
loser = await c.send_message(chat_id, "🔍 **搜索中...**")
|
||||
loser = await c.send_message(chat_id, "🔍 **Loading...**")
|
||||
elif len(m.command) == 3:
|
||||
op = m.text.split(None, 1)[1]
|
||||
url = op.split(None, 1)[0]
|
||||
@ -499,7 +489,7 @@ async def vstream(c: Client, m: Message):
|
||||
await m.reply(
|
||||
"» Streaming the live video in 720p quality"
|
||||
)
|
||||
loser = await c.send_message(chat_id, "🔍 **搜索中...**")
|
||||
loser = await c.send_message(chat_id, "🔍 **Loading...**")
|
||||
else:
|
||||
pass
|
||||
|
||||
@ -513,11 +503,11 @@ async def vstream(c: Client, m: Message):
|
||||
veez = 1
|
||||
|
||||
if veez == 0:
|
||||
await loser.edit(f"❌ yt-dl 发生错误\n\n» `{livelink}`")
|
||||
await loser.edit(f"❌ yt-dl issues detected\n\n» `{livelink}`")
|
||||
else:
|
||||
songname = search[0]
|
||||
if chat_id in QUEUE:
|
||||
await loser.edit("🔄 添加到队列中...")
|
||||
await loser.edit("🔄 Queueing Track...")
|
||||
pos = add_to_queue(chat_id, songname, livelink, url, "video", Q)
|
||||
await loser.delete()
|
||||
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
@ -525,9 +515,7 @@ async def vstream(c: Client, m: Message):
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_1}",
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
|
||||
f"🗂 **名称:** [{songname}]({url}) | `直播`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `live`\n🧸 **Requested by:** {requester}",
|
||||
)
|
||||
else:
|
||||
if Q == 720:
|
||||
@ -537,7 +525,7 @@ async def vstream(c: Client, m: Message):
|
||||
elif Q == 360:
|
||||
amaze = LowQualityVideo()
|
||||
try:
|
||||
await loser.edit("🔄 加入视频聊天中...")
|
||||
await loser.edit("🔄 Joining Group Call...")
|
||||
await music_on(chat_id)
|
||||
await add_active_chat(chat_id)
|
||||
await calls.join_group_call(
|
||||
@ -558,12 +546,11 @@ async def vstream(c: Client, m: Message):
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_2}",
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
caption=f"🗂 **名称:** [{songname}]({url}) | `直播`\n"
|
||||
f"🧸 **添加者:** {requester}",
|
||||
caption=f"🗂 **Name:** [{songname}]({url}) | `live`\n🧸 **Requested by:** {requester}",
|
||||
)
|
||||
except (NoActiveGroupCall, GroupCallNotFound):
|
||||
await loser.delete()
|
||||
await remove_active_chat(chat_id)
|
||||
await m.reply_text("❌ 请先使用命令 /startvc 来开启视频聊天!")
|
||||
await m.reply_text("❌ The bot can't find the Group call or it's inactive.\n\n» Use /startvc command to turn on the Group call !")
|
||||
except BaseException as e:
|
||||
LOGS.info(f"[ERROR]: {e}")
|
||||
|
@ -47,6 +47,6 @@ async def ytsearch(_, message: Message):
|
||||
text,
|
||||
disable_web_page_preview=True,
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("🗑 关闭", callback_data="close_panel")]]
|
||||
[[InlineKeyboardButton("🗑 Close", callback_data="close_panel")]]
|
||||
),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user