forked from xAbhish3k/WarMusicBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcallback.py
203 lines (171 loc) · 7.93 KB
/
callback.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
from driver.queues import QUEUE
from pyrogram import Client, filters
from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup
from config import (
ASSISTANT_NAME,
BOT_NAME,
BOT_USERNAME,
GROUP_SUPPORT,
OWNER_NAME,
UPDATES_CHANNEL,
)
@Client.on_callback_query(filters.regex("cbstart"))
async def cbstart(_, query: CallbackQuery):
await query.edit_message_text(
f"""✨ **Welcome [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**\n
💭 **[{BOT_NAME}](https://t.me/{BOT_USERNAME}) allows you to play music and video on groups through the new Telegram's video chats!**
💡 **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("❓ Basic Guide", callback_data="cbhowtouse")],
[
InlineKeyboardButton("📚 Commands", callback_data="cbcmds"),
InlineKeyboardButton("❤ Owner", url=f"https://t.me/{OWNER_NAME}"),
],
[
InlineKeyboardButton(
"👥 Official Group", url=f"https://t.me/{GROUP_SUPPORT}"
),
InlineKeyboardButton(
"📣 Official Channel", url=f"https://t.me/G8_01"
),
],
[
InlineKeyboardButton(
"Help", url="https://t.me/G8_M_L"
)
],
]
),
disable_web_page_preview=True,
)
@Client.on_callback_query(filters.regex("cbhowtouse"))
async def cbguides(_, query: CallbackQuery):
await query.edit_message_text(
f"""❓ **Basic Guide for using this bot:**
1.) **First, add me to your group.**
2.) **Then, promote me as administrator and give all permissions except Anonymous Admin.**
3.) **After promoting me, type /reload in group to refresh the admin data.**
3.) **Add @{ASSISTANT_NAME} to your group or type /userbotjoin to invite her.**
4.) **Turn on the video chat first before start to play video/music.**
5.) **Sometimes, reloading the bot by using /reload command can help you to fix some problem.**
📌 **If the userbot not joined to video chat, make sure if the video chat already turned on, or type /userbotleave then type /userbotjoin again.**
💡 **If you have a follow-up questions about this bot, you can tell it on my support chat here: @{GROUP_SUPPORT}**
⚡ __Powered by {BOT_NAME} A.I__""",
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbstart")]]
),
)
@Client.on_callback_query(filters.regex("cbcmds"))
async def cbcmds(_, query: CallbackQuery):
await query.edit_message_text(
f"""✨ **Hello [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**
» **press the button below to read the explanation and see the list of available commands !**
⚡ __Powered by {BOT_NAME} A.I__""",
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton("👷🏻 Admin Cmd", callback_data="cbadmin"),
InlineKeyboardButton("🧙🏻 Sudo Cmd", callback_data="cbsudo"),
],[
InlineKeyboardButton("📚 Basic Cmd", callback_data="cbbasic")
],[
InlineKeyboardButton("🔙 Go Back", callback_data="cbstart")
],
]
),
)
@Client.on_callback_query(filters.regex("cbbasic"))
async def cbbasic(_, query: CallbackQuery):
await query.edit_message_text(
f"""🏮 here is the basic commands:
» /mplay (song name/link) - play music on video chat
» /stream (query/link) - stream the yt live/radio live music
» /vplay (video name/link) - play video on video chat
» /vstream - play live video from yt live/m3u8
» /playlist - show you the playlist
» /video (query) - download video from youtube
» /song (query) - download song from youtube
» /lyric (query) - scrap the song lyric
» /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)
⚡️ __Powered by {BOT_NAME} AI__""",
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbcmds")]]
),
)
@Client.on_callback_query(filters.regex("cbadmin"))
async def cbadmin(_, query: CallbackQuery):
await query.edit_message_text(
f"""🏮 here is the admin commands:
» /pause - pause the stream
» /resume - resume the stream
» /skip - switch to next stream
» /stop - stop the streaming
» /vmute - mute the userbot on voice chat
» /vunmute - unmute the userbot on voice chat
» /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
⚡️ __Powered by {BOT_NAME} AI__""",
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbcmds")]]
),
)
@Client.on_callback_query(filters.regex("cbsudo"))
async def cbsudo(_, query: CallbackQuery):
await query.edit_message_text(
f"""🏮 here is the sudo commands:
» /rmw - clean all raw files
» /rmd - clean all downloaded files
» /sysinfo - show the system information
» /update - update your bot to latest version
» /restart - restart your bot
» /leaveall - order userbot to leave from all group
⚡ __Powered by {BOT_NAME} AI__""",
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbcmds")]]
),
)
@Client.on_callback_query(filters.regex("cbmenu"))
async def cbmenu(_, query: CallbackQuery):
if query.message.sender_chat:
return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats:
return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
chat_id = query.message.chat.id
if chat_id in QUEUE:
await query.edit_message_text(
f"⚙️ **settings of** {query.message.chat.title}\n\n⏸ : pause stream\n▶️ : resume stream\n🔇 : mute userbot\n🔊 : unmute userbot\n⏹ : stop stream",
reply_markup=InlineKeyboardMarkup(
[[
InlineKeyboardButton("⏹", callback_data="cbstop"),
InlineKeyboardButton("⏸", callback_data="cbpause"),
InlineKeyboardButton("▶️", callback_data="cbresume"),
],[
InlineKeyboardButton("🔇", callback_data="cbmute"),
InlineKeyboardButton("🔊", callback_data="cbunmute"),
],[
InlineKeyboardButton("🗑 Close", callback_data="cls")],
]
),
)
else:
await query.answer("❌ nothing is currently streaming", show_alert=True)
@Client.on_callback_query(filters.regex("cls"))
async def close(_, 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("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
await query.message.delete()