當我嘗試代碼我的不和諧的機器人,這種錯誤出現:錯誤APEXBox:錯誤CS1501:沒有重載方法「連接」需要1個參數
Error: "/Users/jadenlee/Projects/APEXBot/APEXBot/MyBot.cs(19,19): Error CS1501: No overload for method 'Connect' takes 1 arguments (CS1501) (APEXBot)"
這是我當前的代碼現在。
using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
namespace APEXBot
{
class MyBot
{
DiscordClient discord;
public MyBot()
{
discord = new DiscordClient(x =>
{
x.LogLevel = LogSeverity.Info;
x.LogHandler = Log;
});
discord.ExecuteAndWait(async() =>
{
// Error here
await discord.Connect("MzAzMzQyMzAyNjUzMzE3MTIx.C9X34w.loaFfJMxb1N2o7Aoqf0H4xVMnGo");
});
}
private void Log(object sender, LogMessageEventArgs e)
{
Console.WriteLine(e.Message);
}
}
}
您好,歡迎來SO。首先,錯誤消息是完全描述性的:「DiscordClient」上沒有方法接受一個「String」參數。你需要檢查API支持哪些方法。其次,請仔細閱讀[本次討論](https://meta.stackoverflow.com/questions/326569/under-what-circumstances-may-i-add-urgent-or-other-similar-phrases-to-my-追求)在你的問題中使用ASAP這樣的詞。 –