Skip to content

Add userIsBot field to User type - #158

Merged
rjmholt merged 1 commit into
masterfrom
rjmholt/add-is-bot-field
Apr 3, 2026
Merged

Add userIsBot field to User type#158
rjmholt merged 1 commit into
masterfrom
rjmholt/add-is-bot-field

Conversation

@rjmholt

@rjmholt rjmholt commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds userIsBot :: Maybe Bool to the User record type in Web.Slack.User
  • The Slack API returns is_bot on user objects (from users.list, users.info, etc.) but the library was not decoding it
  • Uses Maybe Bool for backwards compatibility, consistent with the other boolean fields (userIsAdmin, userIsOwner, etc.)

Motivation

We need to filter bot users from channel member lists in MWB's Good Morning bot. Without is_bot on the User type, there's no reliable way to distinguish bots from humans using the library.

Test plan

  • Library builds cleanly
  • All 82 existing tests pass (the deriveFromJSON TH handles the new field automatically)
  • Field uses Maybe Bool so existing JSON without is_bot deserializes as Nothing

Made with Cursor

The Slack API returns is_bot on user objects (from users.list,
users.info, etc.) but the library was not decoding it. This field
is useful for filtering bot users from channel member lists.

Uses Maybe Bool for backwards compatibility with responses that
may not include the field.

Made-with: Cursor
@rjmholt
rjmholt requested review from CJ-Flaherty, ldub and lf- April 3, 2026 01:23
@rjmholt
rjmholt merged commit 0c234dd into master Apr 3, 2026
6 checks passed
@rjmholt
rjmholt deleted the rjmholt/add-is-bot-field branch April 3, 2026 01:30
Comment thread src/Web/Slack/User.hs
, userIsPrimaryOwner :: Maybe Bool
, userIsRestricted :: Maybe Bool
, userIsUltraRestricted :: Maybe Bool
, userIsBot :: Maybe Bool

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally we have coverage for this on a golden test if possible.

rjmholt added a commit that referenced this pull request Apr 3, 2026
Covers users.list response deserialization with a fixture
containing a human user, a bot user (is_bot: true), and a
deleted user. Exercises the userIsBot field added in #158.

Made-with: Cursor
rjmholt added a commit that referenced this pull request Apr 3, 2026
Covers users.list response deserialization with a fixture
containing a human user, a bot user (is_bot: true), and a
deleted user. Exercises the userIsBot field added in #158.

Made-with: Cursor
rjmholt added a commit that referenced this pull request Apr 3, 2026
## Summary
- Adds golden test coverage for `users.list` response deserialization
(`ListRsp`)
- The fixture includes three users exercising key fields:
  - A human user (`is_bot: false`) with full profile
  - A bot user (`is_bot: true`) without a profile
  - A deleted human user (`is_bot: false`, `deleted: true`)
- Exercises the `userIsBot` field added in #158

## Test plan
- [x] All 83 tests pass (82 existing + 1 new golden test)
- [x] Golden file correctly captures `userIsBot = Just True` for the bot
and `Just False` for humans

Made with [Cursor](https://cursor.com)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants