Name |
Type |
Description |
display |
string |
The display name of the user Example: TwitchUser123 |
gameId |
string |
Stream game ID, if the user is currently live Example: 2491012 |
gameName |
string |
Stream game name, if the user is currently live Example: Just Chatting |
id |
string |
The user id of the user Example: 12345678 |
isSubscribed |
boolean |
Is the user subscribed? Example: true |
role |
number |
The role of the user 1=Viewer, 2=VIP, 3=Moderator, 4=Broadcaster Example: 1 |
startedAt |
DateTime |
Stream start time, if the user is currently live Example: 8/4/2023 10:56:06 AM |
title |
string |
Stream title, if the user is currently live Example: My Stream |
userName |
string |
The user name of the user Example: twitchuser123 |
viewerCount |
number |
Stream viewer count, if the user is currently live Example: 12 |
using System;
using System.Collections.Generic;
public class CPHInline
{
public bool Execute()
{
List<Dictionary<string, object>> users;
if (CPH.TryGetArg("users", out users))
{
foreach (var user in users)
{
// Récupérer chaque donnée avec vérification du type approprié
string displayName = user.ContainsKey("display") ? user["display"] as string : "N/A";
string id = user.ContainsKey("id") ? user["id"] as string : "N/A";
bool isSubscribed = user.ContainsKey("isSubscribed") && (bool)user["isSubscribed"];
int role = user.ContainsKey("role") ? Convert.ToInt32(user["role"]) : 0;
string userName = user.ContainsKey("userName") ? user["userName"] as string : "N/A";
// Afficher les données récupérées
CPH.LogInfo($"User: {displayName} (ID: {id})");
CPH.LogInfo($"Username: {userName}");
CPH.LogInfo($"Subscribed: {isSubscribed}");
CPH.LogInfo($"Role: {role}");
CPH.LogInfo("--------------------------");
}
}
else
{
CPH.LogInfo("No users found.");
}
return true;
}
}