All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.twitch4j.helix.domain.ChatSettings Maven / Gradle / Ivy

There is a newer version: 1.23.0
Show newest version
package com.github.twitch4j.helix.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.With;
import lombok.experimental.Accessors;
import lombok.extern.jackson.Jacksonized;
import org.jetbrains.annotations.Nullable;

import java.time.Duration;
import java.time.temporal.ChronoUnit;

@With
@Data
@Setter(AccessLevel.PRIVATE)
@Builder(toBuilder = true)
@Jacksonized
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ChatSettings {

    /**
     * The ID of the broadcaster specified in the request.
     */
    private String broadcasterId;

    /**
     * A Boolean value that determines whether chat messages must contain only emotes.
     * Is true, if only messages that are 100% emotes are allowed; otherwise, false.
     */
    @Accessors(fluent = true)
    @JsonProperty("emote_mode")
    private Boolean isEmoteOnlyMode;

    /**
     * A Boolean value that determines whether the broadcaster restricts the chat room to followers only, based on how long they’ve followed.
     * Is true, if the broadcaster restricts the chat room to followers only; otherwise, false.
     *
     * @see #getFollowerModeDuration()
     */
    @Accessors(fluent = true)
    @JsonProperty("follower_mode")
    private Boolean isFollowersOnlyMode;

    /**
     * The length of time, in minutes, that the followers must have followed the broadcaster to participate in the chat room
     * Is null if follower_mode is false.
     * 

* When setting this through the API, the possible values range from 0 (all followers) to 129600 (3 months). The default is 0. * * @see #isFollowersOnlyMode() */ @Nullable private Integer followerModeDuration; /** * The moderator’s ID. * The response includes this field only if the request specifies a User access token that includes the moderator:read:chat_settings scope. * * @see com.github.twitch4j.auth.domain.TwitchScopes#HELIX_CHAT_SETTINGS_READ */ @Nullable private String moderatorId; /** * A Boolean value that determines whether the broadcaster adds a short delay before chat messages appear in the chat room. * This gives chat moderators and bots a chance to remove them before viewers can see the message. *

* Is true, if the broadcaster applies a delay; otherwise, false. *

* The response includes this field only if the request specifies a User access token that includes the moderator:read:chat_settings scope. * * @see #getNonModeratorChatDelayDuration() * @see com.github.twitch4j.auth.domain.TwitchScopes#HELIX_CHAT_SETTINGS_READ */ @Nullable @Accessors(fluent = true) @JsonProperty("non_moderator_chat_delay") private Boolean hasNonModeratorChatDelay; /** * The amount of time, in seconds, that messages are delayed from appearing in chat. *

* Is null if non_moderator_chat_delay is false. *

* The response includes this field only if the request specifies a User access token that includes the moderator:read:chat_settings scope. *

* When setting this through the API, the possible values are: *

    *
  • 2 — 2 second delay (recommended)
  • *
  • 4 — 4 second delay
  • *
  • 6 — 6 second delay
  • *
* * @see #hasNonModeratorChatDelay() * @see com.github.twitch4j.auth.domain.TwitchScopes#HELIX_CHAT_SETTINGS_READ */ @Nullable private Integer nonModeratorChatDelayDuration; /** * A Boolean value that determines whether the broadcaster limits how often users in the chat room are allowed to send messages. *

* Is true, if the broadcaster applies a delay; otherwise, false. * * @see #getSlowModeWaitTime() */ @Accessors(fluent = true) @JsonProperty("slow_mode") private Boolean isSlowMode; /** * The amount of time, in seconds, that users need to wait between sending messages. *

* Is null if slow_mode is false. *

* When setting this through the API, the possible values range from 3 (three-second delay) to 120 (two-minute delay). The default is 30 seconds. * * @see #isSlowMode() */ @Nullable private Integer slowModeWaitTime; /** * A Boolean value that determines whether only users that subscribe to the broadcaster’s channel can talk in the chat room. *

* Is true, if the broadcaster restricts the chat room to subscribers only; otherwise, false. */ @Accessors(fluent = true) @JsonProperty("subscriber_mode") private Boolean isSubscribersOnlyMode; /** * A Boolean value that determines whether the broadcaster requires users to post only unique messages in the chat room. *

* Is true, if the broadcaster requires unique messages only; otherwise, false. */ @Accessors(fluent = true) @JsonProperty("unique_chat_mode") private Boolean isUniqueChatMode; /** * @return the {@link Duration} of the followers-only period, or null if not enabled. */ @Nullable public Duration getFollowersOnlyLength() { return followerModeDuration != null ? Duration.of(followerModeDuration, ChronoUnit.MINUTES) : null; } /** * @return the {@link Duration} of the non-moderator chat delay, or null if not present. */ @Nullable public Duration getNonModChatDelayLength() { return nonModeratorChatDelayDuration != null ? Duration.of(nonModeratorChatDelayDuration, ChronoUnit.SECONDS) : null; } /** * @return the {@link Duration} of the slow mode, or null if not enabled. */ @Nullable public Duration getSlowModeLength() { return slowModeWaitTime != null ? Duration.of(slowModeWaitTime, ChronoUnit.SECONDS) : null; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy