WhiteTiger Posted November 19, 2006 Share Posted November 19, 2006 (edited) udf to connect to an IRC server just made this for my irc-bot , but this might be usefull for some other peepz :-) you only need to fil in server but you can fill in a load more shit if there are peepz who like it then i shall write a better instructon , and uh , hf :-) expandcollapse popupFunc _ircconnect($server,$port=6667,$name="WhiteTigerUDF",$chan="#autoit",$flag=false) if $server = "" then Return -1 TCPStartup() $con = TCPConnect(TCPNameToIP($server),$port) if $con = -1 then Return -2 $send1 = TCPSend($con,"NICK "&$name &@CRLF) if $send1 = 0 then Return -3 do $recv = TCPRecv($con,1024) until $recv <> "" if StringInStr($recv,"PING :") then $lijn = StringSplit($recv,@CR) $lijn = StringReplace($lijn[2],"PING :","PONG :") msgbox(0,"",$lijn) tcpsend($con,$lijn &@CRLF) endif tcpsend($con,"USER "&$name&" 0 0 "&$name&@crlf) do $recv = TCPRecv($con,1024) until $recv <> "" if StringInStr($recv,"PING :") then $lijn = StringSplit($recv,@CR) $lijn = StringReplace($lijn[2],"PING :","PONG :") if StringInStr($lijn,@lf) then StringReplace($lijn,@lf,"") if StringInStr($lijn,@cr) then StringReplace($lijn,@cr,"") if StringInStr($lijn,@crlf) then StringReplace($lijn,@crlf,"") if stringinstr($lijn,asc(10)) then StringReplace($lijn,asc(10),"") $lijn = StringStripCR($lijn) $lijn = StringStripWS($lijn,1) tcpsend($con,$lijn &@CRLF) endif tcpsend($con,"JOIN "&$chan &@CRLF) do $recv = TCPRecv($con,1024) until $recv <> "" if $flag = 1 then Return $con &@CRLF &$recv if $flag = "" or $flag = 0 then Return $con EndFunc Edited November 19, 2006 by WhiteTiger Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 19, 2006 Share Posted November 19, 2006 no need for the Ifs just declare it like this Func _ircconnect($server,$port = 6667,$name = "IrcConnectByWhiteTiger",$chan = "#WhiteTiger",$flag = False) Link to comment Share on other sites More sharing options...
WhiteTiger Posted November 19, 2006 Author Share Posted November 19, 2006 thnx :-) , i shall edit it ^^ but do you like the idea of the udf ? :"> Link to comment Share on other sites More sharing options...
McGod Posted November 23, 2006 Share Posted November 23, 2006 Nice, I made an IRC Bot, I update it periodically. Ill post my text decipher for the send commands . Func _CleanText ( $text ) Local $ret[3] $ret[0] = StringTrimLeft ( StringLeft ( $text, StringInStr ( $text, "!" )-1), 1) $chantext = StringTrimLeft ( $text, StringInStr ( $text, "PRIVMSG" )+7) $ret[1] = StringTrimRight ( $chantext, StringLen ( $chantext ) - StringInStr ( $chantext, ":" )+ 2) $ret[2] = StringTrimLeft ( StringTrimLeft ( $text, StringInStr ( $text, "PRIVMSG" )), StringInStr ( StringTrimLeft ( $text, StringInStr ( $text, "PRIVMSG" )), ":")) Return $ret EndFunc [0] = User [1] = Channel [2] = Text [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
WhiteTiger Posted November 23, 2006 Author Share Posted November 23, 2006 Nice, I made an IRC Bot, I update it periodically. Ill post my text decipher for the send commands . Func _CleanText ( $text ) Local $ret[3] $ret[0] = StringTrimLeft ( StringLeft ( $text, StringInStr ( $text, "!" )-1), 1) $chantext = StringTrimLeft ( $text, StringInStr ( $text, "PRIVMSG" )+7) $ret[1] = StringTrimRight ( $chantext, StringLen ( $chantext ) - StringInStr ( $chantext, ":" )+ 2) $ret[2] = StringTrimLeft ( StringTrimLeft ( $text, StringInStr ( $text, "PRIVMSG" )), StringInStr ( StringTrimLeft ( $text, StringInStr ( $text, "PRIVMSG" )), ":")) Return $ret EndFunc [0] = User [1] = Channel [2] = Text good reply :-) i will add more functions but at the moment of writing i dont have much time Link to comment Share on other sites More sharing options...
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