Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
mark Stickers deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
andersfylling committed Aug 7, 2021
1 parent 78ff537 commit bc648e9
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 29 deletions.
4 changes: 4 additions & 0 deletions iface_copier_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions iface_reseter_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 31 additions & 29 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,35 +155,37 @@ var _ DeepCopier = (*MessageSticker)(nil)

// Message https://discord.com/developers/docs/resources/channel#message-object-message-structure
type Message struct {
ID Snowflake `json:"id"`
ChannelID Snowflake `json:"channel_id"`
GuildID Snowflake `json:"guild_id"`
Author *User `json:"author"`
Member *Member `json:"member"`
Content string `json:"content"`
Timestamp Time `json:"timestamp"`
EditedTimestamp Time `json:"edited_timestamp"` // ?
Tts bool `json:"tts"`
MentionEveryone bool `json:"mention_everyone"`
Mentions []*User `json:"mentions"`
MentionRoles []Snowflake `json:"mention_roles"`
MentionChannels []*MentionChannel `json:"mention_channels"`
Attachments []*Attachment `json:"attachments"`
Embeds []*Embed `json:"embeds"`
Reactions []*Reaction `json:"reactions"` // ?
Nonce interface{} `json:"nonce"` // NOT A SNOWFLAKE! DONT TOUCH!
Pinned bool `json:"pinned"`
WebhookID Snowflake `json:"webhook_id"` // ?
Type MessageType `json:"type"`
Activity MessageActivity `json:"activity"`
Application MessageApplication `json:"application"`
MessageReference *MessageReference `json:"message_reference"`
ReferencedMessage *Message `json:"referenced_message"`
Flags MessageFlag `json:"flags"`
StickerItems []*StickerItem `json:"sticker_items"`
Stickers []*MessageSticker `json:"stickers"`
Components []*MessageComponent `json:"components"`
Interaction *MessageInteraction `json:"interaction"`
ID Snowflake `json:"id"`
ChannelID Snowflake `json:"channel_id"`
GuildID Snowflake `json:"guild_id"`
Author *User `json:"author"`
Member *Member `json:"member"`
Content string `json:"content"`
Timestamp Time `json:"timestamp"`
EditedTimestamp Time `json:"edited_timestamp"` // ?
Tts bool `json:"tts"`
MentionEveryone bool `json:"mention_everyone"`
Mentions []*User `json:"mentions"`
MentionRoles []Snowflake `json:"mention_roles"`
MentionChannels []*MentionChannel `json:"mention_channels"`
Attachments []*Attachment `json:"attachments"`
Embeds []*Embed `json:"embeds"`
Reactions []*Reaction `json:"reactions"` // ?
Nonce interface{} `json:"nonce"` // NOT A SNOWFLAKE! DONT TOUCH!
Pinned bool `json:"pinned"`
WebhookID Snowflake `json:"webhook_id"` // ?
Type MessageType `json:"type"`
Activity MessageActivity `json:"activity"`
Application MessageApplication `json:"application"`
MessageReference *MessageReference `json:"message_reference"`
ReferencedMessage *Message `json:"referenced_message"`
Flags MessageFlag `json:"flags"`
StickerItems []*StickerItem `json:"sticker_items"`

// Deprecated
Stickers []*MessageSticker `json:"stickers"`
Components []*MessageComponent `json:"components"`
Interaction *MessageInteraction `json:"interaction"`
// SpoilerTagContent is only true if the entire message text is tagged as a spoiler (aka completely wrapped in ||)
SpoilerTagContent bool `json:"-"`
SpoilerTagAllAttachments bool `json:"-"`
Expand Down
14 changes: 14 additions & 0 deletions sort_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ func derefSliceP(v interface{}) (s interface{}) {
s = *t
case *[]*MessageSticker:
s = *t
case *[]*StickerItem:
s = *t
case *[]*GetReactionURLParams:
s = *t
case *[]*Reaction:
Expand Down Expand Up @@ -443,6 +445,12 @@ func sortByID(v interface{}, flags Flag) {
} else {
less = func(i, j int) bool { return s[i].ID < s[j].ID }
}
case []*StickerItem:
if descending {
less = func(i, j int) bool { return s[i].ID > s[j].ID }
} else {
less = func(i, j int) bool { return s[i].ID < s[j].ID }
}
case []*Role:
if descending {
less = func(i, j int) bool { return s[i].ID > s[j].ID }
Expand Down Expand Up @@ -923,6 +931,12 @@ func sortByName(v interface{}, flags Flag) {
} else {
less = func(i, j int) bool { return strings.ToLower(s[i].Name) < strings.ToLower(s[j].Name) }
}
case []*StickerItem:
if descending {
less = func(i, j int) bool { return strings.ToLower(s[i].Name) > strings.ToLower(s[j].Name) }
} else {
less = func(i, j int) bool { return strings.ToLower(s[i].Name) < strings.ToLower(s[j].Name) }
}
case []*Role:
if descending {
less = func(i, j int) bool { return strings.ToLower(s[i].Name) > strings.ToLower(s[j].Name) }
Expand Down

0 comments on commit bc648e9

Please sign in to comment.