Repository navigation
Allow channel management to be disabled - #16
Closed
neilberkman wants to merge 4 commits into
Closed
neilberkman wants to merge 4 commits into
neilberkman wants to merge 4 commits into
Conversation
neilberkman
force-pushed
the
optional-channel-server
branch
2 times, most recently
from
October 28, 2026 02:21
00913ae to
200bcc7
Compare
Re-raise the CA load error with the original stacktrace, and name the test certificate's curve by atom instead of its raw OID.
neilberkman
force-pushed
the
optional-channel-server
branch
from
October 28, 2026 02:23
200bcc7 to
37b6bf0
Compare
- send_message/2 raises with channels: false instead of silently dropping the message. - channels: true and nil keep the defaults, and other non-list values raise a clear ArgumentError instead of crashing in ChannelServer. - Decide channels? once in the supervisor, and pass state.channels? to every handle_slack_event call instead of defaulting it to true. - ChannelServer starts the message servers for the channels it found directly, so they are no longer added to its state twice, and are running once it has started. - Test join/part dispatch in the socket tests, including that it's skipped with channels: false, verify supervisor test expectations, and check the 3-tuple Socket.start_link defaults channels? to true. - README: give channels its own section, and list chat:write.
- send_message/2 starts a queue for a channel the bot hasn't joined yet
(a new DM, or a join still on its way), through the ChannelServer so
a pending join is handled first. Without queues (channels: false, or
Slack.Supervisor not running) it logs an error and returns
{:error, :no_message_queues} instead of raising.
- Add post_message/3 to send right away without a queue, and use it
for the queued messages too.
- Leaving a channel stops its queue through the DynamicSupervisor, so
it isn't restarted, and leaving a channel without a queue is a no-op.
- Joining a channel that already has a queue reuses it, so a restarted
ChannelServer or a rejoin no longer crashes.
- Handle group_left, which Slack sends when the bot leaves a private
channel, and subscribe to it in the README.
- Check channels? once, before dispatching, instead of threading it
through every handle_slack_event clause, and drop the unused 3-tuple
Socket.start_link.
- Only accept a keyword list for channels.
- README: the join and leave subscriptions still need channels:read,
groups:read and mpim:read with channels: false.
Contributor
Author
|
Closing in favor of #18 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Starting a bot always discovers its conversations, which needs
channels:read,groups:read,im:readandmpim:readeven when the bot doesn't use channel management (for example a bot that only sends DMs or handles interactions). This addschannels: falseto skip the channel server, the message queues and their registries. Socket Mode, the task supervisors and event callbacks stay on, includingmember_joined_channelandchannel_left, which are still dispatched to the bot. Omittingchannelskeeps today's behavior. The README documents the option and directSlack.API.post("chat.postMessage", ...)when the queues are off, sincesend_message/2needs them.Rebased onto main after #15: events_api envelopes pass the channels flag through
handle_envelope, interactions are unchanged, and the message clauses keep your%{id: bot_id}fix.Slack.Socket.start_link/1keeps your{app_token, bot, ssl_options}form (it defaults channel management on) and the supervisor passes{app_token, bot, ssl_options, channels?}. The supervisor tests now stubWebSockex.start_link/4.Tested with
mix test --warnings-as-errors(43 passed),mix format --check-formatted,mix compile --warnings-as-errorsin dev and test, andmix dialyzer. This branch is stacked on #17 (the credo fixes for main), so its first commit is #17's; merge #17 first and this PR's diff drops to the channels commit.mix credopasses on the stack.