Skip to content

Commit 6569528

Browse files
committed
Support Discord DM agent requests
1 parent b9cd975 commit 6569528

5 files changed

Lines changed: 482 additions & 54 deletions

File tree

apps/discord_bot/README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,17 @@ Long-running service changes should be implemented as PR-based workflows rather
6363
than direct production mutations. Task reads require an explicit project filter
6464
to avoid guild-wide task enumeration.
6565

66-
Mention flow is opt-in per message: the bot runs the agent only when directly
67-
mentioned in a server channel or thread. Mention-triggered agent results and
68-
confirmation buttons are sent by DM to avoid leaking task or plan details into
69-
public channels. A follow-up in the same thread should mention the bot again so
70-
the bot has an explicit user trigger and fresh Discord role context for that
71-
request.
66+
Mention flow is opt-in per message: the bot runs the agent when directly
67+
mentioned in a server channel or thread, or when a user sends the bot a DM.
68+
DM requests are accepted only after resolving the sender as a current member of
69+
the configured 508 Discord server. The `/agent` slash command is also registered
70+
for bot DMs and uses the same configured-server membership and role resolution.
71+
Other slash commands default to guild-only registration unless they are
72+
explicitly reviewed and opted in to DM contexts.
73+
Mention-triggered agent results and confirmation buttons are sent by DM to avoid
74+
leaking task or plan details into public channels. A follow-up in the same
75+
thread should mention the bot again so the bot has an explicit user trigger and
76+
fresh Discord role context for that request.
7277

7378
Production mention handling depends on Discord gateway and channel access:
7479
The bot requests all intents in code, but the production Discord application

apps/discord_bot/src/five08/discord_bot/bot.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,19 @@ class Bot508(commands.Bot):
6363
def __init__(self) -> None:
6464
intents = discord.Intents.all()
6565
# Use a prefix that won't accidentally trigger since we're using slash commands
66-
super().__init__(command_prefix="$508$", intents=intents)
66+
super().__init__(
67+
command_prefix="$508$",
68+
intents=intents,
69+
allowed_contexts=discord.app_commands.AppCommandContext(
70+
guild=True,
71+
dm_channel=False,
72+
private_channel=False,
73+
),
74+
allowed_installs=discord.app_commands.AppInstallationType(
75+
guild=True,
76+
user=False,
77+
),
78+
)
6779
# Remove the default help command since we're using slash commands
6880
self.remove_command("help")
6981
self.http_server: Optional[BotHTTPServer] = None

0 commit comments

Comments
 (0)