Add a transcribe lock

This commit is contained in:
nexy7574 2023-12-05 21:48:46 +00:00
parent f003e5bd4c
commit 8a49acaea3

View file

@ -112,6 +112,7 @@ class OtherCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.lock = asyncio.Lock()
self.transcribe_lock = asyncio.Lock()
self.http = httpx.AsyncClient()
self._fmt_cache = {}
self._fmt_queue = asyncio.Queue()
@ -2283,6 +2284,7 @@ class OtherCog(commands.Cog):
@commands.message_command(name="Transcribe")
async def transcribe_message(self, ctx: discord.ApplicationContext, message: discord.Message):
await ctx.defer()
async with self.transcribe_lock:
if not message.attachments:
return await ctx.respond("No attachments found.")