package moderation import ( "context" "fmt" "net/http" "go.fifitido.net/twitch/api/endpoint" ) type AutoModAction string const ( AutoModActionAllow AutoModAction = "ALLOW" AutoModActionDeny AutoModAction = "DENY" ) type ManageHeldAutoModMessagesRequest struct { // The moderator who is approving or denying the held message. This ID must match the user ID in the access token. UserID string `url:"user_id"` // The ID of the message to allow or deny. MsgID string `url:"msg_id"` // The action to take for the message. Action AutoModAction `url:"action"` } // Allow or deny the message that AutoMod flagged for review. // For information about AutoMod, see How to Use AutoMod: https://help.twitch.tv/s/article/how-to-use-automod // // To get messages that AutoMod is holding for review, subscribe to the automod-queue.. topic using PubSub. // PubSub sends a notification to your app when AutoMod holds a message for review. // // Requires a user access token that includes the moderator:manage:automod scope. func (m *Moderation) ManageHeldAutoModMessages(ctx context.Context, body *ManageHeldAutoModMessagesRequest) error { req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(m.baseUrl, "moderation/automod/message"), nil) if err != nil { return err } res, err := m.client.Do(req) if err != nil { return err } defer res.Body.Close() statusOK := res.StatusCode >= 200 && res.StatusCode < 300 if !statusOK { return fmt.Errorf("failed to manage held AutoMod messages (%d)", res.StatusCode) } return nil }