Skip to main content
L’object moderation comprend plusieurs methods en rapport avec votre chaine

Action disponible

ban

Bannir un utilisateur de la chaine
const banUser = await ctx.twitch.moderation.ban({
  reason: "Raison du ban",
  userId: "user_id",
  duration: 1,
})
Arguments
reason
string
required
La raison du ban
userId
string | number
required
L’id de l’utilisateur à bannir
duration
number
La durée du ban, si non spécifié, le ban est permanent
Type de retour La méthode retourne un object BanUser

unban

Débannir un utilisateur de la chaine
await ctx.twitch.moderation.unban("user_id")

checkBan

Verifie si un utilisateur est banni de la chaine
const isBanned = await ctx.twitch.moderation.checkBan("user_id")

getModerators

Récuperer la listes de moderateurs de la chaine
const moderations = await ctx.twitch.moderation.getModerators()

moderations.forEach((user) => {
  console.log(user.userDisplayName)
})

addModerator

Ajouter un modérateur à la chaine
await ctx.twitch.moderation.addModerator("user_id")

removeModerator

Supprimer un modérateur de la chaine
ctx.twitch.moderation.removeModerator("user_id")

checkModerator

Vérifier si un utilisateur est modérateur de la chaine
const isModerator = await ctx.twitch.moderation.checkModerator("user_id")

getBlockedTerms

Récuperer la liste des termes bloqués de la chaine
const blockedTerms = await ctx.twitch.moderation.getBlockedTerms()

blockedTerms.forEach((term) => {
  console.log(term.text)
})
Retourne un tableau d’object BlockedTerm

addBlockedTerm

Ajouter un terme à la liste des termes bloqués de la chaine
await ctx.twitch.moderation.addBlockedTerm("term")

removeBlockedTerm

Supprimer un terme de la liste des termes bloqués de la chaine
await ctx.twitch.moderation.removeBlockedTerm("term_id")

Types

Listes des types de retour des méthodes de l’object moderation

ChatChatter

userId
string
An array of groups with all the pages within that group
userName
string
An array of groups with all the pages within that group
userDisplayName
string
An array of groups with all the pages within that group

BanUser

creationDate
Date
An array of groups with all the pages within that group
expiryDate
Date
An array of groups with all the pages within that group
moderationId
string
An array of groups with all the pages within that group
userId
string
An array of groups with all the pages within that group

BlockedTerm

id
string
L’id du terme
creationDate
Date
La date de création du terme
expirationDate
Date
La date d’expiration du terme
updatedDate
Date
La date de mise à jour du terme
moderatorId
string
L’id du modérateur qui a ajouté le terme
text
string
Le texte du terme bloqué
I