mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Add a transcribe lock
This commit is contained in:
parent
f003e5bd4c
commit
8a49acaea3
1 changed files with 46 additions and 44 deletions
|
@ -112,6 +112,7 @@ class OtherCog(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.lock = asyncio.Lock()
|
self.lock = asyncio.Lock()
|
||||||
|
self.transcribe_lock = asyncio.Lock()
|
||||||
self.http = httpx.AsyncClient()
|
self.http = httpx.AsyncClient()
|
||||||
self._fmt_cache = {}
|
self._fmt_cache = {}
|
||||||
self._fmt_queue = asyncio.Queue()
|
self._fmt_queue = asyncio.Queue()
|
||||||
|
@ -2283,6 +2284,7 @@ class OtherCog(commands.Cog):
|
||||||
@commands.message_command(name="Transcribe")
|
@commands.message_command(name="Transcribe")
|
||||||
async def transcribe_message(self, ctx: discord.ApplicationContext, message: discord.Message):
|
async def transcribe_message(self, ctx: discord.ApplicationContext, message: discord.Message):
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
|
async with self.transcribe_lock:
|
||||||
if not message.attachments:
|
if not message.attachments:
|
||||||
return await ctx.respond("No attachments found.")
|
return await ctx.respond("No attachments found.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue