2017-04-17 210 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'旁邊 –

相關問題