2017-03-01 12 views
1

私はツイッチのためにチャットボットを作ろうとしています。私は非常にユーザーフレンドリーなフォームにしたいので、私はツイッチ通信を完了しましたが、今私のフォームは初期化されません。助けてください。トゥッチボットフォームは初期化されません

namespace TwitchBotForm 
 
{ 
 
    public partial class Form1 : Form 
 
    { 
 

 
     public Form1() 
 
     { 
 
      InitializeComponent(); 
 
      IrcClient irc = new IrcClient("irc.twitch.tv", 6667, "z_bot909", "oauth:dn2tixd1xd7krggyn49ztw08hmfjea"); 
 
      irc.joingRoom("z_dog909"); 
 
      irc.sendChatMessage("Startup Complete"); 
 
      while (true) 
 
      { 
 
       string message = irc.readMessage(); 
 
       string[] splitMessage = message.Split('#'); 
 
       if (message.Contains("!info")) 
 
       { 
 
        irc.sendChatMessage("Please Keep all commands LowerCase I made this bot Myself and i think its pretty cool. do !Help for Commands"); 
 
       } 
 
       if (message.Contains("!me")) 
 
       { 
 
        irc.sendChatMessage(splitMessage[1].Split(':')[0]); //Username 
 
       } 
 
      } 
 
     } 
 

 
    } 
 
}

答えて

0

あなたは、フォームのコンストラクタで、この無限ループを置くべきではありません。

Windowsフォームでバックグラウンドスレッドを実行する方法については、this articleを確認してください。

関連する問題