尝试使用Discord.NET 1.0并遵循foxbot指南
我使用了这段代码:
using System;
using System.Threading.Tasks;
using Discord;
using Discord.WebSocket;
namespace MyBot
{
class Program
{
static void Main(string[] args)
=> new Program().StartAsync().GetAwaiter().GetResult();
private DiscordSocketClient _client;
public async Task StartAsync()
{
_client = new DiscordSocketClient();
await _client.LoginAsync(TokenType.Bot, "Mzmkl......");
await _client.StartAsync();
await Task.Delay(-1);
}
}
}
尝试编译并没有让我的机器人在线。我按照步骤,我的机器人包括在内。 Bot included
答案 0 :(得分:0)
这是System.PlatformNotSupportedException错误。我使用Win7。 解决方案是安装WS4NET并添加:
_client = new DiscordSocketClient(new DiscordSocketConfig {
WebSocketProvider = Discord.Net.Providers.WS4Net.WS4NetProvider.Instance
});