linkgravity 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cogs/voice_cog.py +19 -1
package/package.json
CHANGED
package/src/cogs/voice_cog.py
CHANGED
|
@@ -6,7 +6,7 @@ import discord
|
|
|
6
6
|
from discord import app_commands
|
|
7
7
|
from discord.ext import commands, tasks
|
|
8
8
|
|
|
9
|
-
from config import logger
|
|
9
|
+
from config import allowed, logger
|
|
10
10
|
|
|
11
11
|
from .voice.enrollment import EnrollmentManager
|
|
12
12
|
from .voice.stt_session import SttSessionTracker
|
|
@@ -152,6 +152,10 @@ class VoiceCog(commands.Cog):
|
|
|
152
152
|
|
|
153
153
|
@app_commands.command(name="join", description="Summon the bot to your current voice channel")
|
|
154
154
|
async def cmd_join(self, interaction: discord.Interaction):
|
|
155
|
+
if not allowed(interaction.user.id):
|
|
156
|
+
await interaction.response.send_message("❌ Permission Denied", ephemeral=True)
|
|
157
|
+
return
|
|
158
|
+
|
|
155
159
|
if not isinstance(interaction.channel, discord.Thread):
|
|
156
160
|
await interaction.response.send_message(
|
|
157
161
|
"❌ This command can only be used inside a thread created with `/new`.", ephemeral=True
|
|
@@ -260,6 +264,10 @@ class VoiceCog(commands.Cog):
|
|
|
260
264
|
):
|
|
261
265
|
import aiohttp
|
|
262
266
|
|
|
267
|
+
if not allowed(interaction.user.id):
|
|
268
|
+
await interaction.response.send_message("❌ Permission Denied", ephemeral=True)
|
|
269
|
+
return
|
|
270
|
+
|
|
263
271
|
if (
|
|
264
272
|
wake_word is None
|
|
265
273
|
and active_times is None
|
|
@@ -330,6 +338,10 @@ class VoiceCog(commands.Cog):
|
|
|
330
338
|
|
|
331
339
|
@app_commands.command(name="leave", description="Make the bot leave the voice channel")
|
|
332
340
|
async def cmd_leave(self, interaction: discord.Interaction):
|
|
341
|
+
if not allowed(interaction.user.id):
|
|
342
|
+
await interaction.response.send_message("❌ Permission Denied", ephemeral=True)
|
|
343
|
+
return
|
|
344
|
+
|
|
333
345
|
guild_id = interaction.guild_id
|
|
334
346
|
await interaction.response.send_message("👋 Disconnected from voice channel.")
|
|
335
347
|
try:
|
|
@@ -365,6 +377,12 @@ class VoiceCog(commands.Cog):
|
|
|
365
377
|
try:
|
|
366
378
|
guild_id = data.get("guild_id")
|
|
367
379
|
user_id = data.get("user_id")
|
|
380
|
+
|
|
381
|
+
if not allowed(int(user_id)):
|
|
382
|
+
self.logger.debug(f"STT: ignoring speech from non-allowed user {user_id}")
|
|
383
|
+
await self.stt_session.clear_partial_msg(str(guild_id))
|
|
384
|
+
return
|
|
385
|
+
|
|
368
386
|
# Node runs STT itself before calling this endpoint, so this is
|
|
369
387
|
# already-recognized text, not raw audio - keeps STT off every VAD hit.
|
|
370
388
|
text = data.get("text")
|