This commit is contained in:
2024-08-28 14:57:50 +02:00
parent c448201823
commit 169552e8d5
+4 -2
View File
@@ -7,6 +7,7 @@
import assemblyai as aai
import discord
from discord.ext import commands, voice_recv
import logging
# Replace with your API key
aai.settings.api_key = "aa9962f0088a449a9c4ab2361e96cc08"
discord.opus._load_default()
@@ -17,7 +18,7 @@ FILE_URL = "https://github.com/AssemblyAI-Community/audio-examples/raw/main/2023
# You can also transcribe a local file by passing in a file path
# FILE_URL = './path/to/file.mp3'
logger = logging.getLogger("discord")
class Transcriber(commands.Cog):
def __init__(self, bot):
@@ -61,8 +62,9 @@ class Transcriber(commands.Cog):
# power = 127-(value & 127)
# print('#' * int(power * (79/128)))
## instead of 79 you can use shutil.get_terminal_size().columns-1
logger.info("Attempt transcribe")
vc = await ctx.author.voice.channel.connect(cls=voice_recv.VoiceRecvClient)
logger.info("Connected")
vc.listen(voice_recv.BasicSink(callback))
@commands.command(name="stop_transcribe")