SIGN IN SIGN UP

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

0 0 73 Python

feat(backend/copilot-bot): post intro message when added to a server (#13220)

### Why / What / How

**Why:** When AutoPilot is added to a Discord server, there's no
in-channel signal explaining how to set it up. A new admin has to
*already know* to run `/setup` — otherwise the bot just sits there
silently. That's a real onboarding gap; a welcome message at join time
gives them the instructions in the channel they're already looking at.

**What:** When the bot is added to a server, it posts a one-shot welcome
message with the `/setup` instructions, how to use the bot (mention or
DM), and the available commands.

**How:**
- New `on_guild_join` event in `DiscordAdapter._register_events` — fires
once per server-add.
- Helpers in a small `intro.py` (sibling to `commands.py`) so the
adapter stays focused: `pick_intro_channel(guild)` picks the server's
system channel if writable, falls back to the first text channel the bot
has `send_messages` in, returns `None` if nothing's writable;
`intro_message()` builds the copy. The handler is a no-op when there's
nowhere to post.
- Posted with `AllowedMentions.none()` (no @ping risk).
- The commands list in the message intentionally **omits `/resume`** —
`/resume` is DM-only and would be rejected in a server, so advertising
it there would mislead.

### Changes 🏗️

- `adapters/discord/intro.py` (new) — `pick_intro_channel` +
`intro_message`.
- `adapters/discord/adapter.py` — register `on_guild_join` event; calls
`intro.*` and gracefully no-ops when no channel is writable.
- `adapters/discord/intro_test.py` (new) — covers system-channel
preference, fallback to first sendable text channel, none-writable case,
no-system-channel case, no-`guild.me` case, and that the message
references `/setup`.

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
- [x] Full Discord-adapter suite green (56 passed), `black` + `ruff` +
`pyright` clean
- [x] Channel-picking logic covered: prefers `system_channel`, falls
back to first sendable, no-op when nothing writable
- [x] `/resume` is **not** in the in-server commands list (it's DM-only)
B
Bently committed
8dc55d91652870c91c7669996f43eeab38dabd03
Parent: 5ac3fe2
Committed by GitHub <noreply@github.com> on 5/27/2026, 2:54:05 PM