Skip to content

Commit d63bf2c

Browse files
committed
fix(serve): include is_admin flag in slash_command events (v0.6.2)
The is_admin field was missing from the emitted slash_command event data, causing consumers to always see is_admin=False and reject conversation mode toggles even for server administrators.
1 parent 1c6ef73 commit d63bf2c

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "discord-cli-agent"
7-
version = "0.6.1"
7+
version = "0.6.2"
88
description = "Discord CLI for AI agents"
99
readme = "README.md"
1010
license = "MIT"

src/discli/commands/serve.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ async def _callback(interaction: discord.Interaction, **kwargs):
253253
itk = str(uuid.uuid4())
254254
interactions[itk] = interaction
255255
await interaction.response.defer(thinking=True)
256+
# Check if user has administrator permission in this guild
257+
is_admin = False
258+
if hasattr(interaction.user, "guild_permissions"):
259+
is_admin = interaction.user.guild_permissions.administrator
256260
emit({
257261
"event": "slash_command",
258262
"command": cmd_name,
@@ -262,6 +266,7 @@ async def _callback(interaction: discord.Interaction, **kwargs):
262266
"user_id": str(interaction.user.id),
263267
"guild_id": str(interaction.guild_id) if interaction.guild_id else None,
264268
"interaction_token": itk,
269+
"is_admin": is_admin,
265270
})
266271

267272
# Build a proper signature so discord.py registers slash options

0 commit comments

Comments
 (0)