Bump Go dependencies in both backend/ and backend/_example/memory_store.
Notable updates:
- github.com/go-pkgz/lgr v0.12.1 -> v0.12.3
- github.com/klauspost/compress v1.18.2 -> v1.18.5
- github.com/PuerkitoBio/goquery v1.11.0 -> v1.12.0
- github.com/montanaflynn/stats v0.7.1 -> v0.9.0
- github.com/redis/go-redis/v9 v9.17.2 -> v9.18.0
- github.com/slack-go/slack v0.17.3 -> v0.21.1
- go.mongodb.org/mongo-driver v1.17.6 -> v1.17.9
- golang.org/x/crypto v0.48.0 -> v0.50.0
- golang.org/x/net v0.49.0 -> v0.53.0
- golang.org/x/image v0.36.0 -> v0.39.0
- golang.org/x/sys v0.41.0 -> v0.43.0
- golang.org/x/{oauth2,sync,text} minor bumps
Key markdown/sanitisation libs (bluemonday v1.0.27,
alecthomas/chroma/v2 v2.23.1, russross/blackfriday/v2 v2.1.0,
Depado/bfchroma/v2 v2.0.0) are already at the latest available
versions and were not bumped.
Verified the Chroma span-class allowlist regex in
backend/app/store/comment.go:128-131 is still fully in sync with
chroma/v2 types.go StandardTypes map (86 classes, byte-equal after
sorting). The inline comment references commit c263f6f which is
stale (Chroma is at v2 now), but the class list content is current.
Ran `go mod tidy` + `go mod vendor` + full race test suite on both
modules. All green. Added a reminder in CLAUDE.md that updating
backend/ Go modules also requires `go mod tidy` in
backend/_example/memory_store since the example module uses a
local replace directive and inherits indirect deps from the main
module.
280 lines
9.8 KiB
Go
280 lines
9.8 KiB
Go
package slack
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
// AckMessage is used for messages received in reply to other messages
|
|
type AckMessage struct {
|
|
ReplyTo int `json:"reply_to"`
|
|
Timestamp string `json:"ts"`
|
|
Text string `json:"text"`
|
|
RTMResponse
|
|
}
|
|
|
|
// RTMResponse encapsulates response details as returned by the Slack API
|
|
type RTMResponse struct {
|
|
Ok bool `json:"ok"`
|
|
Error *RTMError `json:"error"`
|
|
}
|
|
|
|
// RTMError encapsulates error information as returned by the Slack API
|
|
type RTMError struct {
|
|
Code int
|
|
Msg string
|
|
}
|
|
|
|
func (s RTMError) Error() string {
|
|
return fmt.Sprintf("Code %d - %s", s.Code, s.Msg)
|
|
}
|
|
|
|
// MessageEvent represents a Slack Message (used as the event type for an incoming message)
|
|
type MessageEvent Message
|
|
|
|
// RTMEvent is the main wrapper. You will find all the other messages attached
|
|
type RTMEvent struct {
|
|
Type string
|
|
Data interface{}
|
|
}
|
|
|
|
// HelloEvent represents the hello event
|
|
type HelloEvent struct{}
|
|
|
|
// PresenceChangeEvent represents the presence change event
|
|
type PresenceChangeEvent struct {
|
|
Type string `json:"type"`
|
|
Presence string `json:"presence"`
|
|
User string `json:"user"`
|
|
Users []string `json:"users"`
|
|
}
|
|
|
|
// UserTypingEvent represents the user typing event
|
|
type UserTypingEvent struct {
|
|
Type string `json:"type"`
|
|
User string `json:"user"`
|
|
Channel string `json:"channel"`
|
|
}
|
|
|
|
// PrefChangeEvent represents a user preferences change event
|
|
type PrefChangeEvent struct {
|
|
Type string `json:"type"`
|
|
Name string `json:"name"`
|
|
Value json.RawMessage `json:"value"`
|
|
}
|
|
|
|
// ManualPresenceChangeEvent represents the manual presence change event
|
|
type ManualPresenceChangeEvent struct {
|
|
Type string `json:"type"`
|
|
Presence string `json:"presence"`
|
|
}
|
|
|
|
// UserChangeEvent represents the user change event
|
|
type UserChangeEvent struct {
|
|
Type string `json:"type"`
|
|
User User `json:"user"`
|
|
CacheTS int64 `json:"cache_ts"`
|
|
EventTS string `json:"event_ts"`
|
|
}
|
|
|
|
// UserStatusChangedEvent represents the user status changed event
|
|
type UserStatusChangedEvent struct {
|
|
Type string `json:"type"`
|
|
User User `json:"user"`
|
|
CacheTS int64 `json:"cache_ts"`
|
|
EventTS string `json:"event_ts"`
|
|
}
|
|
|
|
// UserHuddleChangedEvent represents the user huddle changed event
|
|
type UserHuddleChangedEvent struct {
|
|
Type string `json:"type"`
|
|
User User `json:"user"`
|
|
CacheTS int64 `json:"cache_ts"`
|
|
EventTS string `json:"event_ts"`
|
|
}
|
|
|
|
// UserProfileChangedEvent represents the user profile changed event
|
|
type UserProfileChangedEvent struct {
|
|
Type string `json:"type"`
|
|
User User `json:"user"`
|
|
CacheTS int64 `json:"cache_ts"`
|
|
EventTS string `json:"event_ts"`
|
|
}
|
|
|
|
// EmojiChangedEvent represents the emoji changed event
|
|
type EmojiChangedEvent struct {
|
|
Type string `json:"type"`
|
|
SubType string `json:"subtype"`
|
|
Name string `json:"name"`
|
|
Names []string `json:"names"`
|
|
Value string `json:"value"`
|
|
EventTimestamp string `json:"event_ts"`
|
|
}
|
|
|
|
// CommandsChangedEvent represents the commands changed event
|
|
type CommandsChangedEvent struct {
|
|
Type string `json:"type"`
|
|
EventTimestamp string `json:"event_ts"`
|
|
}
|
|
|
|
// EmailDomainChangedEvent represents the email domain changed event
|
|
type EmailDomainChangedEvent struct {
|
|
Type string `json:"type"`
|
|
EventTimestamp string `json:"event_ts"`
|
|
EmailDomain string `json:"email_domain"`
|
|
}
|
|
|
|
// BotAddedEvent represents the bot added event
|
|
type BotAddedEvent struct {
|
|
Type string `json:"type"`
|
|
Bot Bot `json:"bot"`
|
|
}
|
|
|
|
// BotChangedEvent represents the bot changed event
|
|
type BotChangedEvent struct {
|
|
Type string `json:"type"`
|
|
Bot Bot `json:"bot"`
|
|
}
|
|
|
|
// AccountsChangedEvent represents the accounts changed event
|
|
type AccountsChangedEvent struct {
|
|
Type string `json:"type"`
|
|
}
|
|
|
|
// ReconnectUrlEvent represents the receiving reconnect url event
|
|
type ReconnectUrlEvent struct {
|
|
Type string `json:"type"`
|
|
URL string `json:"url"`
|
|
}
|
|
|
|
// MemberJoinedChannelEvent, a user joined a public or private channel
|
|
type MemberJoinedChannelEvent struct {
|
|
Type string `json:"type"`
|
|
User string `json:"user"`
|
|
Channel string `json:"channel"`
|
|
ChannelType string `json:"channel_type"`
|
|
Team string `json:"team"`
|
|
Inviter string `json:"inviter"`
|
|
}
|
|
|
|
// MemberLeftChannelEvent a user left a public or private channel
|
|
type MemberLeftChannelEvent struct {
|
|
Type string `json:"type"`
|
|
User string `json:"user"`
|
|
Channel string `json:"channel"`
|
|
ChannelType string `json:"channel_type"`
|
|
Team string `json:"team"`
|
|
}
|
|
|
|
// ChannelUpdatedEvent is fired when a channel's properties are updated (tabs, meeting
|
|
// notes, etc.).
|
|
type ChannelUpdatedEvent struct {
|
|
Type string `json:"type"`
|
|
Updates map[string]any `json:"updates"`
|
|
Channel string `json:"channel"`
|
|
Channels []string `json:"channels"`
|
|
EventTS string `json:"event_ts"`
|
|
TS string `json:"ts"`
|
|
}
|
|
|
|
// SHRoomRecording holds recording metadata for a Slack Call/Huddle room.
|
|
type SHRoomRecording struct {
|
|
CanRecordSummary string `json:"can_record_summary,omitempty"`
|
|
}
|
|
|
|
// SHRoom represents a Slack Huddle/Call room.
|
|
type SHRoom struct {
|
|
ID string `json:"id"`
|
|
Name *string `json:"name"` // nullable in Slack's response
|
|
MediaServer string `json:"media_server"`
|
|
CreatedBy string `json:"created_by"`
|
|
DateStart int64 `json:"date_start"`
|
|
DateEnd int64 `json:"date_end"`
|
|
Participants []string `json:"participants"`
|
|
ParticipantHistory []string `json:"participant_history"`
|
|
ParticipantsEvents map[string]map[string]any `json:"participants_events,omitempty"`
|
|
ParticipantsCameraOn []string `json:"participants_camera_on"`
|
|
ParticipantsCameraOff []string `json:"participants_camera_off"`
|
|
ParticipantsScreenshareOn []string `json:"participants_screenshare_on"`
|
|
ParticipantsScreenshareOff []string `json:"participants_screenshare_off"`
|
|
CanvasThreadTS string `json:"canvas_thread_ts,omitempty"`
|
|
ThreadRootTS string `json:"thread_root_ts,omitempty"`
|
|
Channels []string `json:"channels"`
|
|
IsDMCall bool `json:"is_dm_call"`
|
|
WasRejected bool `json:"was_rejected"`
|
|
WasMissed bool `json:"was_missed"`
|
|
WasAccepted bool `json:"was_accepted"`
|
|
HasEnded bool `json:"has_ended"`
|
|
BackgroundID string `json:"background_id,omitempty"`
|
|
CanvasBackground string `json:"canvas_background,omitempty"`
|
|
IsPrewarmed bool `json:"is_prewarmed,omitempty"`
|
|
IsScheduled bool `json:"is_scheduled,omitempty"`
|
|
Recording *SHRoomRecording `json:"recording,omitempty"`
|
|
Locale string `json:"locale,omitempty"`
|
|
AttachedFileIDs []string `json:"attached_file_ids,omitempty"`
|
|
MediaBackendType string `json:"media_backend_type"`
|
|
DisplayID string `json:"display_id,omitempty"`
|
|
ExternalUniqueID string `json:"external_unique_id"`
|
|
AppID string `json:"app_id"`
|
|
CallFamily string `json:"call_family,omitempty"`
|
|
HuddleLink string `json:"huddle_link,omitempty"`
|
|
}
|
|
|
|
// SHRoomHuddle holds the huddle-specific metadata on sh_room events.
|
|
type SHRoomHuddle struct {
|
|
ChannelID string `json:"channel_id"`
|
|
}
|
|
|
|
// SHRoomJoinEvent is fired when a user joins a Slack Call/Huddle room.
|
|
type SHRoomJoinEvent struct {
|
|
Type string `json:"type"`
|
|
Room SHRoom `json:"room"`
|
|
User string `json:"user"`
|
|
Huddle *SHRoomHuddle `json:"huddle,omitempty"`
|
|
EventTS string `json:"event_ts"`
|
|
TS string `json:"ts"`
|
|
}
|
|
|
|
// SHRoomLeaveEvent is fired when a user leaves a Slack Call/Huddle room.
|
|
type SHRoomLeaveEvent struct {
|
|
Type string `json:"type"`
|
|
Room SHRoom `json:"room"`
|
|
User string `json:"user"`
|
|
Huddle *SHRoomHuddle `json:"huddle,omitempty"`
|
|
EventTS string `json:"event_ts"`
|
|
TS string `json:"ts"`
|
|
}
|
|
|
|
// SHRoomUpdateEvent is fired when a Slack Call/Huddle room is updated.
|
|
type SHRoomUpdateEvent struct {
|
|
Type string `json:"type"`
|
|
Room SHRoom `json:"room"`
|
|
User string `json:"user"`
|
|
Huddle *SHRoomHuddle `json:"huddle,omitempty"`
|
|
EventTS string `json:"event_ts"`
|
|
TS string `json:"ts"`
|
|
}
|
|
|
|
// AppsUninstalledEvent represents the apps_uninstalled event sent via RTM
|
|
// when one or more apps are uninstalled from the workspace.
|
|
type AppsUninstalledEvent struct {
|
|
Type string `json:"type"`
|
|
}
|
|
|
|
// ActivityEvent represents the activity event sent via RTM. This is an
|
|
// internal Slack event that fires during normal workspace usage (e.g. new
|
|
// messages, bundle updates).
|
|
type ActivityEvent struct {
|
|
Type string `json:"type"`
|
|
SubType string `json:"subtype"`
|
|
Key string `json:"key"`
|
|
Entry json.RawMessage `json:"entry"`
|
|
EventTimestamp string `json:"event_ts"`
|
|
}
|
|
|
|
// BadgeCountsUpdatedEvent represents the badge_counts_updated event sent via
|
|
// RTM when notification badge counts change.
|
|
type BadgeCountsUpdatedEvent struct {
|
|
Type string `json:"type"`
|
|
}
|