Skip to content

Commit 71ca405

Browse files
committed
Auto Fixes: Code Formated
Signed-off-by: AsmSafone <asmsafone@gmail.com>
1 parent d143b4d commit 71ca405

File tree

9 files changed

+38
-37
lines changed

9 files changed

+38
-37
lines changed

main.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
from utils import mp, USERNAME, FFMPEG_PROCESSES
2929
from pyrogram.raw import functions, types
3030
from user import USER
31-
from pyrogram.errors import FloodWait, UserAlreadyParticipant
31+
from pyrogram.types import Message
32+
from pyrogram.errors import UserAlreadyParticipant
3233

3334
CHAT=Config.CHAT
3435
ADMINS=Config.ADMINS
@@ -39,7 +40,7 @@
3940
Config.API_ID,
4041
Config.API_HASH,
4142
bot_token=Config.BOT_TOKEN,
42-
plugins=dict(root="plugins")
43+
plugins=dict(root="plugins.bot")
4344
)
4445
if not os.path.isdir("./downloads"):
4546
os.makedirs("./downloads")
@@ -49,10 +50,7 @@ async def main():
4950
try:
5051
await USER.join_chat("AsmSafone")
5152
except UserAlreadyParticipant:
52-
return 400
53-
except FloodWait as e:
54-
await asyncio.sleep(e.x)
55-
return 404
53+
return
5654
except Exception as e:
5755
print(e)
5856
pass
@@ -155,15 +153,15 @@ def stop_and_restart():
155153
)
156154

157155
@bot.on_message(filters.command(["restart", f"restart@{USERNAME}"]) & filters.user(ADMINS) & (filters.chat(CHAT) | filters.private | filters.chat(LOG_GROUP)))
158-
async def restart(client, message):
156+
async def restart(_, message: Message):
159157
k=await message.reply_text("🔄 **Checking Updates ...**")
160158
await asyncio.sleep(3)
161159
await k.edit("🔄 **Updating, Please Wait...**")
162160
await asyncio.sleep(5)
163161
await k.edit("🔄 **Successfully Updated!**")
164-
await asyncio.sleep(2)
165-
await k.edit("🔄 **Restarting, Please Wait...\n\nJoin @AsmSafone For Updates!**")
166-
await asyncio.sleep(10)
162+
await asyncio.sleep(3)
163+
await k.edit("🔄 **Restarting, Please Wait...**")
164+
await asyncio.sleep(5)
167165
process = FFMPEG_PROCESSES.get(CHAT)
168166
if process:
169167
try:
@@ -178,7 +176,7 @@ async def restart(client, message):
178176
target=stop_and_restart
179177
).start()
180178
try:
181-
await k.delete()
179+
await k.edit("✅ **Restarted Successfully! \nJoin @AsmSafone For More!**")
182180
await k.reply_to_message.delete()
183181
except:
184182
pass
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,20 @@
3030

