This repository has been archived on 2019-11-22. You can view files and clone it, but cannot push or open issues or pull requests.
aocbot/slack_structs.go
2017-09-26 11:24:17 -05:00

93 lines
2.9 KiB
Go

package main
import "time"
// Message We save the message struct into the db,
// it's also what we send/receive from slack
type Message struct {
ID uint64 `json:"id"`
Type string `json:"type"`
Channel string `json:"channel"`
User string `json:"user"`
Name string `json:"name"`
Text string `json:"text"`
Ts string `json:"ts"`
Time time.Time
}
type Attachment struct {
Fallback string `json:"fallback"`
Color string `json:"color"`
Pretext string `json:"pretext"`
AuthorName string `json:"author_name"`
AuthorLink string `json:"author_link"`
AuthorIcon string `json:"author_icon"`
Title string `json:"title"`
TitleLink string `json:"title_link"`
Text string `json:"text"`
//Fields []AttachmentFields `json:"fields"`
ImageUrl string `json:"image_url"`
ThumbUrl string `json:"thumb_url"`
Footer string `json:"footer"`
FooterIcon string `json:"footer_icon"`
RawTS int `json:"ts"`
TS time.Time
}
// Channel object
type Channel struct {
ID string `json:"id"`
Name string `json:"name"`
IsChannel bool `json:"is_channel"`
CreatedRaw int `json:"created"`
Created time.Time
Creator string `json:"creator"`
IsArchived bool `json:"is_archived"`
IsGeneral bool `json:"is_general"`
IsMember bool `json:"is_member"`
LastReadRaw string `json:"last_read"`
LastRead time.Time
Latest *Message `json:"latest"`
UnreadCount int `json:"unread_count"`
UnreadCountDisplay int `json:"unread_count_display"`
Members []string `json:"members"`
Topic *ChannelTopic `json:"topic"`
Purpose *ChannelTopic `json:"purpose"`
// LastUpdated is the last time we updated the info in the DB
LastUpdated time.Time
}
// ChannelTopic A simple 'Channel Topic' object
// used for several things in the slack api (channel topic/purpose, etc.
type ChannelTopic struct {
Value string `json:"value"`
Creator string `json:"creator"`
LastSetRaw int `json:"last_set"`
LastSet time.Time
}
// User object
type User struct {
ID string `json:"id"`
Name string `json:"name"`
Deleted bool `json:"deleted"`
Status string `json:"status"`
Color string `json:"color"`
RealName string `json:"real_name"`
TZ string `json:"tz"`
TZLabel string `json:"tz_label"`
TZOffset int `json:"tz_offset"`
IsAdmin bool `json:"is_admin"`
IsOwner bool `json:"is_owner"`
IsPrimaryOwner bool `json:"is_primary_owner"`
IsRestricted bool `json:"is_restricted"`
IsUltraRestricted bool `json:"is_ultra_restricted"`
IsBot bool `json:"is_bot"`
HasFiles bool `json:"has_files"`
// LastUpdated is the last time we updated the info in the DB
LastUpdated time.Time
}