TITLE "Steve QB64-IRC Bot"
nick$ = "SqbBot"
pass$ = ""
Server = "irc.freenode.net"
Channel = "#qb64"
PRINT "Connecting to " + Server
+ "..." IF pass$
> "" THEN SendInfo
"PASS" + pass$
SendInfo "NICK " + nick$
SendInfo "USER " + nick$ + " 0 * :" + nick$
SendInfo "JOIN " + Channel
SendInfo "TOPIC " + Channel
respond = 0
'Respond with PONG
'IF In$ <> "" THEN PRINT LEFT$(In$, LEN(In$) - 2) 'Unremark this is we want to see what's being typed by everyone.
IF In$
<> "" AND respond
THEN ProcessInput In$
IF INSTR(In$
, "End of /NAMES list.") THEN respond
= -1 'Don't start responding to the automatic server messages, like an idiot bot!
text$
= "PRIVMSG " + Channel$
+ " :" + text$
+ CHR$(13) + CHR$(10)
Speaker$
= MID$(text$
, 2, INSTR(text$
, "!") - 2)
'someone is talking directly to the bot or giving it a command
IF INSTR(eval$
, " SHUT DOWN ") THEN SYSTEM 'A means to automatically shut down the bot
IF INSTR(eval$
, " HELLO ") THEN Out$
= "Hello to you too, " + Speaker$
+ ". " IF INSTR(eval$
, " YO ") THEN Out$
= "Hola! " + Speaker$
+ " How's it hanging? " IF INSTR(eval$
, " HOLA ") THEN Out$
= "What's happening, " + Speaker$
+ "? "
l
= INSTR(In$
, "PRIVMSG") PRINT Speaker$;
" on ";
MID$(In$
, l
+ 8) 'I put a print here, so we can see what our bot is responding to, no matter what.