Skip to content

Commit 70fd69f

Browse files
fix: payload for sendmessage to prevent upsert user (#274)
* fix: payload for sendmessage to prevent upsert user * build: change max-parallel on CI to 3
1 parent 8580735 commit 70fd69f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
name: 👷 Test & Build
1515
runs-on: ubuntu-latest
1616
strategy:
17-
max-parallel: 1
17+
max-parallel: 3
18+
fail-fast: false
1819
matrix:
1920
goVer: ['1.17', '1.18', '1.19', '1.20', '1.21', '1.22']
2021
steps:

message.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type Message struct {
3131
Silent bool `json:"silent,omitempty"`
3232

3333
User *User `json:"user"`
34+
UserID string `json:"user_id"`
3435
Attachments []*Attachment `json:"attachments"`
3536
LatestReactions []*Reaction `json:"latest_reactions"` // last reactions
3637
OwnReactions []*Reaction `json:"own_reactions"`
@@ -94,7 +95,7 @@ func (m *Message) toRequest() messageRequest {
9495
Text: m.Text,
9596
Type: m.Type,
9697
Attachments: m.Attachments,
97-
User: messageRequestUser{ID: m.User.ID},
98+
UserID: m.UserID,
9899
ExtraData: m.ExtraData,
99100
Pinned: m.Pinned,
100101
ParentID: m.ParentID,
@@ -127,7 +128,7 @@ type messageRequestMessage struct {
127128
Text string `json:"text"`
128129
Type MessageType `json:"type" validate:"omitempty,oneof=system"`
129130
Attachments []*Attachment `json:"attachments"`
130-
User messageRequestUser `json:"user"`
131+
UserID string `json:"user_id"`
131132
MentionedUsers []string `json:"mentioned_users"`
132133
ParentID string `json:"parent_id"`
133134
ShowInChannel bool `json:"show_in_channel"`
@@ -257,6 +258,7 @@ func (ch *Channel) SendMessage(ctx context.Context, message *Message, userID str
257258
}
258259

259260
message.User = &User{ID: userID}
261+
message.UserID = userID
260262
p := path.Join("channels", url.PathEscape(ch.Type), url.PathEscape(ch.ID), "message")
261263

262264
req := message.toRequest()

0 commit comments

Comments
 (0)