Skip to content

Commit

Permalink
change put to post http method and change params to json body
Browse files Browse the repository at this point in the history
  • Loading branch information
diPhantxm committed Feb 8, 2024
1 parent 2f8fdff commit a251eff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,21 +431,21 @@ func (c *Client) UpdateUserChatColor(params *UpdateUserChatColorParams) (*Update

type SendChatMessageParams struct {
// The ID of the broadcaster whose chat room the message will be sent to
BroadcasterID string `query:"broadcaster_id"`
BroadcasterID string `json:"broadcaster_id"`

// The ID of the user sending the message. This ID must match the user ID in the user access token
SenderID string `query:"sender_id"`
SenderID string `json:"sender_id"`

// The message to send. The message is limited to a maximum of 500 characters.
// Chat messages can also include emoticons.
// To include emoticons, use the name of the emote.
// The names are case sensitive.
// Don’t include colons around the name (e.g., :bleedPurple:).
// If Twitch recognizes the name, Twitch converts the name to the emote before writing the chat message to the chat room
Message string `query:"message"`
Message string `json:"message"`

// The ID of the chat message being replied to
ReplyParentMessageID string `query:"reply_parent_message_id"`
ReplyParentMessageID string `json:"reply_parent_message_id,omitempty"`
}

type ChatMessageResponse struct {
Expand Down Expand Up @@ -492,7 +492,7 @@ func (c *Client) SendChatMessage(params *SendChatMessageParams) (*ChatMessageRes
return nil, errors.New("error: sender id must be specified")
}

resp, err := c.put("/chat/messages", &ManyChatMessages{}, params)
resp, err := c.post("/chat/messages", &ManyChatMessages{}, params)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit a251eff

Please sign in to comment.