Spaces:
Running
Running
UPDATE
Browse files
app.py
CHANGED
@@ -164,6 +164,7 @@ async def help_handler(event):
|
|
164 |
async def audio_handler(event):
|
165 |
reply = await event.get_reply_message()
|
166 |
if event.message.media and event.message.media.document.mime_type.startswith('audio') and event.is_private:
|
|
|
167 |
# Download the audio file
|
168 |
file_path = await client.download_media(event.message, f"downloads/{event.sender.id}_audio.mp3")
|
169 |
try:
|
@@ -172,14 +173,20 @@ async def audio_handler(event):
|
|
172 |
except Fusion.InvalidMusicFileError as e:
|
173 |
await event.respond(f'Error: {e}')
|
174 |
return os.remove(file_path)
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
else:
|
184 |
if event.is_private: return await event.respond("`Please send an audio file...`")
|
185 |
|
|
|
164 |
async def audio_handler(event):
|
165 |
reply = await event.get_reply_message()
|
166 |
if event.message.media and event.message.media.document.mime_type.startswith('audio') and event.is_private:
|
167 |
+
msg = await event.reply("`Downloading...`")
|
168 |
# Download the audio file
|
169 |
file_path = await client.download_media(event.message, f"downloads/{event.sender.id}_audio.mp3")
|
170 |
try:
|
|
|
173 |
except Fusion.InvalidMusicFileError as e:
|
174 |
await event.respond(f'Error: {e}')
|
175 |
return os.remove(file_path)
|
176 |
+
return await msg.edit("`Downloaded successfully...`")
|
177 |
+
elif event.is_group and event.text.startswith("/edit"):
|
178 |
+
if reply.message.media and reply.message.media.document.mime_type.startswith('audio'):
|
179 |
+
msg = await event.reply("`Downloading...`")
|
180 |
+
file_path = await reply.download_media(f"downloads/{event.sender.id}_audio.mp3")
|
181 |
+
try:
|
182 |
+
# Load the audio file using your AudioFusion class
|
183 |
+
audio = Fusion.loadSound(file_path)
|
184 |
+
except Fusion.InvalidMusicFileError as e:
|
185 |
+
await event.respond(f'Error: {e}')
|
186 |
+
return os.remove(file_path)
|
187 |
+
return await msg.edit("`Downloaded successfully...`")
|
188 |
+
else:
|
189 |
+
return await event.respond("`Please send an audio file...`")
|
190 |
else:
|
191 |
if event.is_private: return await event.respond("`Please send an audio file...`")
|
192 |
|