2017-04-17 216 views
-1

当我尝试代码我的不和谐的机器人,这种错误出现:错误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); 
     } 
    } 
} 
+1

您好,欢迎来SO。首先,错误消息是完全描述性的:“DiscordClient”上没有方法接受一个“String”参数。你需要检查API支持哪些方法。其次,请仔细阅读[本次讨论](https://meta.stackoverflow.com/questions/326569/under-what-c​​ircumstances-may-i-add-urgent-or-other-similar-phrases-to-my-追求)在你的问题中使用ASAP这样的词。 –

回答

0

你应该有两个参数

使用方法
await discord.Connect("MzAzMzQyMzAyNjUzMzE3MTIx.C9X34w.loaFfJMxb1N2o7Aoqf0H4xVMnGo",TokenType.Bot); 
+0

这个工作,但现在它说 '抛出System.Exception 您必须在web套接字打开后通过web套接字发送数据!' –

+0

它也说'Record Overflow'旁边 –

相关问题