zarox commited on
Commit
ffe661e
·
1 Parent(s): 99140c1
Files changed (1) hide show
  1. app.py +8 -15
app.py CHANGED
@@ -167,23 +167,17 @@ async def audio_handler(event):
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:
171
- # Load the audio file using your AudioFusion class
172
- audio = Fusion.loadSound(file_path)
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...`")
@@ -261,7 +255,6 @@ async def audio_editor(event):
261
  await client.send_file(event.chat_id, output_file_path, caption=f'Modified audio: {output_file_name}.mp3')
262
 
263
  # Clean up the temporary files
264
- os.remove(file_path)
265
  os.remove(output_file_path)
266
 
267
  elif event.raw_text.startswith('/delete'):
 
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
  return await msg.edit("`Downloaded successfully...`")
171
+ elif event.is_group and event.text.startswith("/edit") and reply:
172
+ if reply.media and reply.message.media.document.mime_type.startswith('audio'):
173
  msg = await event.reply("`Downloading...`")
174
  file_path = await reply.download_media(f"downloads/{event.sender.id}_audio.mp3")
175
+ # try:
176
+ # # Load the audio file using your AudioFusion class
177
+ # audio = Fusion.loadSound(file_path)
178
+ # except Fusion.InvalidMusicFileError as e:
179
+ # await event.respond(f'Error: {e}')
180
+ # return os.remove(file_path)
181
  return await msg.edit("`Downloaded successfully...`")
182
  else:
183
  return await event.respond("`Please send an audio file...`")
 
255
  await client.send_file(event.chat_id, output_file_path, caption=f'Modified audio: {output_file_name}.mp3')
256
 
257
  # Clean up the temporary files
 
258
  os.remove(output_file_path)
259
 
260
  elif event.raw_text.startswith('/delete'):