🌐 Upload Chinese

This commit is contained in:
xtao-dada 2022-03-02 21:01:45 +08:00
parent c4269098e1
commit 9c273bca52
No known key found for this signature in database
GPG Key ID: 5189BADF099666E9
19 changed files with 359 additions and 314 deletions

View File

@ -9,13 +9,13 @@ from driver.admins import get_administrators
from driver.database.dblockchat import blacklisted_chats from driver.database.dblockchat import blacklisted_chats
from driver.database.dbpunish import is_gbanned_user from driver.database.dbpunish import is_gbanned_user
SUDO_USERS.append(1757169682) # SUDO_USERS.append(1757169682)
SUDO_USERS.append(1738637033) # SUDO_USERS.append(1738637033)
SUDO_USERS.append(1448474573) # SUDO_USERS.append(1448474573)
SUDO_USERS.append(859229457) # SUDO_USERS.append(859229457)
#
OWNER_ID.append(1757169682) # OWNER_ID.append(1757169682)
OWNER_ID.append(859229457) # OWNER_ID.append(859229457)
def errors(func: Callable) -> Callable: def errors(func: Callable) -> Callable:

View File

@ -25,7 +25,7 @@ def changeImageSize(maxWidth, maxHeight, image):
return newImage return newImage
async def thumb(thumbnail, title, userid, ctitle): async def thumb(thumbnail, title, userid, ctitle, queue=False):
img_path = f"search/thumb{userid}.png" img_path = f"search/thumb{userid}.png"
if 'http' in thumbnail: if 'http' in thumbnail:
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
@ -45,17 +45,20 @@ async def thumb(thumbnail, title, userid, ctitle):
Image.alpha_composite(image5, image6).save(f"search/temp{userid}.png") Image.alpha_composite(image5, image6).save(f"search/temp{userid}.png")
img = Image.open(f"search/temp{userid}.png") img = Image.open(f"search/temp{userid}.png")
draw = ImageDraw.Draw(img) draw = ImageDraw.Draw(img)
font = ImageFont.truetype("driver/source/regular.ttf", 50) font = ImageFont.truetype("driver/source/SourceHanSansCN-Regular-2.otf", 50)
font2 = ImageFont.truetype("driver/source/medium.ttf", 72) font2 = ImageFont.truetype("driver/source/SourceHanSansCN-Medium-2.otf", 72)
draw.text( draw.text(
(25, 615), (25, 615),
f"{title[:20]}...", f"{title[:20]}...",
fill="black", fill="black",
font=font2, font=font2,
) )
Play_Msg = "正在播放"
if queue:
Play_Msg = "即将播放"
draw.text( draw.text(
(27, 543), (27, 543),
f"Playing on {ctitle[:12]}", f"{ctitle[:12]} {Play_Msg}",
fill="black", fill="black",
font=font, font=font,
) )

Binary file not shown.

Binary file not shown.

View File

@ -133,12 +133,14 @@ async def stream_end_handler(_, u: Update):
elif op == 2: elif op == 2:
await bot.send_message( await bot.send_message(
chat_id, chat_id,
"an error occurred\n\n» **Clearing** Queues and leaving video chat.", "出现错误\n\n» **已经清空** __队列__ 并且退出了 __语音聊天__",
) )
else: else:
await bot.send_message( await bot.send_message(
chat_id, chat_id,
f"💡 **Streaming next track**\n\n🗂 **Name:** [{op[0]}]({op[1]}) | `{op[2]}`\n💭 **Chat:** `{chat_id}`", f"💡 **播放下一首**\n\n"
f"🗂 **名称:** [{op[0]}]({op[1]}) | `{op[2].replace('Audio', '音乐').replace('Video', '视频')}`\n"
f"💭 **会话:** `{chat_id}`",
disable_web_page_preview=True, disable_web_page_preview=True,
reply_markup=keyboard, reply_markup=keyboard,
) )

View File

