error checking

This commit is contained in:
insert-usernamehere 2023-04-15 10:45:39 -04:00
parent 9cf7985f35
commit 035ef71814

View file

@ -12,6 +12,7 @@ bot = commands.Bot(command_prefix='.')
@bot.message_command(name="Transcrible")
async def transcribe(inter: disnake.ApplicationCommandInteraction, message: disnake.Message):
try:
await inter.response.defer(ephemeral='true')
await message.attachments[0].save("audio.ogg")
mp3file = AudioSegment.from_ogg("audio.ogg")
@ -22,5 +23,8 @@ async def transcribe(inter: disnake.ApplicationCommandInteraction, message: disn
await inter.edit_original_message(content=st.recognize_sphinx(transcribeaudo))
os.remove("audio.ogg")
os.remove("audio.wav")
except Exception as e:
await inter.edit_original_message(content=f'an error appears to have occoured please report it to the developer: {e}')
bot.run(os.getenv("TOKEN"))