change buttons
This commit is contained in:
parent
5c5bad0e47
commit
8d0434641d
1 changed files with 11 additions and 8 deletions
|
@ -3,6 +3,7 @@ from disnake.ext import commands
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
import os
|
import os
|
||||||
from os import path
|
from os import path
|
||||||
|
import asyncio
|
||||||
from pydub import AudioSegment
|
from pydub import AudioSegment
|
||||||
import speech_recognition as sr
|
import speech_recognition as sr
|
||||||
|
|
||||||
|
@ -40,20 +41,22 @@ async def transcribesphinx(inter: disnake.ApplicationCommandInteraction, message
|
||||||
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.display_name, url=message.jump_url, icon_url=message.author.display_avatar)
|
||||||
await inter.edit_original_message(embed=embed, components=[disnake.ui.Button(label="See more posibilites", style=disnake.ButtonStyle.success, custom_id="gp")])
|
await inter.edit_original_message(embed=embed, components=[disnake.ui.Button(label="See more posibilites", style=disnake.ButtonStyle.success, custom_id="gp")])
|
||||||
|
await asyncio.sleep(3)
|
||||||
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")
|
@bot.listen("on_button_click")
|
||||||
async def extratranscribe(inter: disnake.MessageInteraction, message: disnake.Message):
|
async def extratranscribe(inter: disnake.MessageInteraction):
|
||||||
if inter.component.custom_id == "gp":
|
if inter.component.custom_id == "gp":
|
||||||
await inter.response.defer(ephemeral='true')
|
try:
|
||||||
await message.attachments[0].save("audio.ogg")
|
await inter.response.defer(ephemeral='true')
|
||||||
embed=disnake.Embed(title=st.recognize_google(prepaudio("audio.ogg"), show_all=True), color=0x3584e4)
|
await inter.attachments[0].save("audio.ogg")
|
||||||
embed.set_author(name=message.author.nick, url=message.jump_url, icon_url=message.author.display_avatar)
|
embed=disnake.Embed(title=st.recognize_google(prepaudio("audio.ogg"), show_all=True), color=0x3584e4)
|
||||||
await inter.edit_original_message(embed=embed)
|
embed.set_author(name=inter.author.nick, url=inter.jump_url, icon_url=inter.author.display_avatar)
|
||||||
os.remove("audio.ogg")
|
await inter.edit_original_message(embed=embed)
|
||||||
os.remove("audio.wav")
|
except Exception as e:
|
||||||
|
await inter.edit_original_message(content=f'The interaction has expiredS')
|
||||||
|
|
||||||
bot.run(os.getenv("TOKEN"))
|
bot.run(os.getenv("TOKEN"))
|
Loading…
Reference in a new issue