Note that there are some explanatory texts on larger screens.

plurals
  1. POAdmin users on IRC Bot
    primarykey
    data
    text
    <p>Okay so I am unfamiliar with IRC Protocol but I have read through a fair bit of it to get a better understanding but I am still unsure as to how I would set it so my bot would only follow my commands or read who the bots "admins" are from a text file. I want to implement this in order to stop everyone from making him quit and spam.</p> <p>If you need anything more specific feel free to ask and I will update the post.</p> <p>As requested:</p> <pre><code> public void sendData(string cmd, string param) { if (param == null) { sw.WriteLine(cmd); sw.Flush(); Console.WriteLine(cmd); } else { sw.WriteLine(cmd + " " + param); sw.Flush(); Console.WriteLine(cmd + " " + param); } } public void IRCWork() { string[] ex; string data; bool shouldRun = true; while (shouldRun) { data = sr.ReadLine(); Console.WriteLine(data); char[] charSeparator = new char[] { ' ' }; ex = data.Split(charSeparator, 5); if (ex[0] == "PING") { sendData("PONG", ex[1]); } if (ex.Length &gt; 4) //is the command received long enough to be a bot command? { string command = ex[3]; //grab the command sent switch (command) { case ":!join": sendData("JOIN", ex[4]); //if the command is !join send the "JOIN" command to the server with the parameters set by the user break; case ":!say": sendData("PRIVMSG", ex[2] + " " + ex[4]); //if the command is !say, send a message to the chan (ex[2]) followed by the actual message (ex[4]). break; case ":!quit": sendData("QUIT", ex[4]); //if the command is quit, send the QUIT command to the server with a quit message shouldRun = false; //turn shouldRun to false - the server will stop sending us data so trying to read it will not work and result in an error. This stops the loop from running and we will close off the connections properly break; case ":!part": sendData("PART", ex[4]); break; case ":!query": sendData("QUERY", ex[4] + ex[4]); break; case ":!useradd": sendData("USERADD", ex[4]); break; } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload