lionfaggot Posted April 20, 2014 Posted April 20, 2014 (edited) this bot just sits in channels sends an amsg to all channels at random and waits for pms then replies based on your autoreply. not too useful but it was a test script i made for irc stuff to come, it uses ie.au3 as the debug, i was thinking about making an irc client that uses ie as the debug in a way that allows you to use javascript and the like as client addon scripts. probably a tad insecure but itd be cool. the names it picks when it connects are grabbed from the random girls list on vampirefreaks.com, you can choose whether you wish to use the selected name or not. feel free to modify my stuff! here's the code: expandcollapse popup#NoTrayIcon #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <File.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Mibbit Sextastic Bot", 623, 449, 192, 114) $OBJECT = ObjCreate("Shell.Explorer.2") $OBJECT_CTRL = GUICtrlCreateObj($OBJECT, 0, 0, 510, 350) $channels = GUICtrlCreateInput("channels to join, split channels using , to join multiple", 88, 368, 153, 21) $connect = GUICtrlCreateButton("CONNECT", 0, 368, 81, 57) $presponse = GUICtrlCreateInput("PM response message", 88, 400, 497, 21) $CLEAR = GUICtrlCreateButton("clear debug", 520, 24, 97, 25) $amsg = GUICtrlCreateButton("amsg", 520, 56, 97, 25) $camsg = GUICtrlCreateButton("delete amsg", 520, 86, 97, 25) GUISetState(@SW_SHOW) _IENavigate($OBJECT, "http://freewebs.com/goldnetwork/mibbot.html") GUISetOnEvent($GUI_EVENT_CLOSE, "_quit") GUICtrlSetOnEvent($connect, "_GConnect") GUICtrlSetOnEvent($CLEAR, "_GClear") GUICtrlSetOnEvent($amsg, "_Amsg") GUICtrlSetOnEvent($camsg, "_camsg") Func _quit() Exit EndFunc ;==>_quit TCPStartup() Global $isocket Global $nick = "Porkbot" Global $chan = "#porkworld" Global $respmsg = "" Global $debug = "<body bgcolor='black'><font color='lightgreen'><plaintext>" Global $blist = "" Global $go = 0 Global $input = "" Global $pcount = 0 Global $logon = 0 Func _GClear() Global $debug = "<body bgcolor='black'><font color='lightgreen'><plaintext>debug cleared..." & @CRLF _IEDocWriteHTML($OBJECT, $debug) EndFunc ;==>_GClear Func _camsg() FileDelete("amsg.txt") _debugme("Amsg list cleared...") $OBJECT.document.parentwindow.scroll(0, $OBJECT.document.body.scrollHeight / 900000) EndFunc ;==>_camsg Func _amsg() $input = InputBox("AMSG", "input something to msg all channels with occasionally") FileWrite("amsg.txt", $input & @CRLF) _debugme("Amsg list updated...") EndFunc ;==>_amsg Func _GConnect() If $go = 0 Then If StringMid(GUICtrlRead($channels), 1, 1) = "#" And GUICtrlRead($presponse) <> "" And GUICtrlRead($presponse) <> "PM response message" Then Global $go = 1 _setnick() Global $chan = GUICtrlRead($channels) Global $respmsg = GUICtrlRead($presponse) _IRConnect("irc.uk.mibbit.net") _debugme("Connecting...") GUICtrlSetData($connect, "DISCONNECT") Else MsgBox(0, "Alert", "Fill out all fields before connecting") EndIf Else $go = 0 $logon = 0 GUICtrlSetData($connect, "CONNECT") TCPCloseSocket($isocket) _debugme("DISCONNECTED...") EndIf EndFunc ;==>_GConnect Func _setnick() $vhtml = StringReplace(BinaryToString(InetRead("http://vampirefreaks.com/random_profiles.php?sex=female", 1)), ">", @CRLF) $vsplit = StringSplit($vhtml, @CRLF) $gay = Random(1, 50, 1) $z = 1 For $v = 1 To $vsplit[0] If StringInStr($vsplit[$v], "member_thumbnail") Then If $z = $gay Then $ppp = StringSplit($vsplit[$v], "/") Global $nick = $ppp[7] _debugme("Nick Selected: " & $nick) $proceed = MsgBox(4, "Do you wish to use the nickname " & $nick & "?", "Clicking no will generate another.") If $proceed = 7 Then _debugme("Retrying, selecting new nick...") _setnick() EndIf ExitLoop EndIf $z += 1 EndIf Next EndFunc ;==>_setnick Func _debugme($deb) $debug &= $deb & @CRLF _IEDocWriteHTML($OBJECT, $debug) $OBJECT.document.parentwindow.scroll(0, $OBJECT.document.body.scrollHeight) EndFunc ;==>_debugme Func _IRConnect($host, $port = 6667) $isocket = TCPConnect(TCPNameToIP($host), $port) If $isocket = -1 Then TCPCloseSocket($isocket) Return 0 Else TCPSend($isocket, "NICK " & $nick & @CRLF) TCPSend($isocket, "USER " & $nick & " 0 0 " & $nick & @CRLF) If @error Then TCPCloseSocket($isocket) Return 0 Else Return 1 EndIf EndIf EndFunc ;==>_IRConnect Func _Ping($presp) TCPSend($isocket, "PONG " & $presp & @CRLF) EndFunc ;==>_Ping Func _msg($targ, $msg) TCPSend($isocket, "PRIVMSG " & $targ & " :" & $msg & @CRLF) If @error Then TCPCloseSocket($isocket) Return 0 Else _debugme("MESSAGE TO " & $targ & ": <" & $nick & "> " & $msg) Return 1 EndIf EndFunc ;==>_msg Func _msgall() $line = FileReadLine("amsg.txt", Random(1, _FileCountLines("amsg.txt"), 1)) _msg($chan, $line) EndFunc ;==>_msgall While 1 Sleep(100) If $go = 1 Then $recv = TCPRecv($isocket, 65000) If @error Then $logon = 0 _debugme("Lost connection... reconnecting") _IRConnect("irc.uk.mibbit.net") EndIf $tsplit = StringSplit($recv, @CRLF) For $i = 1 To $tsplit[0] $tsp = StringSplit($tsplit[$i], " ") If $tsp[0] >= 2 Then If $tsp[1] = "PING" Then If FileExists("amsg.txt") Then $pcount += 1 If $pcount = 3 Then _msgall() $pcount = 0 EndIf EndIf $presp = $tsp[2] _Ping($presp) EndIf If $tsp[2] = "MODE" And $logon = 0 Then TCPSend($isocket, "JOIN " & $chan & @CRLF) _debugme("Connected... joined: " & $chan) $logon = 1 EndIf If $tsp[2] = "PRIVMSG" And $tsp[3] = $nick Then $kkk = StringSplit(StringReplace($tsp[1], ":", ""), "!") $rnick = $kkk[1] If StringInStr($blist, $rnick) = 0 Then If $rnick <> "IRC" Then $disp = "" For $a = 4 To $tsp[0] If $a = 4 Then $ddd = StringSplit($tsp[$a], ":") $disp &= $ddd[2] & " " Else $disp &= $tsp[$a] & " " EndIf Next _debugme("PM: <" & $rnick & "> " & $disp) _msg($rnick, $respmsg) $blist &= $rnick & @CRLF EndIf EndIf EndIf EndIf Next EndIf WEnd Edited April 20, 2014 by lionfaggot
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now