private static SlackEvent extractMessageEvent(SlackSession slackSession, JSONObject obj) { String channelId = (String) obj.get("channel"); SlackChannel channel = getChannel(slackSession, channelId); String ts = (String) obj.get("ts"); SlackMessageSubType subType = SlackMessageSubType.getByCode((String) obj.get("subtype")); switch (subType) { case MESSAGE_CHANGED: return parseMessageUpdated(obj, channel, ts); case MESSAGE_DELETED: return parseMessageDeleted(obj, channel, ts); default: return parseMessagePublished(obj, channel, ts, slackSession); } }
static { for (SlackMessageSubType enumValue : SlackMessageSubType.values()) { CODE_MAP.put(enumValue.getCode(), enumValue); } }