Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed May 16, 2022
1 parent aa18999 commit 01a73fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 6 additions & 6 deletions discord/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,13 @@ type Message struct {
Stickers []MessageSticker `json:"sticker_items,omitempty"`
ReferencedMessage *Message `json:"referenced_message,omitempty"`
LastUpdated *time.Time `json:"last_updated,omitempty"`
Thread GuildThread `json:"thread,omitempty"`
Thread *MessageThread `json:"thread,omitempty"`
}

func (m *Message) UnmarshalJSON(data []byte) error {
type message Message
var v struct {
Components []UnmarshalComponent `json:"components"`
Thread *UnmarshalChannel `json:"thread"`
message
}

Expand All @@ -92,10 +91,6 @@ func (m *Message) UnmarshalJSON(data []byte) error {
}
}

if v.Thread != nil {
m.Thread = v.Thread.Channel.(GuildThread)
}

return nil
}

Expand Down Expand Up @@ -183,6 +178,11 @@ func (m *Message) SelectMenuByID(customID CustomID) *SelectMenuComponent {
return nil
}

type MessageThread struct {
GuildThread
Member ThreadMember `json:"member"`
}

type MessageSticker struct {
ID snowflake.ID `json:"id"`
Name string `json:"name"`
Expand Down
10 changes: 6 additions & 4 deletions rest/rest_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ func (c *clientImpl) RateLimiter() rrate.Limiter {
}

func (c *clientImpl) retry(cRoute *route.CompiledAPIRoute, rqBody any, rsBody any, tries int, opts []RequestOpt) error {
rqURL := cRoute.URL()
var rawRqBody []byte
var err error
var contentType string
var (
rqURL = cRoute.URL()
rawRqBody []byte
err error
contentType string
)

if rqBody != nil {
switch v := rqBody.(type) {
Expand Down

0 comments on commit 01a73fe

Please sign in to comment.