defer again and make empherial

This commit is contained in:
insert-usernamehere 2023-04-15 10:14:54 -04:00
parent 9e0bb1e5fd
commit 258db180a7

View file

@ -12,7 +12,7 @@ bot = commands.Bot(command_prefix='.')
@bot.message_command(name="Transcrible") @bot.message_command(name="Transcrible")
async def transcribe(inter: disnake.ApplicationCommandInteraction, message: disnake.Message): async def transcribe(inter: disnake.ApplicationCommandInteraction, message: disnake.Message):
await inter.response.defer() await inter.response.defer(ephemeral='true')
# Reversing the message and sending it back. # Reversing the message and sending it back.
await message.attachments[0].save("audio.ogg") await message.attachments[0].save("audio.ogg")
mp3file = AudioSegment.from_ogg("audio.ogg") mp3file = AudioSegment.from_ogg("audio.ogg")
@ -20,7 +20,7 @@ async def transcribe(inter: disnake.ApplicationCommandInteraction, message: disn
convertemessage = sr.AudioFile("audio.wav") convertemessage = sr.AudioFile("audio.wav")
with convertemessage as sounds: with convertemessage as sounds:
transcribeaudo = st.record(sounds) transcribeaudo = st.record(sounds)
await inter.response.send_message(st.recognize_sphinx(transcribeaudo), file=disnake.File("audio.wav")) await inter.edit_original_message(st.recognize_sphinx(transcribeaudo), file=disnake.File("audio.wav"))
os.remove("audio.ogg") os.remove("audio.ogg")
os.remove("audio.wav") os.remove("audio.wav")