【发布时间】:2017-05-22 08:40:43
【问题描述】:
首先 - 我知道有人问过这个问题。我几乎不知道 C# 还在学习,很多代码来自教程,所以我希望我能对我的实际代码有更直接的答案。我正在制作一个抽搐机器人。
private void ViewListUpdate()
{
ViewerBox.Items.Clear();
Chatters AllChatters = ChatClient.GetChatters("name");
chatBox.Text += "Checking the viewer list...";
foreach (string admin in AllChatters.Admins)
{
ViewerBox.Items.Add(admin + Environment.NewLine);
}
foreach (string staff in AllChatters.Staff)
{
ViewerBox.Items.Add(staff + Environment.NewLine);
}
foreach (string globalmod in AllChatters.GlobalMods)
{
ViewerBox.Items.Add(globalmod + Environment.NewLine);
}
foreach (string moderator in AllChatters.Moderators)
{
ViewerBox.Items.Add(moderator + Environment.NewLine);
}
foreach (string viewers in AllChatters.Viewers)
{
ViewerBox.Items.Add(viewers + Environment.NewLine);
}
}
得到错误 (System.IndexOutOfRangeException: 'Index was outside the bounds of the array.') 的行如下:
Chatters AllChatters = ChatClient.GetChatters("name");
任何帮助都会很棒,谢谢。
【问题讨论】:
-
显示
GetChatters的实现 -
@nbokmans 它说它没有实现。我正在使用:
using TwitchCSharp.Clients; using TwitchCSharp.Models;当我将鼠标悬停在“GetChatters”上时,这行代码显示Chatters TwitchROChat.GetChatters(string channel, [TwitchCSharp.Helpers.PagingInfo pagingInfo = null])我正在使用已添加到资源中的 TwitchCSharp.dll 文件。 -
你从哪里得到的 dll?
-
@nbokmans 通过本教程youtube.com/watch?v=bd87CS-Q7V4
-
因为我无法观看 youtube.. “名称”不应该是频道名称吗? “名称”真的是频道名称吗?