buttons
This commit is contained in:
parent
70f78917f4
commit
e3ac8a5876
1 changed files with 15 additions and 3 deletions
|
@ -23,7 +23,9 @@ async def transcribesphinx(inter: disnake.ApplicationCommandInteraction, message
|
||||||
try:
|
try:
|
||||||
await inter.response.defer(ephemeral='true')
|
await inter.response.defer(ephemeral='true')
|
||||||
await message.attachments[0].save("audio.ogg")
|
await message.attachments[0].save("audio.ogg")
|
||||||
await inter.edit_original_message(content=st.recognize_sphinx(prepaudio("audio.ogg")))
|
embed=disnake.Embed(title=st.recognize_sphinx(prepaudio("audio.ogg")), color=0x3584e4)
|
||||||
|
embed.set_author(name=message.author.nick, url=message.jump_url, icon_url=message.author.display_avatar)
|
||||||
|
await inter.edit_original_message(embed=embed)
|
||||||
os.remove("audio.ogg")
|
os.remove("audio.ogg")
|
||||||
os.remove("audio.wav")
|
os.remove("audio.wav")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -36,12 +38,22 @@ async def transcribesphinx(inter: disnake.ApplicationCommandInteraction, message
|
||||||
await message.attachments[0].save("audio.ogg")
|
await message.attachments[0].save("audio.ogg")
|
||||||
# WARNING Google is propritary, consider disabling however sphynix is currently not very good so this provides an option
|
# WARNING Google is propritary, consider disabling however sphynix is currently not very good so this provides an option
|
||||||
embed=disnake.Embed(title=st.recognize_google(prepaudio("audio.ogg")), color=0x3584e4)
|
embed=disnake.Embed(title=st.recognize_google(prepaudio("audio.ogg")), color=0x3584e4)
|
||||||
embed.set_author(name=message.author.display_name, url=message.jump_url, icon_url=message.author.display_avatar)
|
embed.set_author(name=message.author.nick, url=message.jump_url, icon_url=message.author.display_avatar)
|
||||||
await inter.edit_original_message(embed=embed)
|
await inter.edit_original_message(embed=embed, components=[disnake.ui.Button(label="See more posibilites", style=disnake.ButtonStyle.success, custom_id="gp")])
|
||||||
os.remove("audio.ogg")
|
os.remove("audio.ogg")
|
||||||
os.remove("audio.wav")
|
os.remove("audio.wav")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await inter.edit_original_message(content=f'an error appears to have occoured please report it to the developer: {e}')
|
await inter.edit_original_message(content=f'an error appears to have occoured please report it to the developer: {e}')
|
||||||
|
|
||||||
|
@bot.listen("on_button_click")
|
||||||
|
async def extratranscribe(inter: disnake.MessageInteraction, message: disnake.Message):
|
||||||
|
if inter.component.custom_id == "gp":
|
||||||
|
await inter.response.defer(ephemeral='true')
|
||||||
|
await message.attachments[0].save("audio.ogg")
|
||||||
|
embed=disnake.Embed(title=st.recognize_google(prepaudio("audio.ogg"), show_all=True), color=0x3584e4)
|
||||||
|
embed.set_author(name=message.author.nick, url=message.jump_url, icon_url=message.author.display_avatar)
|
||||||
|
await inter.edit_original_message(embed=embed)
|
||||||
|
os.remove("audio.ogg")
|
||||||
|
os.remove("audio.wav")
|
||||||
|
|
||||||
bot.run(os.getenv("TOKEN"))
|
bot.run(os.getenv("TOKEN"))
|
Loading…
Reference in a new issue