APEXBox 中的错误:错误 CS1501:方法 'Connect' 没有重载需要 1 个参数
Error in APEXBox: Error CS1501: No overload for method 'Connect' takes 1 arguments
当我尝试编写我的 Discord 机器人代码时,出现此错误:
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);
}
}
}
你应该使用带有两个参数的方法
await discord.Connect("MzAzMzQyMzAyNjUzMzE3MTIx.C9X34w.loaFfJMxb1N2o7Aoqf0H4xVMnGo",TokenType.Bot);
当我尝试编写我的 Discord 机器人代码时,出现此错误:
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);
}
}
}
你应该使用带有两个参数的方法
await discord.Connect("MzAzMzQyMzAyNjUzMzE3MTIx.C9X34w.loaFfJMxb1N2o7Aoqf0H4xVMnGo",TokenType.Bot);