2017-07-19 56 views
-3

嘿,我正在尝试创建一个使用c#的机器人,但当我输入DiscordClient时出现错误。 这是我的Program.cs文件DiscordClient not recognized

using System; 

namespace firstbot 
{ 
class MainClass 
{ 
    public static void Main(string[] args) 
    { 
     MyBot bot = new MyBot(); 
    } 
} 

}

这里是MyBot.cs文件

using System; 
using Discord; 
using Discord.Commands; 

namespace firstbot 
{ 
public class MyBot 
{ 
    DiscordClient discord; //error comes here 
    public MyBot() 
    { 



    } 
    } 
    } 

的错误是: 命名空间DiscordClient的类型不能被发现。我不确定什么是错的,需要一些帮助。 在此先感谢

+0

Install-Package DiscordSharp +添加使用。 – NtFreX

回答

0

下面是如何安装Discord.net:顶部

  1. 转到项目并选择管理的NuGet包

  2. 一旦进入Nuget包管理器,搜索“Di scord.Net”

  3. 确保包括抢鲜被旁边的搜索栏进行检查。

  4. 安装顶部的选项:Discord.Net V1.0.1

1

其实,Discord.NET的新版本(> 0.9)不再使用DiscordClient。 您必须改用DiscordSocketClient

您有一个示例here