Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DIM SHARED Client AS LONG
- DIM SHARED Channel AS STRING
- DIM SHARED LineEnding AS STRING
- DIM SHARED Nick AS STRING
- DIM SHARED Port AS STRING
- DIM SHARED Server AS STRING
- DIM SHARED Speaker AS STRING
- DIM SHARED TextIn AS STRING
- DIM SHARED TextOut AS STRING
- LineEnding = CHR$(10)
- OPEN "SETUP.DAT" FOR INPUT AS #1
- INPUT #1, Server
- INPUT #1, Port
- INPUT #1, Nick
- INPUT #1, Channel
- CLOSE #1
- CALL ConnectionSequence
- PollTimer = INT(TIMER)
- DO
- _LIMIT 1000
- TextIn = ""
- TextOut = ""
- 'This will respond to the server pings
- IF INT(TIMER) > PollTime + 1.5 THEN
- PollTimer = INT(TIMER)
- GET #Client&, , TextIn
- IF LEFT$(TextIn, 4) = "PING" THEN
- Resp$ = "PONG" + MID$(TextIn$, 5) + LineEnding
- PUT #Client&, , Resp$
- END IF
- END IF
- 'This will check for any new posts and read the data from the string (eg. The speaking user)
- IF TextIn <> "" THEN
- Speaker = MID$(TextIn$, 2, INSTR(TextIn$, "!") - 2)
- chantemp$ = Channel + " :"
- ChatEval$ = RIGHT$(TextIn$, LEN(TextIn$) - INSTR(TextIn$, chantemp$) - LEN(chantemp$) + 1)
- ChatEval$ = LCASE$(LEFT$(ChatEval$, LEN(ChatEval$) - 2))
- PRINT "[" + TIME$ + "] " + "<" + Speaker + ">: " + ChatEval$
- OPEN "logs\" + Channel + " " + DATE$ + ".txt" FOR APPEND AS #1
- PRINT #1, "[" + TIME$ + "] " + "<" + Speaker + ">: " + ChatEval$
- CLOSE #1
- IF ChatEval$ = "shutup hambot you stupid jew!" THEN
- OutCommand$ = "QUIT shutdown called by " + Speaker
- SendData (OutCommand$)
- END
- END IF
- IF ChatEval$ = "ping" THEN
- TextOut = "pong"
- END IF
- IF ChatEval$ = "pong" THEN
- Secs$ = STR$(VAL(RIGHT$(TIME$, 2)) - 1)
- IF VAL(Secs$) < 10 THEN
- Secs$ = "0" + STR$(VAL(Secs$))
- END IF
- PastTime$ = LEFT$(TIME$, 2) + MID$(TIME$, 3, 4) + LTRIM$(Secs$)
- TextOut = "[" + PastTime$ + "] " + "<HamBot> " + "ping"
- END IF
- IF INSTR(ChatEval$, "fagit") > 0 THEN
- IF DontKick$ <> "y" THEN
- OutCommand$ = "NICK spoderman"
- SendData (OutCommand$)
- TextOut = "ur teh bigest fagit I hav ever seen"
- BrodcastOut
- OutCommand$ = "KICK " + Channel + " " + Speaker + " fagit"
- SendData OutCommand$
- OutCommand$ = "NICK HamBot"
- SendData (OutCommand$)
- TextOut = ""
- DontKick$ = "y"
- ELSE DontKick$ = "n"
- END IF
- END IF
- IF INSTR(ChatEval$, "nigg") > 0 THEN
- OutCommand$ = "NICK J3W_N1663R"
- SendData (OutCommand$)
- TextOut = "I've been saving up these pennies for 3 years to buy some fried chicken at KFC!!"
- BrodcastOut
- OutCommand$ = "NICK HamBot"
- SendData (OutCommand$)
- TextOut = ""
- END IF
- IF a = a THEN
- END IF
- IF ChatEval$ = "hello hambot" THEN
- TextOut = "Hello " + Speaker
- END IF
- END IF
- tmp$ = INKEY$
- IF LCASE$(tmp$) = "j" THEN
- OutCommand$ = "PRIVMSG NickServ :identify Fuk-u-Komputerkid" + LineEnding
- SendData (OutCommand$)
- SLEEP 2
- OutCommand$ = "JOIN " + Channel + LineEnding
- SendData (OutCommand$)
- END IF
- 'Send out the text to the channel
- IF TextOut <> "" THEN
- BrodcastOut
- END IF
- LOOP
- SUB ConnectionSequence
- PRINT "Attempting connection to " + Server + " on port " + Port;
- Client = _OPENCLIENT("TCP/IP:" + Port + ":" + Server): PRINT "..."
- IF Client THEN
- PRINT "Sucsessfuly connected to " + Server
- ELSE
- PRINT "Connection failed!"
- END IF
- PRINT "Sending NICK... " + Nick: SendData ("NICK " + Nick)
- PRINT "Sending USER... " + Nick: SendData ("USER " + Nick + " 0 * : " + Nick)
- PRINT "Sending JOIN... " + Channel: SendData ("JOIN " + Channel)
- PRINT "Sending TOPIC..." + Channel: SendData ("Topic " + Channel)
- PRINT "Sucsessfuly joined " + Channel
- END SUB
- SUB SendData (TextIn$)
- txt$ = TextIn$ + LineEnding
- PUT #Client&, , txt$
- PRINT txt$
- OPEN "logs\" + Channel + " - " + DATE$ + ".txt" FOR APPEND AS #1
- PRINT #1, "[" + TIME$ + "] " + txt$
- CLOSE #1
- END SUB
- SUB BrodcastOut
- txt$ = "PRIVMSG " + Channel + " :" + TextOut + LineEnding
- PUT #Client&, , txt$
- COLOR 4: PRINT "[" + TIME$ + "] " + LEFT$(txt$, LEN(txt$) - 1): COLOR 7
- OPEN "logs\" + Channel + " - " + DATE$ + ".txt" FOR APPEND AS #1
- PRINT #1, "[" + TIME$ + "] " + LEFT$(txt$, LEN(txt$) - 1): COLOR 7
- CLOSE #1
- END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement