package chat import ( "context" "encoding/json" "net/http" "net/url" "github.com/google/go-querystring/query" ) type GetChatSettingsParams struct { // The ID of the broadcaster whose chat settings you want to get. BroadcasterID string `url:"broadcaster_id"` // The ID of the broadcaster or one of the broadcaster’s moderators. // // This field is required only if you want to include the non_moderator_chat_delay and non_moderator_chat_delay_duration settings in the response. // // If you specify this field, this ID must match the user ID in the user access token. ModeratorID *string `url:"moderator_id,omitempty"` } type GetChatSettingsResponse struct { // The list of chat settings. The list contains a single object with all the settings. Data []Settings `json:"data"` } // Gets the broadcaster’s chat settings. // // For an overview of chat settings, // see Chat Commands for Broadcasters and Moderators: https://help.twitch.tv/s/article/chat-commands#AllMods // and Moderator Preferences: https://help.twitch.tv/s/article/setting-up-moderation-for-your-twitch-channel#modpreferences // // Requires an app access token or user access token. func (c *Chat) GetChatSettings(ctx context.Context, params *GetChatSettingsParams) (*GetChatSettingsResponse, error) { v, _ := query.Values(params) endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/settings", RawQuery: v.Encode()}) req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil) if err != nil { return nil, err } res, err := c.client.Do(req) if err != nil { return nil, err } defer res.Body.Close() var data GetChatSettingsResponse if err := json.NewDecoder(res.Body).Decode(&data); err != nil { return nil, err } return &data, nil }