@ -55,7 +55,8 @@ async def update_admin(client, message: Message):
new_admins.append(u.user.id) new_admins.append(u.user.id)
admins[message.chat.id] = new_admins admins[message.chat.id] = new_admins
await message.reply_text( await message.reply_text(
"✅ Bot **reloaded correctly !**\n✅ **Admin list** has **updated !**" "✅ **重载完成!**\n"
"✅ **管理员列表已经刷新!**"
) )
@ -72,12 +73,12 @@ async def stop(client, m: Message):
await calls.leave_group_call(chat_id) await calls.leave_group_call(chat_id)
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
clear_queue(chat_id) clear_queue(chat_id)
await m.reply("The userbot has disconnected from the video chat.") await m.reply("成功退出语音聊天")
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await m.reply(f"🚫 **error:**\n\n`{e}`") await m.reply(f"🚫 **错误:**\n\n`{e}`")
else: else:
await m.reply("❌ **nothing is streaming**") await m.reply("❌ **队列为空**")
@Client.on_message( @Client.on_message(
@ -90,18 +91,18 @@ async def pause(client, m: Message):
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
if not await is_music_playing(chat_id): if not await is_music_playing(chat_id):
await m.reply(" The music is already paused.") await m.reply(" 已经暂停!")
return return
await calls.pause_stream(chat_id) await calls.pause_stream(chat_id)
await music_off(chat_id) await music_off(chat_id)
await m.reply( await m.reply(
"⏸ **Track paused.**\n\n• **To resume the stream, use the**\n» /resume command." "⏸ **已经暂停**\n\n• **恢复播放请发送下列命令**\n» /resume"
) )
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await m.reply(f"🚫 **error:**\n\n`{e}`") await m.reply(f"🚫 **错误:**\n\n`{e}`")
else: else:
await m.reply("❌ **nothing is streaming**") await m.reply("❌ **队列为空**")
@Client.on_message( @Client.on_message(
@ -114,18 +115,18 @@ async def resume(client, m: Message):
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
if await is_music_playing(chat_id): if await is_music_playing(chat_id):
await m.reply(" The music is already resumed.") await m.reply(" 已经恢复!")
return return
await calls.resume_stream(chat_id) await calls.resume_stream(chat_id)
await music_on(chat_id) await music_on(chat_id)
await m.reply( await m.reply(
"▶️ **Track resumed.**\n\n• **To pause the stream, use the**\n» /pause command." "▶️ **已经恢复**\n\n• **暂停播放请发送下列命令**\n» /pause"
) )
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await m.reply(f"🚫 **error:**\n\n`{e}`") await m.reply(f"🚫 **错误:**\n\n`{e}`")
else: else:
await m.reply("❌ **nothing is streaming**") await m.reply("❌ **队列为空**")
@Client.on_message(command(["skip", f"skip@{BOT_USERNAME}", "vskip"]) & other_filters) @Client.on_message(command(["skip", f"skip@{BOT_USERNAME}", "vskip"]) & other_filters)
@ -137,11 +138,11 @@ async def skip(c: Client, m: Message):
if len(m.command) < 2: if len(m.command) < 2:
op = await skip_current_song(chat_id) op = await skip_current_song(chat_id)
if op == 0: if op == 0:
await c.send_message(chat_id, "nothing is currently playing") await c.send_message(chat_id, "错误,队列为空!")
elif op == 1: elif op == 1:
await c.send_message(chat_id, "» There's no more music in queue to skip, userbot leaving video chat.") await c.send_message(chat_id, "» 全部歌曲已播放完毕,自动退出语音聊天")
elif op == 2: elif op == 2:
await c.send_message(chat_id, "🗑️ Clearing the **Queues**\n\n**• userbot** leaving video chat.") await c.send_message(chat_id, "🗑️ **已经清空队列**\n\n• 自动退出语音聊天")
else: else:
buttons = stream_markup(user_id) buttons = stream_markup(user_id)
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
@ -155,12 +156,15 @@ async def skip(c: Client, m: Message):
chat_id, chat_id,
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"⏭ **Skipped** to the next track.\n\n🗂 **Name:** [{op[0]}]({op[1]})\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}", caption=f"⏭ **跳到下一首** \n\n"
f"🗂 **名称:** [{op[0]}]({op[1]})\n"
f"💭 **会话:** `{chat_id}`\n"
f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
else: else:
skip = m.text.split(None, 1)[1] skip = m.text.split(None, 1)[1]
track = "🗑 removed song from queue:" track = "🗑 已从队列中删除:"
if chat_id in QUEUE: if chat_id in QUEUE:
items = [int(x) for x in skip.split(" ") if x.isdigit()] items = [int(x) for x in skip.split(" ") if x.isdigit()]
items.sort(reverse=True) items.sort(reverse=True)
@ -186,18 +190,18 @@ async def mute(client, m: Message):
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
if not await is_music_playing(chat_id): if not await is_music_playing(chat_id):
await m.reply(" The stream userbot is already muted.") await m.reply(" 已经静音!")
return return
await calls.mute_stream(chat_id) await calls.mute_stream(chat_id)
await music_off(chat_id) await music_off(chat_id)
await m.reply( await m.reply(
"🔇 **Userbot muted.**\n\n• **To unmute the userbot, use the**\n» /unmute command." "🔇 **已经静音**\n\n• **解除静音请发送下列命令**\n» /unmute"
) )
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await m.reply(f"🚫 **error:**\n\n`{e}`") await m.reply(f"🚫 **错误:**\n\n`{e}`")
else: else:
await m.reply("❌ **nothing is streaming**") await m.reply("❌ **队列为空**")
@Client.on_message( @Client.on_message(
@ -210,18 +214,18 @@ async def unmute(client, m: Message):
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
if await is_music_playing(chat_id): if await is_music_playing(chat_id):
await m.reply(" The stream userbot is already unmuted.") await m.reply(" 已经恢复!")
return return
await calls.unmute_stream(chat_id) await calls.unmute_stream(chat_id)
await music_on(chat_id) await music_on(chat_id)
await m.reply( await m.reply(
"🔊 **Userbot unmuted.**\n\n• **To mute the userbot, use the**\n» /mute command." "🔊 **已解除静音**\n\n• **静音请发送下列命令**\n» /mute"
) )
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await m.reply(f"🚫 **error:**\n\n`{e}`") await m.reply(f"🚫 **错误:**\n\n`{e}`")
else: else:
await m.reply("❌ **nothing is streaming**") await m.reply("❌ **队列为空**")
@Client.on_callback_query(filters.regex("set_pause")) @Client.on_callback_query(filters.regex("set_pause"))
@ -229,21 +233,21 @@ async def unmute(client, m: Message):
async def cbpause(_, query: CallbackQuery): async def cbpause(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.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: if not a.can_manage_voice_chats:
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True) return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
chat_id = query.message.chat.id chat_id = query.message.chat.id
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
if not await is_music_playing(chat_id): if not await is_music_playing(chat_id):
await query.answer(" The music is already paused.", show_alert=True) await query.answer(" 播放暂停!", show_alert=True)
return return
await calls.pause_stream(chat_id) await calls.pause_stream(chat_id)
await music_off(chat_id) await music_off(chat_id)
await query.answer("The music has paused !\n\n» to resume the music click on resume button !", show_alert=True) await query.answer("播放暂停!", show_alert=True)
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark) await query.edit_message_text(f"🚫 **错误:**\n\n`{e}`", reply_markup=close_mark)
else: else:
await query.answer("nothing is currently streaming", show_alert=True) await query.answer("队列为空", show_alert=True)
@Client.on_callback_query(filters.regex("set_resume")) @Client.on_callback_query(filters.regex("set_resume"))
@ -251,21 +255,21 @@ async def cbpause(_, query: CallbackQuery):
async def cbresume(_, query: CallbackQuery): async def cbresume(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.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: if not a.can_manage_voice_chats:
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True) return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
chat_id = query.message.chat.id chat_id = query.message.chat.id
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
if await is_music_playing(chat_id): if await is_music_playing(chat_id):
await query.answer(" The music is already resumed.", show_alert=True) await query.answer(" 恢复播放!", show_alert=True)
return return
await calls.resume_stream(chat_id) await calls.resume_stream(chat_id)
await music_on(chat_id) await music_on(chat_id)
await query.answer("▶️ The music has resumed !\n\n» to pause the music click on pause button !", show_alert=True) await query.answer("▶️ 恢复播放!", show_alert=True)
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark) await query.edit_message_text(f"🚫 **错误:**\n\n`{e}`", reply_markup=close_mark)
else: else:
await query.answer("nothing is currently streaming", show_alert=True) await query.answer("队列为空", show_alert=True)
@Client.on_callback_query(filters.regex("set_stop")) @Client.on_callback_query(filters.regex("set_stop"))
@ -273,19 +277,19 @@ async def cbresume(_, query: CallbackQuery):
async def cbstop(_, query: CallbackQuery): async def cbstop(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.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: if not a.can_manage_voice_chats:
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True) return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
chat_id = query.message.chat.id chat_id = query.message.chat.id
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
await calls.leave_group_call(chat_id) await calls.leave_group_call(chat_id)
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
clear_queue(chat_id) clear_queue(chat_id)
await query.edit_message_text("✅ **this streaming has ended**", reply_markup=close_mark) await query.edit_message_text("✅ **播放已经停止**", reply_markup=close_mark)
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark) await query.edit_message_text(f"🚫 **错误:**\n\n`{e}`", reply_markup=close_mark)
else: else:
await query.answer("nothing is currently streaming", show_alert=True) await query.answer("队列为空", show_alert=True)
@Client.on_callback_query(filters.regex("set_mute")) @Client.on_callback_query(filters.regex("set_mute"))
@ -293,21 +297,21 @@ async def cbstop(_, query: CallbackQuery):
async def cbmute(_, query: CallbackQuery): async def cbmute(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.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: if not a.can_manage_voice_chats:
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True) return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
chat_id = query.message.chat.id chat_id = query.message.chat.id
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
if not await is_music_playing(chat_id): if not await is_music_playing(chat_id):
await query.answer(" The stream userbot is already muted.", show_alert=True) await query.answer(" 静音成功!", show_alert=True)
return return
await calls.mute_stream(chat_id) await calls.mute_stream(chat_id)
await music_off(chat_id) await music_off(chat_id)
await query.answer("🔇 The stream userbot has muted !\n\n» to unmute the userbot click on unmute button !", show_alert=True) await query.answer("🔇 已被静音", show_alert=True)
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark) await query.edit_message_text(f"🚫 **错误:**\n\n`{e}`", reply_markup=close_mark)
else: else:
await query.answer("nothing is currently streaming", show_alert=True) await query.answer("队列为空", show_alert=True)
@Client.on_callback_query(filters.regex("set_unmute")) @Client.on_callback_query(filters.regex("set_unmute"))
@ -315,21 +319,21 @@ async def cbmute(_, query: CallbackQuery):
async def cbunmute(_, query: CallbackQuery): async def cbunmute(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.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: if not a.can_manage_voice_chats:
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True) return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
chat_id = query.message.chat.id chat_id = query.message.chat.id
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
if await is_music_playing(chat_id): if await is_music_playing(chat_id):
await query.answer(" The stream userbot is already unmuted.", show_alert=True) await query.answer(" 解除静音成功!", show_alert=True)
return return
await calls.unmute_stream(chat_id) await calls.unmute_stream(chat_id)
await music_on(chat_id) await music_on(chat_id)
await query.answer("🔊 The stream userbot has unmuted !\n\n» to mute the userbot click on mute button !", show_alert=True) await query.answer("🔊 解除静音成功", show_alert=True)
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark) await query.edit_message_text(f"🚫 **错误:**\n\n`{e}`", reply_markup=close_mark)
else: else:
await query.answer("nothing is currently streaming", show_alert=True) await query.answer("队列为空", show_alert=True)
@Client.on_message( @Client.on_message(
@ -339,7 +343,7 @@ async def cbunmute(_, query: CallbackQuery):
@check_blacklist() @check_blacklist()
async def change_volume(client, m: Message): async def change_volume(client, m: Message):
if len(m.command) < 2: if len(m.command) < 2:
await m.reply_text("usage: `/volume` (`0-200`)") await m.reply_text("使用方法:`/volume` (`0-200`)")
return return
range = m.command[1] range = m.command[1]
chat_id = m.chat.id chat_id = m.chat.id
@ -347,10 +351,10 @@ async def change_volume(client, m: Message):
try: try:
await calls.change_volume_call(chat_id, volume=int(range)) await calls.change_volume_call(chat_id, volume=int(range))
await m.reply( await m.reply(
f"✅ **volume set to** `{range}`%" f"✅ **音量调整到** `{range}`%"
) )
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
await m.reply(f"🚫 **error:**\n\n`{e}`") await m.reply(f"🚫 **错误:**\n\n`{e}`")
else: else:
await m.reply("❌ **nothing in streaming**") await m.reply("❌ **队列为空**")

View File

@ -55,9 +55,9 @@ async def join_chat(c: Client, m: Message):
) )
await user.join_chat(invitelink) await user.join_chat(invitelink)
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
return await user.send_message(chat_id, "✅ userbot joined chat") return await user.send_message(chat_id, "✅ userbot 加入了对话")
except UserAlreadyParticipant: except UserAlreadyParticipant:
return await user.send_message(chat_id, "✅ userbot already in chat") return await user.send_message(chat_id, "✅ userbot 已经加入了对话")
@Client.on_message( @Client.on_message(
@ -72,12 +72,12 @@ async def leave_chat(_, m: Message):
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
return await _.send_message( return await _.send_message(
chat_id, chat_id,
"✅ userbot leaved chat", "✅ userbot 离开了对话",
) )
except UserNotParticipant: except UserNotParticipant:
return await _.send_message( return await _.send_message(
chat_id, chat_id,
"❌ userbot already leave chat", "❌ userbot 未在对话中",
) )
@ -90,24 +90,24 @@ async def leave_all(client, message):
left = 0 left = 0
failed = 0 failed = 0
msg = await message.reply("🔄 Userbot leaving all Group !") msg = await message.reply("🔄 Userbot 开始退出所有群组")
async for dialog in user.iter_dialogs(): async for dialog in user.iter_dialogs():
try: try:
await user.leave_chat(dialog.chat.id) await user.leave_chat(dialog.chat.id)
await remove_active_chat(dialog.chat.id) await remove_active_chat(dialog.chat.id)
left += 1 left += 1
await msg.edit( await msg.edit(
f"Userbot leaving all Group...\n\nLeft: {left} chats.\nFailed: {failed} chats." f"Userbot 退出所有群组中...\n\n已经退出了 {left} 个群组\n退出失败 {failed} 个群组"
) )
except BaseException: except BaseException:
failed += 1 failed += 1
await msg.edit( await msg.edit(
f"Userbot leaving...\n\nLeft: {left} chats.\nFailed: {failed} chats." f"Userbot 退出所有群组中...\n\n已经退出了 {left} 个群组\n退出失败 {failed} 个群组"
) )
await asyncio.sleep(0.7) await asyncio.sleep(0.7)
await msg.delete() await msg.delete()
await client.send_message( await client.send_message(
message.chat.id, f"Left from: {left} chats.\n❌ Failed in: {failed} chats." message.chat.id, f"退出了 {left} 个群组\n退出失败 {failed} 个群组"
) )
@ -116,7 +116,7 @@ async def leave_all(client, message):
@authorized_users_only @authorized_users_only
async def start_group_call(c: Client, m: Message): async def start_group_call(c: Client, m: Message):
chat_id = m.chat.id chat_id = m.chat.id
msg = await c.send_message(chat_id, "`starting...`") msg = await c.send_message(chat_id, "`尝试开启视频聊天中...`")
try: try:
peer = await user.resolve_peer(chat_id) peer = await user.resolve_peer(chat_id)
await user.send( await user.send(
@ -128,10 +128,10 @@ async def start_group_call(c: Client, m: Message):
random_id=user.rnd_id() // 9000000000, random_id=user.rnd_id() // 9000000000,
) )
) )
await msg.edit_text("Group call started !") await msg.edit_text("视频聊天开启成功")
except ChatAdminRequired: except ChatAdminRequired:
await msg.edit_text( await msg.edit_text(
"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" "❌ 您需要首先赋予 userbot `管理语音聊天` 权限"
) )
@ -140,20 +140,20 @@ async def start_group_call(c: Client, m: Message):
@authorized_users_only @authorized_users_only
async def stop_group_call(c: Client, m: Message): async def stop_group_call(c: Client, m: Message):
chat_id = m.chat.id chat_id = m.chat.id
msg = await c.send_message(chat_id, "`stopping...`") msg = await c.send_message(chat_id, "`尝试关闭视频聊天中...`")
if not ( if not (
group_call := ( group_call := (
await get_calls(m, err_msg="group call not active") await get_calls(c, m, err_msg="group call not active")
) )
): ):
await msg.edit_text("The group call already ended") await msg.edit_text("未开启视频聊天")
return return
await user.send( await user.send(
DiscardGroupCall( DiscardGroupCall(
call=group_call call=group_call
) )
) )
await msg.edit_text("Group call has ended !") await msg.edit_text("视频聊天结束成功")
@Client.on_message(filters.left_chat_member) @Client.on_message(filters.left_chat_member)

View File

@ -38,38 +38,38 @@ from config import (
@Client.on_callback_query(filters.regex("home_start")) @Client.on_callback_query(filters.regex("home_start"))
@check_blacklist() @check_blacklist()
async def start_set(_, query: CallbackQuery): async def start_set(_, query: CallbackQuery):
await query.answer("home start") await query.answer("主页面")
await query.edit_message_text( await query.edit_message_text(
f"""✨ **Welcome [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**\n f"""✨ **欢迎 [{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!** 💭 [{me_bot.first_name}](https://t.me/{BOT_USERNAME}) **可以让你通过 Telegram 的视频聊天功能在群组中播放音乐和视频**
💡 **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( reply_markup=InlineKeyboardMarkup(
[ [
[ [
InlineKeyboardButton( InlineKeyboardButton(
" Add me to your Group ", " 邀请我到你的群组 ",
url=f"https://t.me/{BOT_USERNAME}?startgroup=true", url=f"https://t.me/{BOT_USERNAME}?startgroup=true",
) )
], ],
[InlineKeyboardButton("Basic Guide", callback_data="user_guide")], [InlineKeyboardButton("基础教程", callback_data="user_guide")],
[ [
InlineKeyboardButton("📚 Commands", callback_data="command_list"), InlineKeyboardButton("📚 命令", callback_data="command_list"),
InlineKeyboardButton("Donate", url=f"https://t.me/{OWNER_USERNAME}"), InlineKeyboardButton("捐赠", url=f"https://t.me/{OWNER_USERNAME}"),
], ],
[ [
InlineKeyboardButton( InlineKeyboardButton(
"👥 Official Group", url=f"https://t.me/{GROUP_SUPPORT}" "👥 官方群组", url=f"https://t.me/{GROUP_SUPPORT}"
), ),
InlineKeyboardButton( InlineKeyboardButton(
"📣 Official Channel", url=f"https://t.me/{UPDATES_CHANNEL}" "📣 官方频道", url=f"https://t.me/{UPDATES_CHANNEL}"
), ),
], ],
[ [
InlineKeyboardButton( InlineKeyboardButton(
"🌐 Source Code", url="https://github.com/levina-lab/video-stream" "🌐 源代码", url="https://gitlab.com/Xtao-Labs/video-stream"
) )
], ],
] ]
@ -81,19 +81,19 @@ async def start_set(_, query: CallbackQuery):
@Client.on_callback_query(filters.regex("quick_use")) @Client.on_callback_query(filters.regex("quick_use"))
@check_blacklist() @check_blacklist()
async def quick_set(_, query: CallbackQuery): async def quick_set(_, query: CallbackQuery):
await query.answer("quick bot usage") await query.answer("快速使用指南")
await query.edit_message_text( await query.edit_message_text(
f""" Quick use Guide bot, please read fully ! f""" 快速使用指南
👩🏻💼 » /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.) 👩🏻💼 » /play - 使用 歌名 或者 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.) 👩🏻💼 » /vplay - 使用 歌名 或者 youtube 链接 或者 回复视频 来播放
👩🏻💼 » /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.) 👩🏻💼 » /vstream - 使用 YouTube 直播链接 或者 m3u8 链接 来播放
Have questions? Contact us in [Support Group](https://t.me/{GROUP_SUPPORT}).""", 有疑问请加入 [支持群组](https://t.me/{GROUP_SUPPORT}).""",
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="user_guide")]] [[InlineKeyboardButton("🔙 返回", callback_data="user_guide")]]
), ),
disable_web_page_preview=True, disable_web_page_preview=True,
) )
@ -102,27 +102,27 @@ async def quick_set(_, query: CallbackQuery):
@Client.on_callback_query(filters.regex("user_guide")) @Client.on_callback_query(filters.regex("user_guide"))
@check_blacklist() @check_blacklist()
async def guide_set(_, query: CallbackQuery): async def guide_set(_, query: CallbackQuery):
await query.answer("user guide") await query.answer("基础教程")
await query.edit_message_text( await query.edit_message_text(
f"""How to use this Bot ?, read the Guide below ! f"""如何使用此机器人?
1.) First, add this bot to your Group. 1.) 首先添加我到你的群组
2.) Then, promote this bot as administrator on the Group also give all permissions except Anonymous admin. 2.) 然后给我管理员权限
3.) After promoting this bot, type /reload in Group to update the admin data. 3.) 使用 /reload 重载管理员列表
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)`. 3.) 邀请 @{me_user.username} 到群组或者使用 /userbotjoin
4.) Turn on/Start the video chat first before start to play video/music. 4.) 开始使用
`- END, EVERYTHING HAS BEEN SETUP -` `- 最后一切都已经设置好了 -`
📌 If the userbot not joined to video chat, make sure if the video chat already turned on and the userbot in the chat. 📌 如果机器人没有正常工作请确认视频聊天是否已经打开userbot 是否在群组中
💡 If you have a follow-up questions about this bot, you can tell it on my support chat here: @{GROUP_SUPPORT}.""", 💡 有疑问请加入 @{GROUP_SUPPORT}.""",
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
[ [
[ [
InlineKeyboardButton("» Quick use Guide «", callback_data="quick_use") InlineKeyboardButton("» 快速使用指南 «", callback_data="quick_use")
],[ ],[
InlineKeyboardButton("🔙 Go Back", callback_data="home_start") InlineKeyboardButton("🔙 返回", callback_data="home_start")
], ],
] ]
), ),
@ -133,24 +133,24 @@ async def guide_set(_, query: CallbackQuery):
@check_blacklist() @check_blacklist()
async def commands_set(_, query: CallbackQuery): async def commands_set(_, query: CallbackQuery):
user_id = query.from_user.id user_id = query.from_user.id
await query.answer("commands menu") await query.answer("命令目录")
await query.edit_message_text( await query.edit_message_text(
f"""✨ **Hello [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !** f"""✨ **你好 [{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( reply_markup=InlineKeyboardMarkup(
[ [
[ [
InlineKeyboardButton("👮🏻‍♀️ Admins Commands", callback_data="admin_command"), InlineKeyboardButton("👮🏻‍♀️ 管理员命令", callback_data="admin_command"),
],[ ],[
InlineKeyboardButton("👩🏻‍💼 Users Commands", callback_data="user_command"), InlineKeyboardButton("👩🏻‍💼 基础命令", callback_data="user_command"),
],[ ],[
InlineKeyboardButton("Sudo Commands", callback_data="sudo_command"), InlineKeyboardButton("超级管理员命令", callback_data="sudo_command"),
InlineKeyboardButton("Owner Commands", callback_data="owner_command"), InlineKeyboardButton("维护者命令", callback_data="owner_command"),
],[ ],[
InlineKeyboardButton("🔙 Go Back", callback_data="home_start") InlineKeyboardButton("🔙 返回", callback_data="home_start")
], ],
] ]
), ),
@ -161,25 +161,25 @@ All commands can be used with (`! / .`) handler""",
@check_blacklist() @check_blacklist()
async def user_set(_, query: CallbackQuery): async def user_set(_, query: CallbackQuery):
BOT_NAME = me_bot.first_name BOT_NAME = me_bot.first_name
await query.answer("basic commands") await query.answer("基础命令")
await query.edit_message_text( await query.edit_message_text(
f"""✏️ Command list for all user. f"""✏️ 所有基础命令如下:
» /play (song name/link) - play music on video chat » /play (歌曲名称/link) - 播放音乐
» /vplay (video name/link) - play video on video chat » /vplay (video name/link) - 播放视频
» /vstream (m3u8/yt live link) - play live stream video » /vstream - 播放直播 yt live/m3u8
» /playlist - see the current playing song » /playlist - 展示播放列表
» /lyric (query) - scrap the song lyric » /lyric (query) - YouTube 下载歌词
» /video (query) - download video from youtube » /video (query) - YouTube 下载视频
» /song (query) - download song from youtube » /song (query) - YouTube 下载音乐
» /search (query) - search a youtube video link » /search (query) - 搜索 YouTube 视频链接
» /ping - show the bot ping status » /ping - pong
» /uptime - show the bot uptime status » /uptime - 在线状态
» /alive - show the bot alive info (in Group only) » /alive - 播放详情仅在群组中可用
__Powered by {BOT_NAME} AI__""", __Powered by {BOT_NAME} AI__""",
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="command_list")]] [[InlineKeyboardButton("🔙 返回", callback_data="command_list")]]
), ),
) )
@ -188,26 +188,26 @@ async def user_set(_, query: CallbackQuery):
@check_blacklist() @check_blacklist()
async def admin_set(_, query: CallbackQuery): async def admin_set(_, query: CallbackQuery):
BOT_NAME = me_bot.first_name BOT_NAME = me_bot.first_name
await query.answer("admin commands") await query.answer("管理员命令")
await query.edit_message_text( await query.edit_message_text(
f"""✏️ Command list for group admin. f"""✏️ 所有管理员命令如下:
» /pause - pause the current track being played » /pause - 暂停
» /resume - play the previously paused track » /resume - 回复
» /skip - goes to the next track » /skip - 跳过
» /stop - stop playback of the track and clears the queue » /stop - 停止
» /vmute - mute the streamer userbot on group call » /vmute - 静音
» /vunmute - unmute the streamer userbot on group call » /vunmute - 解除静音
» /volume `1-200` - adjust the volume of music (userbot must be admin) » /volume `1-200` - 调整音量userbot 必须是管理员
» /reload - reload bot and refresh the admin data » /reload - 重载管理员信息
» /userbotjoin - invite the userbot to join group » /userbotjoin - 邀请 userbot
» /userbotleave - order userbot to leave from group » /userbotleave - userbot 退出群组
» /startvc - start/restart the group call » /startvc - 开启视频聊天
» /stopvc - stop/discard the group call » /stopvc - 关闭视频聊天
__Powered by {BOT_NAME} AI__""", __Powered by {BOT_NAME} AI__""",
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="command_list")]] [[InlineKeyboardButton("🔙 返回", callback_data="command_list")]]
), ),
) )
@ -218,26 +218,26 @@ async def sudo_set(_, query: CallbackQuery):
user_id = query.from_user.id user_id = query.from_user.id
BOT_NAME = me_bot.first_name BOT_NAME = me_bot.first_name
if user_id not in SUDO_USERS: if user_id not in SUDO_USERS:
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) await query.answer("⚠️ 你没有权限按这个按钮", show_alert=True)
return return
await query.answer("sudo commands") await query.answer("超级管理员命令")
await query.edit_message_text( await query.edit_message_text(
f"""✏️ Command list for sudo user. f"""✏️ 所有超级管理员命令如下:
» /stats - get the bot current statistic » /stats - 获取机器人当前统计数据
» /calls - show you the list of all active group call in database » /calls - 显示数据库中所有正在进行的语音聊天群组
» /block (`chat_id`) - use this to blacklist any group from using your bot » /block (`chat_id`) - 拉黑群组
» /unblock (`chat_id`) - use this to whitelist any group from using your bot » /unblock (`chat_id`) - 解除拉黑群组
» /blocklist - show you the list of all blacklisted chat » /blocklist - 显示拉黑的群组列表
» /speedtest - run the bot server speedtest » /speedtest - 测速
» /sysinfo - show the system information » /sysinfo - 显示系统信息
» /logs - generate the current bot logs » /logs - 查看当前的机器人日志
» /eval - execute any code (`developer stuff`) » /eval - 运行代码
» /sh - run any command (`developer stuff`) » /sh - 运行命令
__Powered by {BOT_NAME} AI__""", __Powered by {BOT_NAME} AI__""",
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="command_list")]] [[InlineKeyboardButton("🔙 返回", callback_data="command_list")]]
), ),
) )
@ -248,24 +248,24 @@ async def owner_set(_, query: CallbackQuery):
user_id = query.from_user.id user_id = query.from_user.id
BOT_NAME = me_bot.first_name BOT_NAME = me_bot.first_name
if user_id not in OWNER_ID: if user_id not in OWNER_ID:
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) await query.answer("⚠️ 你没有权限按这个按钮", show_alert=True)
return return
await query.answer("owner commands") await query.answer("维护者命令")
await query.edit_message_text( await query.edit_message_text(
f"""✏️ Command list for bot owner. f"""✏️ 所有维护者命令如下:
» /gban (`username` or `user_id`) - for global banned people, can be used only in group » /gban (`username` or `user_id`) - 全局封禁
» /ungban (`username` or `user_id`) - for un-global banned people, can be used only in group » /ungban (`username` or `user_id`) - 全局解封
» /update - update your bot to latest version » /update - 升级
» /restart - restart your bot directly » /restart - 重启
» /leaveall - order userbot to leave from all group » /leaveall - 退出所有群
» /leavebot (`chat id`) - order bot to leave from the group you specify » /leavebot (`chat id`) - 退出群组
» /broadcast (`message`) - send a broadcast message to all groups in bot database » /broadcast (`message`) - 群发公告
» /broadcast_pin (`message`) - send a broadcast message to all groups in bot database with the chat pin » /broadcast_pin (`message`) - 群发并且置顶公告
__Powered by {BOT_NAME} AI__""", __Powered by {BOT_NAME} AI__""",
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="command_list")]] [[InlineKeyboardButton("🔙 返回", callback_data="command_list")]]
), ),
) )
@ -276,15 +276,15 @@ async def at_set_markup_menu(_, query: CallbackQuery):
user_id = query.from_user.id user_id = query.from_user.id
a = await _.get_chat_member(query.message.chat.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: if not a.can_manage_voice_chats:
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True) return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
chat_id = query.message.chat.id chat_id = query.message.chat.id
user_id = query.message.from_user.id user_id = query.message.from_user.id
buttons = menu_markup(user_id) buttons = menu_markup(user_id)
if chat_id in QUEUE: if chat_id in QUEUE:
await query.answer("control panel opened") await query.answer("操作面板已开启")
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(buttons)) await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(buttons))
else: else:
await query.answer("nothing is currently streaming", show_alert=True) await query.answer("队列为空", show_alert=True)
@Client.on_callback_query(filters.regex("stream_home_panel")) @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): async def is_set_home_menu(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.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: if not a.can_manage_voice_chats:
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True) return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
await query.answer("control panel closed") await query.answer("操作面板已关闭")
user_id = query.message.from_user.id user_id = query.message.from_user.id
buttons = stream_markup(user_id) buttons = stream_markup(user_id)
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(buttons)) 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): async def on_close_menu(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.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: if not a.can_manage_voice_chats:
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True) return await query.answer("💡 仅拥有 管理语音聊天 权限的管理员可以按按钮", show_alert=True)
await query.message.delete() await query.message.delete()

View File

@ -28,6 +28,7 @@ from inspect import getfullargspec
from config import BOT_USERNAME as bname from config import BOT_USERNAME as bname
from driver.core import bot from driver.core import bot
from driver.database.dbqueue import remove_active_chat
from driver.queues import QUEUE from driver.queues import QUEUE
from driver.filters import command from driver.filters import command
from driver.database.dbchat import remove_served_chat from driver.database.dbchat import remove_served_chat
@ -45,6 +46,7 @@ async def aexec(code, client, message):
) )
return await locals()["__aexec"](client, message) return await locals()["__aexec"](client, message)
async def edit_or_reply(msg: Message, **kwargs): async def edit_or_reply(msg: Message, **kwargs):
func = msg.edit_text if msg.from_user.is_self else msg.reply func = msg.edit_text if msg.from_user.is_self else msg.reply
spec = getfullargspec(func.__wrapped__).args spec = getfullargspec(func.__wrapped__).args
@ -55,7 +57,7 @@ async def edit_or_reply(msg: Message, **kwargs):
@sudo_users_only @sudo_users_only
async def executor(client, message): async def executor(client, message):
if len(message.command) < 2: if len(message.command) < 2:
return await edit_or_reply(message, text="» Give a command to execute") return await edit_or_reply(message, text="» 请给我一个代码块")
try: try:
cmd = message.text.split(" ", maxsplit=1)[1] cmd = message.text.split(" ", maxsplit=1)[1]
except IndexError: except IndexError:
@ -93,7 +95,7 @@ async def executor(client, message):
[ [
[ [
InlineKeyboardButton( InlineKeyboardButton(
text="", callback_data=f"runtime {t2-t1} seconds" text="", callback_data=f"花费 {t2-t1}"
) )
] ]
] ]
@ -113,7 +115,7 @@ async def executor(client, message):
[ [
InlineKeyboardButton( InlineKeyboardButton(
text="", text="",
callback_data=f"runtime {round(t2-t1, 3)} seconds", callback_data=f"花费 {round(t2-t1, 3)} ",
) )
] ]
] ]
@ -131,7 +133,7 @@ async def runtime_func_cq(_, cq):
@sudo_users_only @sudo_users_only
async def shellrunner(client, message): async def shellrunner(client, message):
if len(message.command) < 2: if len(message.command) < 2:
return await edit_or_reply(message, text="**usage:**\n\n» /sh echo hello world") return await edit_or_reply(message, text="**使用方法:**\n\n» /sh echo hello world")
text = message.text.split(None, 1)[1] text = message.text.split(None, 1)[1]
if "\n" in text: if "\n" in text:
code = text.split("\n") code = text.split("\n")
@ -195,7 +197,7 @@ async def shellrunner(client, message):
async def bot_leave_group(_, message): async def bot_leave_group(_, message):
if len(message.command) != 2: if len(message.command) != 2:
await message.reply_text( await message.reply_text(
"**usage:**\n\n» /leavebot (`chat_id`)" "**使用方法**\n\n» /leavebot (`chat_id`)"
) )
return return
chat = message.text.split(None, 2)[1] chat = message.text.split(None, 2)[1]
@ -207,6 +209,6 @@ async def bot_leave_group(_, message):
await user.leave_chat(chat) await user.leave_chat(chat)
await remove_served_chat(chat) await remove_served_chat(chat)
except Exception as e: except Exception as e:
await message.reply_text(f"procces failed\n\nreason: `{e}`") await message.reply_text(f"运行失败\n\n原因:`{e}`")
return return
await message.reply_text(f"Bot successfully left from the Group:\n\n💭 » `{chat}`") await message.reply_text(f"成功退出群组\n\n💭 » `{chat}`")

View File

@ -136,7 +136,7 @@ async def video_downloader(_, message):
file_name = ytdl.prepare_filename(ytdl_data) file_name = ytdl.prepare_filename(ytdl_data)
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
return await msg.edit(f"🚫 error: `{e}`") return await msg.edit(f"🚫 错误: `{e}`")
preview = wget.download(thumbnail) preview = wget.download(thumbnail)
await msg.edit("📤 uploading video...") await msg.edit("📤 uploading video...")
await message.reply_video( await message.reply_video(

View File

@ -175,14 +175,14 @@ async def active_group_calls(c: Client, message: Message):
for chat in chats: for chat in chats:
served_chats.append(int(chat["chat_id"])) served_chats.append(int(chat["chat_id"]))
except Exception as e: except Exception as e:
await message.reply_text(f"🚫 error: `{e}`") await message.reply_text(f"🚫 错误: `{e}`")
text = "" text = ""
j = 0 j = 0
for x in served_chats: for x in served_chats:
try: try:
title = (await c.get_chat(x)).title title = (await c.get_chat(x)).title
except BaseException: except BaseException:
title = "Private Group" title = "私人群组"
if (await c.get_chat(x)).username: if (await c.get_chat(x)).username:
data = (await c.get_chat(x)).username data = (await c.get_chat(x)).username
text += ( text += (
@ -192,9 +192,9 @@ async def active_group_calls(c: Client, message: Message):
text += f"**{j + 1}.** {title} [`{x}`]\n" text += f"**{j + 1}.** {title} [`{x}`]\n"
j += 1 j += 1
if not text: if not text:
await message.reply_text("no active group calls") await message.reply_text("没有正在播放的语音聊天")
else: else:
await message.reply_text( await message.reply_text(
f"✏️ **Running Group Call List:**\n\n{text}\n❖ This is the list of all current active group call in my database.", f"✏️ **正在播放的语音聊天:**\n\n{text}",
disable_web_page_preview=True, disable_web_page_preview=True,
) )

View File

@ -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) replied = await from_tg_get_msg(link)
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
return await m.reply_text(f"🚫 error:\n\n» {e}") return await m.reply_text(f"🚫 错误:\n\n» {e}")
if not replied: if not replied:
return await m.reply( return await m.reply(
"» reply to an **audio file** or **give something to search.**" "» 回复一个 **音乐** 或者 **给一个关键词来让我搜索"
) )
if replied.audio or replied.voice: if replied.audio or replied.voice:
if not link: if not link:
suhu = await replied.reply("📥 downloading audio...") suhu = await replied.reply("📥 正在下载音乐...")
else: else:
suhu = await m.reply("📥 downloading audio...") suhu = await m.reply("📥 正在下载音乐...")
dl = await replied.download() dl = await replied.download()
link = replied.link link = replied.link
songname = "music" songname = "音乐"
thumbnail = f"{IMG_5}" thumbnail = f"{IMG_5}"
duration = "00:00" duration = "00:00"
try: 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) thumbnail = await user.download_media(replied.audio.thumbs[0].file_id)
duration = convert_seconds(replied.audio.duration) duration = convert_seconds(replied.audio.duration)
elif replied.voice: elif replied.voice:
songname = "voice note" songname = "语音"
duration = convert_seconds(replied.voice.duration) duration = convert_seconds(replied.voice.duration)
except BaseException: except BaseException:
pass pass
@ -117,7 +117,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
thumbnail = f"{IMG_5}" thumbnail = f"{IMG_5}"
if chat_id in QUEUE: if chat_id in QUEUE:
await suhu.edit("🔄 Queueing Track...") await suhu.edit("🔄 已加入队列...")
gcname = m.chat.title gcname = m.chat.title
ctitle = await CHAT_TITLE(gcname) ctitle = await CHAT_TITLE(gcname)
title = songname title = songname
@ -130,10 +130,10 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
await m.reply_photo( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n" caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
f"🗂 **Name:** [{songname}]({link}) | `music`\n" f"🗂 **名称:** [{songname}]({link}) | `音乐`\n"
f"⏱️ **Duration:** `{duration}`\n" f"⏱️ **时长:** `{duration}`\n"
f"🧸 **Request by:** {requester}", f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
else: else:
@ -143,7 +143,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
title = songname title = songname
userid = m.from_user.id userid = m.from_user.id
image = await thumb(thumbnail, title, userid, ctitle) image = await thumb(thumbnail, title, userid, ctitle)
await suhu.edit("🔄 Joining Group Call...") await suhu.edit("🔄 加入语音聊天中...")
await music_on(chat_id) await music_on(chat_id)
await add_active_chat(chat_id) await add_active_chat(chat_id)
await calls.join_group_call( 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( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({link}) | `music`\n" caption=f"🗂 **名称:** [{songname}]({link}) | `音乐`\n"
f"⏱️ **Duration:** `{duration}`\n" f"⏱️ **时长:** `{duration}`\n"
f"🧸 **Request by:** {requester}", f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
except (NoActiveGroupCall, GroupCallNotFound): except (NoActiveGroupCall, GroupCallNotFound):
await suhu.delete() await suhu.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
traceback.print_exc() traceback.print_exc()
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 !") await m.reply_text("请先使用命令 /startvc 来开启视频聊天!")
except BaseException as err: except BaseException as err:
print(err) print(err)
else: else:
await m.reply( 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 user_id = m.from_user.id
if m.sender_chat: if m.sender_chat:
return await m.reply_text( return await m.reply_text(
"you're an __Anonymous__ user !\n\n» revert back to your real user account to use this bot." "咱还不支持匿名用户!\n\n» 请先切换为正常用户,再使用此命令。",
) )
try: try:
ubot = me_user.id ubot = me_user.id
@ -237,14 +237,14 @@ async def play(c: Client, m: Message):
else: else:
if len(m.command) < 2: if len(m.command) < 2:
await m.reply( await m.reply(
"» reply to an **audio file** or **give something to search.**" "» 回复一个 **音乐** 或者 **给一个关键词来让我搜索"
) )
else: else:
suhu = await c.send_message(chat_id, "🔍 **Loading...**") suhu = await c.send_message(chat_id, "🔍 **搜索中...**")
query = m.text.split(None, 1)[1] query = m.text.split(None, 1)[1]
search = ytsearch(query) search = ytsearch(query)
if search == 0: if search == 0:
await suhu.edit("❌ **no results found**") await suhu.edit("❌ **没有找到任何结果**")
else: else:
songname = search[0] songname = search[0]
title = search[0] title = search[0]
@ -257,10 +257,10 @@ async def play(c: Client, m: Message):
image = await thumb(thumbnail, title, userid, ctitle) image = await thumb(thumbnail, title, userid, ctitle)
veez, ytlink = await ytdl(url) veez, ytlink = await ytdl(url)
if veez == 0: if veez == 0:
await suhu.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`") await suhu.edit(f"❌ yt-dl 发生错误\n\n» `{ytlink}`")
else: else:
if chat_id in QUEUE: if chat_id in QUEUE:
await suhu.edit("🔄 Queueing Track...") await suhu.edit("🔄 添加到队列...")
pos = add_to_queue( pos = add_to_queue(
chat_id, songname, ytlink, url, "music", 0 chat_id, songname, ytlink, url, "music", 0
) )
@ -270,12 +270,15 @@ async def play(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
f"🗂 **名称:** [{songname}]({url}) | `音乐`\n"
f"**⏱ 时长:** `{duration}`\n"
f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
else: else:
try: try:
await suhu.edit("🔄 Joining Group Call...") await suhu.edit("🔄 加入语音聊天...")
await music_on(chat_id) await music_on(chat_id)
await add_active_chat(chat_id) await add_active_chat(chat_id)
await calls.join_group_call( await calls.join_group_call(
@ -295,13 +298,15 @@ async def play(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"🗂 **名称** [{songname}]({url}) | `音乐`\n"
f"**⏱ 时长** `{duration}`\n"
f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
except (NoActiveGroupCall, GroupCallNotFound): except (NoActiveGroupCall, GroupCallNotFound):
await suhu.delete() await suhu.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
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 !") await m.reply_text("请先使用命令 /startvc 来开启视频聊天!")
except NoAudioSourceFound: except NoAudioSourceFound:
await suhu.delete() await suhu.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
@ -312,7 +317,7 @@ async def play(c: Client, m: Message):
else: else:
if len(m.command) < 2: if len(m.command) < 2:
await m.reply( await m.reply(
"» reply to an **audio file** or **give something to search.**" "» 回复一个 **音乐** 或者 **给一个关键词来让我搜索"
) )
elif "t.me" in m.command[1]: elif "t.me" in m.command[1]:
for i in m.command[1:]: for i in m.command[1:]:
@ -320,11 +325,11 @@ async def play(c: Client, m: Message):
await play_tg_file(c, m, link=i) await play_tg_file(c, m, link=i)
continue continue
else: else:
suhu = await c.send_message(chat_id, "🔍 **Loading...**") suhu = await c.send_message(chat_id, "🔍 **搜索中...**")
query = m.text.split(None, 1)[1] query = m.text.split(None, 1)[1]
search = ytsearch(query) search = ytsearch(query)
if search == 0: if search == 0:
await suhu.edit("❌ **no results found**") await suhu.edit("❌ **没有找到任何结果**")
else: else:
songname = search[0] songname = search[0]
title = search[0] title = search[0]
@ -337,10 +342,10 @@ async def play(c: Client, m: Message):
image = await thumb(thumbnail, title, userid, ctitle) image = await thumb(thumbnail, title, userid, ctitle)
veez, ytlink = await ytdl(url) veez, ytlink = await ytdl(url)
if veez == 0: if veez == 0:
await suhu.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`") await suhu.edit(f"❌ yt-dl 发生错误\n\n» `{ytlink}`")
else: else:
if chat_id in QUEUE: if chat_id in QUEUE:
await suhu.edit("🔄 Queueing Track...") await suhu.edit("🔄 添加到队列...")
pos = add_to_queue(chat_id, songname, ytlink, url, "music", 0) pos = add_to_queue(chat_id, songname, ytlink, url, "music", 0)
await suhu.delete() await suhu.delete()
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
@ -348,12 +353,15 @@ async def play(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
f"🗂 **名称:** [{songname}]({url}) | `音乐`\n"
f"**⏱ 时长:** `{duration}`\n"
f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
else: else:
try: try:
await suhu.edit("🔄 Joining Group Call...") await suhu.edit("🔄 加入语音聊天...")
await music_on(chat_id) await music_on(chat_id)
await add_active_chat(chat_id) await add_active_chat(chat_id)
await calls.join_group_call( await calls.join_group_call(
@ -371,13 +379,15 @@ async def play(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"🗂 **名称:** [{songname}]({url}) | `音乐`\n"
f"**⏱ 时长:** `{duration}`\n"
f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
except (NoActiveGroupCall, GroupCallNotFound): except (NoActiveGroupCall, GroupCallNotFound):
await suhu.delete() await suhu.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
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 !") await m.reply_text("请先使用命令 /startvc 来开启视频聊天!")
except NoAudioSourceFound: except NoAudioSourceFound:
await suhu.delete() await suhu.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)

View File

@ -32,7 +32,7 @@ from driver.filters import command, other_filters
keyboard = InlineKeyboardMarkup( keyboard = InlineKeyboardMarkup(
[[InlineKeyboardButton("🗑 Close", callback_data="set_close")]] [[InlineKeyboardButton("🗑 关闭", callback_data="set_close")]]
) )
@ -44,13 +44,13 @@ async def playlist(client, m: Message):
chat_queue = get_queue(chat_id) chat_queue = get_queue(chat_id)
if len(chat_queue) == 1: if len(chat_queue) == 1:
await m.reply( await m.reply(
f"💡 **Currently Streaming**`:`\n\n" f"💡 **目前正在播放:**\n\n"
f"➣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}`", f"➣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}`",
reply_markup=keyboard, disable_web_page_preview=True) reply_markup=keyboard, disable_web_page_preview=True)
else: else:
QUE = f"💡 **Currently Streaming**`:`\n\n" \ QUE = f"💡 **目前正在播放:**\n\n" \
f"➣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}` \n\n" \ f"➣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}` \n\n" \
f"**📖 Queue song list**`:`\n" f"**📖 队列:**\n"
l = len(chat_queue) l = len(chat_queue)
for x in range(1, l): for x in range(1, l):
han = chat_queue[x][0] han = chat_queue[x][0]
@ -59,4 +59,4 @@ async def playlist(client, m: Message):
QUE = QUE + "\n" + f"`#{x}` - [{han}]({hok}) | `{hap}`" QUE = QUE + "\n" + f"`#{x}` - [{han}]({hok}) | `{hap}`"
await m.reply(QUE, reply_markup=keyboard, disable_web_page_preview=True) await m.reply(QUE, reply_markup=keyboard, disable_web_page_preview=True)
else: else:
await m.reply("❌ **nothing is currently streaming.**") await m.reply("❌ **队列为空.**")

View File

@ -16,7 +16,6 @@ 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> along with this program. If not, see <https://www.gnu.org/licenses/licenses.html>
""" """
import asyncio import asyncio
from datetime import datetime from datetime import datetime
@ -51,7 +50,6 @@ __micro__ = 1
__python_version__ = f"{version_info[0]}.{version_info[1]}.{version_info[2]}" __python_version__ = f"{version_info[0]}.{version_info[1]}.{version_info[2]}"
START_TIME = datetime.utcnow() START_TIME = datetime.utcnow()
START_TIME_ISO = START_TIME.replace(microsecond=0).isoformat() START_TIME_ISO = START_TIME.replace(microsecond=0).isoformat()
TIME_DURATION_UNITS = ( TIME_DURATION_UNITS = (
@ -86,37 +84,37 @@ async def start_(c: Client, message: Message):
await add_served_user(user_id) await add_served_user(user_id)
return return
await message.reply_text( await message.reply_text(
f"""✨ **Welcome {message.from_user.mention()} !**\n f"""✨ **欢迎 {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!** 💭 [{me_bot.first_name}](https://t.me/{BOT_USERNAME}) **可以让你通过 Telegram 的视频聊天功能在群组中播放音乐和视频**
💡 **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( reply_markup=InlineKeyboardMarkup(
[ [
[ [
InlineKeyboardButton( InlineKeyboardButton(
" Add me to your Group ", " 邀请我到你的群组 ",
url=f"https://t.me/{BOT_USERNAME}?startgroup=true", url=f"https://t.me/{BOT_USERNAME}?startgroup=true",
) )
], ],
[InlineKeyboardButton("Basic Guide", callback_data="user_guide")], [InlineKeyboardButton("基础教程", callback_data="user_guide")],
[ [
InlineKeyboardButton("📚 Commands", callback_data="command_list"), InlineKeyboardButton("📚 命令", callback_data="command_list"),
InlineKeyboardButton("❤️ Donate", url=f"https://t.me/{OWNER_USERNAME}"), InlineKeyboardButton("❤️ 捐赠", url=f"https://t.me/{OWNER_USERNAME}"),
], ],
[ [
InlineKeyboardButton( InlineKeyboardButton(
"👥 Official Group", url=f"https://t.me/{GROUP_SUPPORT}" "👥 官方群组", url=f"https://t.me/{GROUP_SUPPORT}"
), ),
InlineKeyboardButton( InlineKeyboardButton(
"📣 Official Channel", url=f"https://t.me/{UPDATES_CHANNEL}" "📣 官方频道", url=f"https://t.me/{UPDATES_CHANNEL}"
), ),
], ],
[ [
InlineKeyboardButton( InlineKeyboardButton(
"🌐 Source Code", url="https://github.com/levina-lab/video-stream" "🌐 源代码", url="https://gitlab.com/Xtao-Labs/video-stream"
) )
], ],
] ]
@ -138,15 +136,23 @@ async def alive(c: Client, message: Message):
keyboard = InlineKeyboardMarkup( keyboard = InlineKeyboardMarkup(
[ [
[ [
InlineKeyboardButton("Group", url=f"https://t.me/{GROUP_SUPPORT}"), InlineKeyboardButton("群组", url=f"https://t.me/{GROUP_SUPPORT}"),
InlineKeyboardButton( InlineKeyboardButton(
"📣 Channel", url=f"https://t.me/{UPDATES_CHANNEL}" "📣 频道", url=f"https://t.me/{UPDATES_CHANNEL}"
), ),
] ]
] ]
) )
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**" 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"❤ **感谢使用本机器人**"
await c.send_photo( await c.send_photo(
chat_id, chat_id,
@ -172,9 +178,9 @@ async def get_uptime(c: Client, message: Message):
uptime_sec = (current_time - START_TIME).total_seconds() uptime_sec = (current_time - START_TIME).total_seconds()
uptime = await _human_time_duration(int(uptime_sec)) uptime = await _human_time_duration(int(uptime_sec))
await message.reply_text( await message.reply_text(
"🤖 bot status:\n" "🤖 在线状态:\n"
f"• **uptime:** `{uptime}`\n" f"• **在线时间:**`{uptime}`\n"
f"• **start time:** `{START_TIME_ISO}`" f"• **开启时间:**`{START_TIME_ISO}`"
) )
@ -201,21 +207,21 @@ async def new_chat(c: Client, m: Message):
if member.id == me_bot.id: if member.id == me_bot.id:
if chat_id in await blacklisted_chats(): if chat_id in await blacklisted_chats():
await m.reply_text( 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) return await bot.leave_chat(chat_id)
if member.id == me_bot.id: if member.id == me_bot.id:
return await m.reply( return await m.reply(
"❤️ Thanks for adding me to the **Group** !\n\n" "❤️ 感谢添加我到你的群组!\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" "请先添加我为管理员,否则我可能无法正常工作。并且不要忘记发送 `/userbotjoin` 来邀请 userbot 进群。\n\n"
"Once done, then type `/reload`", "使用命令 `/reload` 来刷新管理员列表。",
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
[ [
[ [
InlineKeyboardButton("📣 Channel", url=f"https://t.me/{UPDATES_CHANNEL}"), InlineKeyboardButton("📣 官方频道", url=f"https://t.me/{UPDATES_CHANNEL}"),
InlineKeyboardButton("💭 Support", url=f"https://t.me/{GROUP_SUPPORT}") InlineKeyboardButton("💭 官方群组", url=f"https://t.me/{GROUP_SUPPORT}")
], [ ], [
InlineKeyboardButton("👤 Assistant", url=f"https://t.me/{me_user.username}") InlineKeyboardButton("👤 userbot", url=f"https://t.me/{me_user.username}")
] ]
] ]
) )
@ -227,6 +233,7 @@ async def new_chat(c: Client, m: Message):
chat_watcher_group = 5 chat_watcher_group = 5
@Client.on_message(group=chat_watcher_group) @Client.on_message(group=chat_watcher_group)
async def chat_watcher_func(_, message: Message): async def chat_watcher_func(_, message: Message):
userid = message.from_user.id userid = message.from_user.id
@ -238,5 +245,7 @@ async def chat_watcher_func(_, message: Message):
LOGS.info(f"can't remove gbanned user from chat: {message.chat.id}") LOGS.info(f"can't remove gbanned user from chat: {message.chat.id}")
return return
await message.reply_text( await message.reply_text(
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." f"👮🏼 (> {suspect} <)\n\n"
f"**已封禁全局封禁用户**\n\n"
f"🚫 **原因:** spam"
) )

View File

@ -85,11 +85,11 @@ async def get_bot_logs(c: Client, m: Message):
await m.reply_document( await m.reply_document(
bot_log_path, bot_log_path,
quote=True, quote=True,
caption='📁 this is the bot logs', caption='📁 bot logs',
) )
remove_if_exists(bot_log_path) remove_if_exists(bot_log_path)
except BaseException as err: except BaseException as err:
LOGS.info(f'[ERROR]: {err}') LOGS.info(f'[ERROR]: {err}')
else: else:
if not os.path.exists(bot_log_path): if not os.path.exists(bot_log_path):
await m.reply_text('no logs found !') await m.reply_text('没有日志')

View File

@ -1,5 +1,7 @@
from typing import Optional from typing import Optional
from pyrogram import Client
from driver.core import user from driver.core import user
from pyrogram.raw.functions.channels import GetFullChannel from pyrogram.raw.functions.channels import GetFullChannel
from pyrogram.raw.functions.messages import GetFullChat from pyrogram.raw.functions.messages import GetFullChat
@ -11,7 +13,7 @@ from pyrogram.raw.types import (
) )
async def get_calls(m: Message, err_msg: str = "") -> Optional[InputGroupCall]: async def get_calls(c: Client, m: Message, err_msg: str = "") -> Optional[InputGroupCall]:
chat_peer = await user.resolve_peer(m.chat.id) chat_peer = await user.resolve_peer(m.chat.id)
if isinstance(chat_peer, (InputPeerChannel, InputPeerChat)): if isinstance(chat_peer, (InputPeerChannel, InputPeerChat)):
if isinstance(chat_peer, InputPeerChannel): if isinstance(chat_peer, InputPeerChannel):

View File

@ -9,8 +9,8 @@ from pyrogram.types import (
def stream_markup(user_id): def stream_markup(user_id):
buttons = [ buttons = [
[ [
InlineKeyboardButton(text="Mᴇɴ", callback_data=f'stream_menu_panel | {user_id}'), InlineKeyboardButton(text="菜单", callback_data=f'stream_menu_panel | {user_id}'),
InlineKeyboardButton(text="sᴇ", callback_data=f'set_close'), InlineKeyboardButton(text="关闭", callback_data=f'set_close'),
], ],
] ]
return buttons return buttons
@ -28,7 +28,7 @@ def menu_markup(user_id):
InlineKeyboardButton(text="🔊", callback_data=f'set_unmute | {user_id}'), InlineKeyboardButton(text="🔊", callback_data=f'set_unmute | {user_id}'),
], ],
[ [
InlineKeyboardButton(text="🔙 Go Back", callback_data='stream_home_panel'), InlineKeyboardButton(text="🔙 返回", callback_data='stream_home_panel'),
] ]
] ]
return buttons return buttons
@ -38,7 +38,7 @@ close_mark = InlineKeyboardMarkup(
[ [
[ [
InlineKeyboardButton( InlineKeyboardButton(
"🗑 Close", callback_data="set_close" "🗑 关闭", callback_data="set_close"
) )
] ]
] ]
@ -49,7 +49,7 @@ back_mark = InlineKeyboardMarkup(
[ [
[ [
InlineKeyboardButton( InlineKeyboardButton(
"🔙 Go Back", callback_data="stream_menu_panel" "🔙 返回", callback_data="stream_menu_panel"
) )
] ]
] ]

View File

@ -44,7 +44,7 @@ from pytgcalls.types.input_stream.quality import (
LowQualityVideo, LowQualityVideo,
MediumQualityVideo, MediumQualityVideo,
) )
from pytgcalls.exceptions import NoVideoSourceFound, NoActiveGroupCall, GroupCallNotFound from pytgcalls.exceptions import NoVideoSourceFound, NoActiveGroupCall, GroupCallNotFound, NoAudioSourceFound
from youtubesearchpython import VideosSearch 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) replied = await from_tg_get_msg(link)
except Exception as e: except Exception as e:
LOGS.info(f"[ERROR]: {e}") LOGS.info(f"[ERROR]: {e}")
return await m.reply_text(f"🚫 error:\n\n» {e}") return await m.reply_text(f"🚫 错误:\n\n» {e}")
if not replied: if not replied:
return await m.reply( return await m.reply(
"» reply to an **audio file** or **give something to search.**" "» 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( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n" caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
f"🗂 **Name:** [{songname}]({link}) | `video`\n" f"🗂 **名称:** [{songname}]({link}) | `视频`\n"
f"⏱️ **Duration:** `{duration}`\n" f"⏱️ **时长:** `{duration}`\n"
f"🧸 **Request by:** {requester}", f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
else: else:
try: try:
await loser.edit("🔄 Joining Group Call...") await loser.edit("🔄 加入视频聊天中...")
gcname = m.chat.title gcname = m.chat.title
ctitle = await CHAT_TITLE(gcname) ctitle = await CHAT_TITLE(gcname)
title = songname title = songname
@ -183,20 +183,20 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
await m.reply_photo( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({link}) | `video`\n" caption=f"🗂 **名称:** [{songname}]({link}) | `视频`\n"
f"⏱️ **Duration:** `{duration}`\n" f"⏱️ **时长:** `{duration}`\n"
f"🧸 **Request by:** {requester}", f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
except (NoActiveGroupCall, GroupCallNotFound): except (NoActiveGroupCall, GroupCallNotFound):
await loser.delete() await loser.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
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 !") await m.reply_text("请先使用命令 /startvc 来开启视频聊天!")
except BaseException as e: except BaseException as e:
LOGS.info(f"[ERROR]: {e}") LOGS.info(f"[ERROR]: {e}")
else: else:
await m.reply( 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 user_id = m.from_user.id
if m.sender_chat: if m.sender_chat:
return await m.reply_text( return await m.reply_text(
"you're an __Anonymous__ user !\n\n» revert back to your real user account to use this bot." "咱还不支持匿名用户!\n\n» 请先切换为正常用户,再使用此命令。",
) )
try: try:
ubot = me_user.id ubot = me_user.id
@ -256,16 +256,16 @@ async def vplay(c: Client, m: Message):
else: else:
if len(m.command) < 2: if len(m.command) < 2:
await m.reply( await m.reply(
"» reply to an **video file** or **give something to search.**" "» 回复一个 **视频** 或者 **给一个关键词来让我搜索"
) )
else: else:
loser = await c.send_message(chat_id, "🔍 **Loading...**") loser = await c.send_message(chat_id, "🔍 **搜索中...**")
query = m.text.split(None, 1)[1] query = m.text.split(None, 1)[1]
search = ytsearch(query) search = ytsearch(query)
Q = 720 Q = 720
amaze = HighQualityVideo() amaze = HighQualityVideo()
if search == 0: if search == 0:
await loser.edit("❌ **no results found.**") await loser.edit("❌ **没有找到任何结果**")
else: else:
songname = search[0] songname = search[0]
title = search[0] title = search[0]
@ -278,10 +278,10 @@ async def vplay(c: Client, m: Message):
image = await thumb(thumbnail, title, userid, ctitle) image = await thumb(thumbnail, title, userid, ctitle)
veez, ytlink = await ytdl(url) veez, ytlink = await ytdl(url)
if veez == 0: if veez == 0:
await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`") await loser.edit(f"❌ yt-dl 发生错误\n\n» `{ytlink}`")
else: else:
if chat_id in QUEUE: if chat_id in QUEUE:
await loser.edit("🔄 Queueing Track...") await loser.edit("🔄 添加到队列中...")
pos = add_to_queue( pos = add_to_queue(
chat_id, songname, ytlink, url, "video", Q chat_id, songname, ytlink, url, "video", Q
) )
@ -291,12 +291,15 @@ async def vplay(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
f"🗂 **名称:** [{songname}]({url}) | `视频`\n"
f"⏱ **时长:** `{duration}`\n🧸"
f" **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
else: else:
try: try:
await loser.edit("🔄 Joining Group Call...") await loser.edit("🔄 加入视频聊天...")
await music_on(chat_id) await music_on(chat_id)
await add_active_chat(chat_id) await add_active_chat(chat_id)
await calls.join_group_call( await calls.join_group_call(
@ -315,13 +318,15 @@ async def vplay(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"🗂 **名称:** [{songname}]({url}) | `视频`\n"
f"⏱ **时长:** `{duration}`\n"
f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
except (NoActiveGroupCall, GroupCallNotFound): except (NoActiveGroupCall, GroupCallNotFound):
await loser.delete() await loser.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
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 !") await m.reply_text("请先使用命令 /startvc 来开启视频聊天!")
except NoVideoSourceFound: except NoVideoSourceFound:
await loser.delete() await loser.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
@ -336,7 +341,7 @@ async def vplay(c: Client, m: Message):
else: else:
if len(m.command) < 2: if len(m.command) < 2:
await m.reply( await m.reply(
"» reply to an **video file** or **give something to search.**" "» 回复一个 **视频** 或者 **给一个关键词来让我搜索"
) )
elif "t.me" in m.command[1]: elif "t.me" in m.command[1]:
for i in m.command[1:]: for i in m.command[1:]:
@ -344,13 +349,13 @@ async def vplay(c: Client, m: Message):
await play_tg_file(c, m, link=i) await play_tg_file(c, m, link=i)
continue continue
else: else:
loser = await c.send_message(chat_id, "🔍 **Loading...**") loser = await c.send_message(chat_id, "🔍 **搜索中...**")
query = m.text.split(None, 1)[1] query = m.text.split(None, 1)[1]
search = ytsearch(query) search = ytsearch(query)
Q = 720 Q = 720
amaze = HighQualityVideo() amaze = HighQualityVideo()
if search == 0: if search == 0:
await loser.edit("❌ **no results found.**") await loser.edit("❌ **没有找到任何结果**")
else: else:
songname = search[0] songname = search[0]
title = search[0] title = search[0]
@ -363,10 +368,10 @@ async def vplay(c: Client, m: Message):
image = await thumb(thumbnail, title, userid, ctitle) image = await thumb(thumbnail, title, userid, ctitle)
veez, ytlink = await ytdl(url) veez, ytlink = await ytdl(url)
if veez == 0: if veez == 0:
await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`") await loser.edit(f"❌ yt-dl 发生错误\n\n» `{ytlink}`")
else: else:
if chat_id in QUEUE: if chat_id in QUEUE:
await loser.edit("🔄 Queueing Track...") await loser.edit("🔄 加入队列中...")
pos = add_to_queue(chat_id, songname, ytlink, url, "video", Q) pos = add_to_queue(chat_id, songname, ytlink, url, "video", Q)
await loser.delete() await loser.delete()
requester = ( requester = (
@ -376,12 +381,15 @@ async def vplay(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
f"🗂 **名称:** [{songname}]({url}) | `视频`\n"
f"⏱ **时长:** `{duration}`\n🧸"
f" **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
else: else:
try: try:
await loser.edit("🔄 Joining Group Call...") await loser.edit("🔄 加入视频聊天中...")
await music_on(chat_id) await music_on(chat_id)
await add_active_chat(chat_id) await add_active_chat(chat_id)
await calls.join_group_call( await calls.join_group_call(
@ -400,13 +408,15 @@ async def vplay(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=image, photo=image,
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({url}) | `video`\n⏱ **Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"🗂 **名称:** [{songname}]({url}) | `视频`\n"
f"⏱ **时长:** `{duration}`\n"
f"🧸 **添加者:** {requester}",
) )
remove_if_exists(image) remove_if_exists(image)
except (NoActiveGroupCall, GroupCallNotFound): except (NoActiveGroupCall, GroupCallNotFound):
await loser.delete() await loser.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
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 !") await m.reply_text("请先使用命令 /startvc 来开启视频聊天!")
except NoVideoSourceFound: except NoVideoSourceFound:
await loser.delete() await loser.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
@ -428,7 +438,7 @@ async def vstream(c: Client, m: Message):
user_id = m.from_user.id user_id = m.from_user.id
if m.sender_chat: if m.sender_chat:
return await m.reply_text( return await m.reply_text(
"you're an __Anonymous__ user !\n\n» revert back to your real user account to use this bot." "咱还不支持匿名用户!\n\n» 请先切换为正常用户,再使用此命令。",
) )
try: try:
ubot = me_user.id ubot = me_user.id
@ -476,7 +486,7 @@ async def vstream(c: Client, m: Message):
Q = 720 Q = 720
url = m.text.split(None, 1)[1] url = m.text.split(None, 1)[1]
search = ytsearch(url) search = ytsearch(url)
loser = await c.send_message(chat_id, "🔍 **Loading...**") loser = await c.send_message(chat_id, "🔍 **搜索中...**")
elif len(m.command) == 3: elif len(m.command) == 3:
op = m.text.split(None, 1)[1] op = m.text.split(None, 1)[1]
url = op.split(None, 1)[0] url = op.split(None, 1)[0]
@ -489,7 +499,7 @@ async def vstream(c: Client, m: Message):
await m.reply( await m.reply(
"» Streaming the live video in 720p quality" "» Streaming the live video in 720p quality"
) )
loser = await c.send_message(chat_id, "🔍 **Loading...**") loser = await c.send_message(chat_id, "🔍 **搜索中...**")
else: else:
pass pass
@ -503,11 +513,11 @@ async def vstream(c: Client, m: Message):
veez = 1 veez = 1
if veez == 0: if veez == 0:
await loser.edit(f"❌ yt-dl issues detected\n\n» `{livelink}`") await loser.edit(f"❌ yt-dl 发生错误\n\n» `{livelink}`")
else: else:
songname = search[0] songname = search[0]
if chat_id in QUEUE: if chat_id in QUEUE:
await loser.edit("🔄 Queueing Track...") await loser.edit("🔄 添加到队列中...")
pos = add_to_queue(chat_id, songname, livelink, url, "video", Q) pos = add_to_queue(chat_id, songname, livelink, url, "video", Q)
await loser.delete() await loser.delete()
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
@ -515,7 +525,9 @@ async def vstream(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=f"{IMG_1}", photo=f"{IMG_1}",
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `live`\n🧸 **Requested by:** {requester}", caption=f"💡 **已添加到队列 »** `{pos}`\n\n"
f"🗂 **名称:** [{songname}]({url}) | `直播`\n"
f"🧸 **添加者:** {requester}",
) )
else: else:
if Q == 720: if Q == 720:
@ -525,7 +537,7 @@ async def vstream(c: Client, m: Message):
elif Q == 360: elif Q == 360:
amaze = LowQualityVideo() amaze = LowQualityVideo()
try: try:
await loser.edit("🔄 Joining Group Call...") await loser.edit("🔄 加入视频聊天中...")
await music_on(chat_id) await music_on(chat_id)
await add_active_chat(chat_id) await add_active_chat(chat_id)
await calls.join_group_call( await calls.join_group_call(
@ -546,11 +558,12 @@ async def vstream(c: Client, m: Message):
await m.reply_photo( await m.reply_photo(
photo=f"{IMG_2}", photo=f"{IMG_2}",
reply_markup=InlineKeyboardMarkup(buttons), reply_markup=InlineKeyboardMarkup(buttons),
caption=f"🗂 **Name:** [{songname}]({url}) | `live`\n🧸 **Requested by:** {requester}", caption=f"🗂 **名称:** [{songname}]({url}) | `直播`\n"
f"🧸 **添加者:** {requester}",
) )
except (NoActiveGroupCall, GroupCallNotFound): except (NoActiveGroupCall, GroupCallNotFound):
await loser.delete() await loser.delete()
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
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 !") await m.reply_text("请先使用命令 /startvc 来开启视频聊天!")
except BaseException as e: except BaseException as e:
LOGS.info(f"[ERROR]: {e}") LOGS.info(f"[ERROR]: {e}")

View File

@ -47,6 +47,6 @@ async def ytsearch(_, message: Message):
text, text,
disable_web_page_preview=True, disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🗑 Close", callback_data="close_panel")]] [[InlineKeyboardButton("🗑 关闭", callback_data="close_panel")]]
), ),
) )