Overview
Can be accessed using client.chat
on an ApiClient instance.
Example
const api = new ApiClient({ authProvider }); const rewards = await api.chat.getChannelBadges('125328655');
Methods
getChannelBadges(broadcaster)
asyncGets all badges specific to the given broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster to get badges for. |
getChannelEmotes(broadcaster)
asyncGets all emotes specific to the given broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster to get emotes for. |
getChatters(broadcaster, pagination)
asyncGets the list of users that are connected to the broadcaster’s chat session.
This uses the token of the broadcaster by default. If you want to execute this in the context of another user (who has to be moderator of the channel) you can do so using user context overrides.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster whose list of chatters you want to get. | |
pagination | HelixForwardPagination | none | see below | |
pagination.after | string | none | A cursor to get the following page of. | |
pagination.limit | number | none | The number of results per page. |
getChattersPaginated(broadcaster)
Creates a paginator for users that are connected to the broadcaster’s chat session.
This uses the token of the broadcaster by default. If you want to execute this in the context of another user (who has to be moderator of the channel) you can do so using user context overrides.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster whose list of chatters you want to get. |
getColorForUser(user)
asyncGets the chat color for a user.
Returns the color as hex code, null
if the user did not set a color, or undefined
if the user is unknown.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to get the chat color of. |
getColorsForUsers(users)
asyncGets the chat colors for a list of users.
Returns a Map with user IDs as keys and their colors as values.
The value is a color hex code, or null
if the user did not set a color,
and unknown users will not be present in the map.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
users | UserIdResolvable []A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The users to get the chat colors of. |
getEmotesFromSets(setIds)
asyncGets all emotes from a list of emote sets.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
setIds | string[] | none | The IDs of the emote sets to get emotes from. |
getSettings(broadcaster)
asyncGets the settings of a broadcaster's chat.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster the chat belongs to. |
getSettingsPrivileged(broadcaster)
asyncGets the settings of a broadcaster's chat, including the delay settings.
This uses the token of the broadcaster by default. If you want to execute this in the context of another user (who has to be moderator of the channel) you can do so using user context overrides.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster the chat belongs to. |
sendAnnouncement(broadcaster, announcement)
asyncSends an announcement to a broadcaster's chat.
This uses the token of the broadcaster by default. If you want to execute this in the context of another user (who has to be moderator of the channel) you can do so using user context overrides.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster the chat belongs to. | |
announcement | HelixSendChatAnnouncementParams | none | The announcement to send. |
sendChatMessage(broadcaster, message, params)
asyncSends a chat message to a broadcaster's chat.
This uses the token of the broadcaster by default. If you want to execute this in the context of another user you can do so using user context overrides.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster the chat belongs to. | |
message | string | none | The message to send. | |
params | HelixSendChatMessageParams | none | see below | |
params.replyParentMessageId | string | none | The ID of the chat message being replied to. If this is not set, message will not be sent as a reply. |
sendChatMessageAsApp(user, broadcaster, message, params)
asyncSends a chat message to a broadcaster's chat, using an app token.
This requires the scopes user:write:chat
and user:bot
for the user
and channel:bot
for the broadcaster
.
channel:bot
is not required if the user
has moderator privileges in the broadcaster
's channel.
These scope requirements can not be checked by the library, so they are just assumed. Make sure to catch authorization errors yourself.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to send the chat message from. | |
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster the chat belongs to. | |
message | string | none | The message to send. | |
params | HelixSendChatMessageParams | none | see below | |
params.replyParentMessageId | string | none | The ID of the chat message being replied to. If this is not set, message will not be sent as a reply. |
setColorForUser(user, color)
asyncChanges the chat color for a user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to change the color of. | |
color | HelixChatUserColor Colors that can be used by users in chat. Note that hex codes can only be used by users that have a Prime or Turbo subscription. Aliased type: "blue" | "blue_violet" | "cadet_blue" | "chocolate" | "coral" | "dodger_blue" | "firebrick" | "golden_rod" | "green" | "hot_pink" | "orange_red" | "red" | "sea_green" | "spring_green" | "yellow_green" | `#${string}` | none | The color to set. Note that hex codes can only be used by users that have a Prime or Turbo subscription. |
shoutoutUser(from, to)
asyncSends a shoutout to the specified broadcaster. The broadcaster may send a shoutout once every 2 minutes. They may send the same broadcaster a shoutout once every 60 minutes.
This uses the token of the broadcaster by default. If you want to execute this in the context of another user (who has to be moderator of the channel) you can do so using user context overrides.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
from | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The ID of the broadcaster that’s sending the shoutout. | |
to | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The ID of the broadcaster that’s receiving the shoutout. |
updateSettings(broadcaster, settings)
asyncUpdates the settings of a broadcaster's chat.
This uses the token of the broadcaster by default. If you want to execute this in the context of another user (who has to be moderator of the channel) you can do so using user context overrides.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster the chat belongs to. | |
settings | HelixUpdateChatSettingsParams | none | The settings to change. | |
settings.emoteOnlyModeEnabled | boolean | none | Whether emote only mode should be enabled. | |
settings.followerOnlyModeDelay | number | none | The time after which users should be able to send messages after following, in minutes. | |
settings.followerOnlyModeEnabled | boolean | none | Whether follower only mode should be enabled. | |
settings.nonModeratorChatDelay | number | none | The delay of non-moderator messages, in seconds. | |
settings.nonModeratorChatDelayEnabled | boolean | none | Whether non-moderator messages should be delayed. | |
settings.slowModeDelay | number | none | The time to wait between messages in slow mode, in seconds. | |
settings.slowModeEnabled | boolean | none | Whether slow mode should be enabled. | |
settings.subscriberOnlyModeEnabled | boolean | none | Whether subscriber only mode should be enabled. | |
settings.uniqueChatModeEnabled | boolean | none | Whether unique chat mode should be enabled. |