Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/content/docs/(messaging)/slack-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,23 @@ The workspace ID is the `T`-prefixed string in your Slack URL: `https://app.slac

### DM filtering

By default, all DMs are ignored. To allow specific users, add their Slack user IDs.
By default, all DMs are ignored. To allow specific users, add their Slack user IDs. To allow **all users** to message the bot via DM, use the wildcard `*`.

<Tabs items={["Spacebot UI", "TOML Config"]}>
<Tab value="Spacebot UI">

Go to **Settings** → **Messaging Platforms** → Slack card and add user IDs to the **DM Allowed Users** list.
Go to **Settings** → **Messaging Platforms** → Slack card and add user IDs to the **DM Allowed Users** list. To allow all users, add `*` as a user ID.

</Tab>
<Tab value="TOML Config">

```toml
[messaging.slack]
# Allow specific users
dm_allowed_users = ["U01234", "U56789"]

# Or allow all users with wildcard
dm_allowed_users = ["*"]
```

Permission changes hot-reload within a couple seconds — no restart needed.
Expand Down
3 changes: 3 additions & 0 deletions src/messaging/slack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ async fn handle_message_event(
tracing::debug!(channel_id, "DM dropped: dm_allowed_users is empty");
return Ok(());
}
// Allow wildcard "*" to permit all users
let is_wildcard = perms.dm_allowed_users.iter().any(|u| u == "*");
if let Some(ref sender_id) = user_id
&& !is_wildcard
&& !perms.dm_allowed_users.contains(sender_id)
{
tracing::debug!(
Expand Down