Appearance
Class: UserModerationService
Viewer moderation sub-service: timeout, ban, warning, VIP status, moderator status and internal blacklist.
Remarks
Available everywhere via k.users.moderation. You never have to instantiate this service yourself — it is created by the SDK when the app/widget starts.
These actions act on the viewer's Twitch chat/account (except the blacklist, which is internal to Kappapps). For Kappapps roles (animator/admin/superadmin), see k.users.role.
Example
ts
// Time a viewer out for 60s then grant them VIP status
await k.users.moderation.timeout('twitchdev', 60, 'spam');
await k.users.moderation.vip('twitchdev');Methods
ban()
ts
ban(login, reason): Promise<void>;Permanently bans a viewer from the channel's Twitch chat.
Parameters
login
string
The viewer's login (Twitch username).
reason
string
Reason for the ban.
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.
Remarks
Available to widgets and all apps. Apps require moderation:ban from manifest contract 4; older versions remain exempt until their next newly created version. Widgets do not declare app scopes. Twitch authorization and viewer protections still apply; a refusal rejects the promise.
See
unban to lift the ban.
blacklist()
ts
blacklist(login): Promise<void>;Adds a viewer to the channel's internal blacklist (Kappapps).
Parameters
login
string
The viewer's login (Twitch username).
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.
See
unblacklist to remove them.
mod()
ts
mod(login, duration?): Promise<void>;Grants moderator status to a viewer, optionally for a limited duration.
Parameters
login
string
The viewer's login (Twitch username).
duration?
number = null
Duration of the mod status in seconds, or null for a permanent status.
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.
Default Value
null
See
unmod to remove the moderator status.
timeout()
ts
timeout(
login,
duration,
reason): Promise<void>;Puts a viewer in timeout (temporary exclusion from the chat).
Parameters
login
string
The viewer's login (Twitch username).
duration
number
Timeout duration, in seconds.
reason
string
Reason displayed/logged.
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.
See
untimeout to cancel it.
unban()
ts
unban(login): Promise<void>;Lifts the ban of a viewer.
Parameters
login
string
The viewer's login (Twitch username).
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.
Remarks
Available to widgets and all apps, with the same moderation:ban permission as ban() from manifest contract 4. Earlier contracts remain exempt. Uses DELETE /ban/v1; Twitch removes the active chat sanction, including a timeout. Twitch authorization and viewer protections still apply; a refusal rejects the promise.
See
ban to ban a viewer.
unblacklist()
ts
unblacklist(login): Promise<void>;Removes a viewer from the channel's internal blacklist (Kappapps).
Parameters
login
string
The viewer's login (Twitch username).
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.
See
blacklist to add them.
unmod()
ts
unmod(login): Promise<void>;Removes the moderator status of a viewer.
Parameters
login
string
The viewer's login (Twitch username).
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.
See
mod to grant the moderator status.
untimeout()
ts
untimeout(login): Promise<void>;Cancels the timeout of a viewer.
Parameters
login
string
The viewer's login (Twitch username).
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.
Remarks
Apps require moderation:manage, with the existing exemption for manifest contracts before 2. Widgets do not declare app scopes. This legacy route also lifts permanent Twitch bans; use unban() for moderation:ban access.
See
timeout to apply a timeout.
unvip()
ts
unvip(login): Promise<void>;Removes the VIP status of a viewer.
Parameters
login
string
The viewer's login (Twitch username).
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.
See
vip to grant the VIP status.
vip()
ts
vip(login, duration?): Promise<void>;Grants VIP status to a viewer, optionally for a limited duration.
Parameters
login
string
The viewer's login (Twitch username).
duration?
number = null
Duration of the VIP status in seconds, or null for a permanent status.
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.
Default Value
null
See
unvip to remove the VIP status.
warn()
ts
warn(login, reason): Promise<void>;Sends a warning to a viewer.
Parameters
login
string
The viewer's login (Twitch username).
reason
string
Reason for the warning.
Returns
Promise<void>
A promise resolved once the operation has been forwarded to the backend.