Closed dideler closed 5 years ago
@dideler I think the message event itself should have the information you're looking for assuming you mean the RTM API. https://api.slack.com/events/message
Thanks @BlakeWilliams. Looks like the contents of ims
from %Slack.State{}
(the second parameter for handle_event/3
) can be checked against the channel ID of the message.
I also noticed that the format of the channel ID encodes information about a channel. E.g. "D" prefix for direct channels, "C" prefix for public group channels, "G" prefix for private group channels. So that's another way to determine what type of channel the message belongs to. Though I couldn't find any documentation for it, so it's riskier to use as Slack could change that convention.
Hi, I'm trying to make a bot only respond in group channels when @mentioned, while not needing an @mention for responding to direct messages.
Had a quick look through the docs to see where to get this state from. I assume it's somewhere in the
Slack.State
struct.According to the Hex docs
Trying to dive deeper into the structure is difficult. The Slack API types is not a 1-to-1 mapping with the properties given on the Hex docs.