不和谐编程错误
问题描述:
当我试图运行这个极其简单的命令,让我的不和谐机器人[见下文]我得到这个错误:CS0149 C#方法名预计 我相信这是指“不和谐”的discord.connect 。如果有人知道如何解决这个问题,将不胜感激。不和谐编程错误
命令: 使用Discord; 使用Discord.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ImBotOdd
{
class MyBot
{
DiscordClient discord;
public MyBot()
{
discord = new DiscordClient(x =>
{
x.LogLevel = LogSeverity.Info;
x.LogHandler = Log;
});
discord.ExecuteAndWait(async() =>
{
await discord.Connect("token", TokenType.Bot)("DONT COPY MY TOKEN");
});
}
private void Log(object sender, LogMessageEventArgs e)
{
Console.WriteLine(e.Message);
}
}
}
答
我不知道你是否固定,但它好像你还没有加入
“使用的不和谐;”
否则它应该工作(测试0.9)
我测试了这个代码,它工作正常。您使用的是哪个版本的discord.net?你使用的是什么.NET框架版本? – WQYeo