3131
HOME_TEXT = "👋🏻 **Hi [{}](tg://user?id={})**,\n\nI'm **Radio Player V3.0** \nI Can Play Radio / Music / YouTube Live In Channel & Group 24x7 Nonstop. Made with ❤️ By @AsmSafone 😉!"
3232
HELP_TEXT = """
33-
🎧 --**Need Help ?**--
34-
(Join @SafoTheBot For Support)
33+
🏷️ --**Setting Up**-- :
34+
35+
\u2022 Add the bot and user account in your group with admin rights.
36+
\u2022 Start a voice chat in your group & restart the bot if not joined to vc.
37+
\u2022 Use /play [song name] or use /play as a reply to an audio file or youtube link.
3538
3639
🏷️ --**Common Commands**-- :
3740
38-
\u2022 `/play` - reply to an audio or youTube link to play it or use /play [song name]
39-
\u2022 `/help` - shows help for commands
40-
\u2022 `/song` [song name] - download the song as audio track
41-
\u2022 `/current` - shows playing time of current track
42-
\u2022 `/playlist` - shows the current playlist with controls
41+
\u2022 `/help` - shows help for all commands
42+
\u2022 `/song` [song name] - download the song as audio
43+
\u2022 `/current` - shows current track with controls
44+
\u2022 `/playlist` - shows the current & queued playlist
4345
44-
🏷️ --**Admin Commands**-- :
46+
🏷️ --**Admins Commands**-- :
4547
4648
\u2022 `/radio` - start radio stream
4749
\u2022 `/stopradio` - stop radio stream
@@ -184,7 +186,7 @@ async def cb_handler(client: Client, query: CallbackQuery):
184186
elif query.data=="help":
185187
buttons = [
186188
[
187-
InlineKeyboardButton("Search Songs Inline", switch_inline_query_current_chat=""),
189+
InlineKeyboardButton("SEARCH SONGS INLINE", switch_inline_query_current_chat=""),
188190
],
189191
[
190192
InlineKeyboardButton("CHANNEL", url="https://t.me/AsmSafone"),
@@ -195,7 +197,7 @@ async def cb_handler(client: Client, query: CallbackQuery):
195197
InlineKeyboardButton("SOURCE CODE", url="https://github.com/AsmSafone/RadioPlayerV3"),
196198
],
197199
[
198-
InlineKeyboardButton("CLOSE 🔐", callback_data="close"),
200+
InlineKeyboardButton("CLOSE MENU", callback_data="close"),
199201
]
200202
]
201203
reply_markup = InlineKeyboardMarkup(buttons)
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import os
2020
import re
21+
import ffmpeg
2122
import asyncio
2223
import subprocess
2324
from signal import SIGINT
@@ -52,7 +53,6 @@ async def is_admin(_, client, message: Message):
5253
ADMINS_FILTER = filters.create(is_admin)
5354

5455

55-
5656
@Client.on_message(filters.command(["play", f"play@{USERNAME}"]) & (filters.chat(CHAT) | filters.private | filters.chat(LOG_GROUP)) | filters.audio & filters.private)
5757
async def yplay(_, message: Message):
5858
if ADMIN_ONLY == "True":
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def is_admin(_, client, message: Message):
3838

3939

4040
@Client.on_message(filters.command(["radio", f"radio@{USERNAME}"]) & ADMINS_FILTER & (filters.chat(CHAT) | filters.private | filters.chat(LOG_GROUP)))
41-
async def radio(client, message: Message):
41+
async def radio(_, message: Message):
4242
if 1 in RADIO:
4343
k=await message.reply_text(f"{emoji.ROBOT} **Please Stop Existing Radio Stream!**")
4444
await mp.delete(k)

plugins/song.py renamed to plugins/bot/song.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import requests
2424
import youtube_dl
2525
from pyrogram import Client, filters
26+
from pyrogram.types import Message
2627
from config import Config
2728
from utils import USERNAME, mp
2829
from youtube_search import YoutubeSearch
@@ -41,7 +42,7 @@ def time_to_seconds(time):
4142
## Commands --------------------------------
4243

4344
@Client.on_message(filters.command(["song", f"song@{USERNAME}"]) & (filters.chat(CHAT) | filters.private | filters.chat(LOG_GROUP)))
44-
async def song(client, message):
45+
async def song(_, message: Message):
4546
query = ''
4647
for i in message.command[1:]:
4748
query += ' ' + str(i)
@@ -96,14 +97,14 @@ async def song(client, message):
9697
info_dict = ydl.extract_info(link, download=False)
9798
audio_file = ydl.prepare_filename(info_dict)
9899
ydl.process_info(info_dict)
99-
cap = f'🏷 <b>Title:</b> <a href="{link}">{title}</a>\n⏳ <b>Duration:</b> <code>{duration}</code>\n👀 <b>Views:</b> <code>{views}</code>\n🎧 <b>Requested By:</b> {message.from_user.mention()} \n📤 <b>Uploaded By: @AsmSafone</b> 👑'
100+
cap = f'🏷 <b>Title:</b> <a href="{link}">{title}</a>\n⏳ <b>Duration:</b> <code>{duration}</code>\n👀 <b>Views:</b> <code>{views}</code>\n🎧 <b>Requested By:</b> {message.from_user.mention()} \n📤 <b>Uploaded By: <a href="https://t.me/AsmSafone">🇧🇩 S1 BOTS</a></b>'
100101
secmul, dur, dur_arr = 1, 0, duration.split(':')
101102
for i in range(len(dur_arr)-1, -1, -1):
102103
dur += (int(dur_arr[i]) * secmul)
103104
secmul *= 60
104105
await k.edit("📤 **Uploading Song...**")
105106
await message.reply_audio(audio_file, caption=cap, parse_mode='HTML', title=title, duration=dur, performer=performer, thumb=thumb_name)
106-
await mp.delete(k)
107+
await k.delete()
107108
await mp.delete(message)
108109
except Exception as e:
109110
await k.edit(f'❌ **An Error Occured!** \n\nError:- {e}')
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ async def generate_sysinfo(workdir):
106106

107107

108108
@Client.on_message(
109-
filters.group
110-
& filters.text
109+
filters.text
110+
& (filters.group | filters.private)
111111
& self_or_contact_filter
112112
& ~filters.edited
113113
& ~filters.bot
114-
& filters.regex("^!ping$")
114+
& filters.regex("^.ping$")
115115
)
116116
async def ping_pong(_, m: Message):
117117
start = time()
@@ -123,12 +123,12 @@ async def ping_pong(_, m: Message):
123123

124124

125125
@Client.on_message(
126-
filters.group
127-
& filters.text
126+
filters.text
127+
& (filters.group | filters.private)
128128
& self_or_contact_filter
129129
& ~filters.edited
130130
& ~filters.bot
131-
& filters.regex("^!uptime$")
131+
& filters.regex("^.uptime$")
132132
)
133133
async def get_uptime(_, m: Message):
134134
current_time = datetime.utcnow()
@@ -142,14 +142,14 @@ async def get_uptime(_, m: Message):
142142

143143

144144
@Client.on_message(
145-
filters.group
146-
& filters.text
145+
filters.text
146+
& (filters.group | filters.private)
147147
& self_or_contact_filter
148148
& ~filters.edited
149149
& ~filters.bot
150-
& filters.regex("^!sysinfo$")
150+
& filters.regex("^.sysinfo$")
151151
)
152-
async def get_sysinfo(client, m):
152+
async def get_sysinfo(client, m: Message):
153153
response = "**System Information**:\n"
154154
m_reply = await m.reply_text(f"{response}`...`")
155155
response += await generate_sysinfo(client.workdir)

user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
Config.SESSION,
2727
Config.API_ID,
2828
Config.API_HASH,
29-
plugins=dict(root="plugins.safone")
29+
plugins=dict(root="plugins.userbot")
3030
)
3131
else:
3232
USER = Client(

0 commit comments

Comments
 (0)