McGod Posted March 31, 2007 Share Posted March 31, 2007 (edited) A small UDF to connect to IRC using TCP Functions. Please note, Every IRC server is slightly different you may need to tweak the Example.au3 for it to work. Functions: _IRCConnect ($server, $port, $nick) _IRCJoinChannel ($irc, $chan) _IRCSendMessage ($irc, $msg, $chan="") _IRCChangeMode ($irc, $mode, $chan="") _IRCPing($ret) IRC.au3 UDF Example.au3 Example Script. In the Example Script there is a small thing on recieved messages. 8Ball.au3 8Ball Script.Quickly made up. My 8ball.ini [Reply] 1 = "As I see It, Yes" 2 = "It is certain" 3 = "It is decidedly so" 4 = "Most likely" 5 = "Outlook good" 6 = "Signs point to Yes" 7 = "Without a doubt" 8 = "YES" 9 = "Yes, definitely" 10 = "You may rely on it" 11 = "Ask again later" 12 = "Better not tell you now" 13 = "Cannot predict now" 14 = "Concentrate and ask again" 15 = "Don't count on it" 16 = "My reply is No" 17 = "My sources say No" 18 = "Outlook not so good" 19 = "Reply Hazy, Try again" 20 = "Very doubtful" 21 = "Not only no, but HELL No!" 22 = "Not only yes, but HELL Yes!" 23 = "You will regret it!" 24 = "Signs point to No" 25 = "Go away... I don't want you back!" 26 = "Well I love you, come back!" 27 = "What? Are you taking me as an 8 ball?" 28 = "Outlook is disturbing" Edited April 3, 2007 by Chip [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...
Pascal257 Posted April 1, 2007 Share Posted April 1, 2007 A small UDF to connect to IRC using TCP Functions. Please note, Every IRC server is slightly different you may need to tweak the Example.au3 for it to work. Functions: _IRCConnect ($server, $port, $nick) _IRCJoinChannel ($irc, $chan) _IRCSendMessage ($irc, $msg, $chan="") _IRCChangeMode ($irc, $mode, $chan="") _IRCPing($ret) IRC.au3 UDF Example.au3 Example Script. In the Example Script there is a small thing on recieved messages.Very very useful! Good Job! Link to comment Share on other sites More sharing options...
McGod Posted April 1, 2007 Author Share Posted April 1, 2007 Can anyone think of functions I could add? I can't think of any [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...
theguy0000 Posted April 2, 2007 Share Posted April 2, 2007 (edited) have you tried tidy? some of your indentataion is wrong. But really cool and useful funcs. Thanks! Edited April 2, 2007 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
lolp1 Posted April 2, 2007 Share Posted April 2, 2007 A registers func would be cool, so I can use to to join channels you need to be registerd to join. Link to comment Share on other sites More sharing options...
theguy0000 Posted April 2, 2007 Share Posted April 2, 2007 A registers func would be cool, so I can use to to join channels you need to be registerd to join.but not all networks/servers use nickserv, so it wouldn't work everywhere. Best to only make global use functions that always work on any server. A register one wouldn't do that. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Miranda Posted April 2, 2007 Share Posted April 2, 2007 I haven't given this a try yet, but I intend to. the things off the top of my head would be: -Keep alive connection (afaik if you do nothing the connection doesn't stay open forever)? -send private messages (would allow registration or w/e on some networks) -scan chat for keywords (would allow for commands/communication to be recieved, maybe directly launch functions that are declared in a seperate file?) -perform on connect (mainly joining channels/registering) please ignore if any/all of these functions already exist / arent necessary. Thanks alot in advance, will give it a go tonight Link to comment Share on other sites More sharing options...
Pascal257 Posted April 2, 2007 Share Posted April 2, 2007 I haven't given this a try yet, but I intend to.the things off the top of my head would be:-Keep alive connection (afaik if you do nothing the connection doesn't stay open forever)?-send private messages (would allow registration or w/e on some networks)-scan chat for keywords (would allow for commands/communication to be recieved, maybe directly launch functions that are declared in a seperate file?)-perform on connect (mainly joining channels/registering)please ignore if any/all of these functions already exist / arent necessary.Thanks alot in advance, will give it a go tonightI think if you take a look on the example.au3 you should see that many of those things can be written within your script.Just hook the incoming messages from the server. Link to comment Share on other sites More sharing options...
McGod Posted April 2, 2007 Author Share Posted April 2, 2007 theguy0000: I've never tried Tidy maybe I should lolp1:Those are server-specific functions, "NS ID Pass" or whatever you would use. Miranda: -PING Function, but yes if you don't response to the PING you get booted - _IRCSendMessage ($irc, "Message", "User") It works since the only different in PRIVMSG is #Chan and User - That would be in your script, this is just for connecting and interacting with server. - You again would add those in right spot. [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...
theguy0000 Posted April 2, 2007 Share Posted April 2, 2007 theguy0000: I've never tried Tidy maybe I shouldyes, it's built into scite, just open your script and Press Ctrl+T and it will fix indentation among other things, depending on your preferences. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
lolp1 Posted April 3, 2007 Share Posted April 3, 2007 I'm some what confused. How do you plan on responding to the ping? Link to comment Share on other sites More sharing options...
Pascal257 Posted April 3, 2007 Share Posted April 3, 2007 I'm some what confused. How do you plan on responding to the ping?;=============================================================================== ; ; Description: Returns a PING to Server ; Parameter(s): $irc - Socket Identifer from _IRCConnect () ; $ret - The end of the PING to return ; Requirement(s): _IRCConnect () to be run ; Return Value(s): On Success - 1 ; On Failure - -1 = Server disconnected. ; Author(s): Chip ; Note(s): English only ; ;=============================================================================== Func _IRCPing($ret) If $ret = "" Then Return -1 TCPSend($irc, "PONG " & $ret & @CRLF) If @error Then MsgBox(1, "IRC.au3", "Server has disconnected.") Return -1 EndIf Return 1 EndFunc --> If $sTemp[1] = "PING" Then _IRCPing($sTemp[2]); Checks for PING replys (There smaller then usual messages so its special! ~~~~PING~~~~ You recieves these at random to make sure your still online and not disconnected. SYNTAX: PING :Randomletters Usually a PING has random letters that you have to respond with. EXAMPLE: PING :29809dj0d You would respond with PONG 29809dj0d ~~~~~~~~~~~ This should answer your question Link to comment Share on other sites More sharing options...
lolwut Posted April 9, 2007 Share Posted April 9, 2007 Sorry to bump this topic, but is any way my bot can "read" commands I add, like !msg, or !time, so I can make an intelligent bot? Link to comment Share on other sites More sharing options...
lolwut Posted April 9, 2007 Share Posted April 9, 2007 Oh, thanks Chip! Btw great UDF, I'll credit you on that. Link to comment Share on other sites More sharing options...
Obi-w00t Posted April 9, 2007 Share Posted April 9, 2007 (edited) Very cool script, I just tried it out and it works a treat! Edit: Sorry to keep editing my post but I just figured out why the script is not working for me, some bits are missing in the code. In IRC.au3 change this: Func _IRCJoinChannel ($chan)oÝ÷ ÚÚºÚ"µÍ[ÈÒTÒÚ[Ú[[ ÌÍÚË ÌÍØÚ[oÝ÷ Ø Ý{ayìZ^±Êâ¦Û©àzØb±«¢+Ù%ÀÌØíÍQµÁlÅtôÅÕ½ÐíA%9ÅÕ½ÐìQ¡¸}%I A¥¹ ÀÌØíÍQµÁlÉtoÝ÷ ÚÚºÚ"µÍY ÌÍÜÕ[ÌWHH ][ÝÔSÉ][ÝÈ[ÒTÔ[Ê ÌÍÜÛØÚË ÌÍÜÕ[ÌJ After these changes the script responded to pings just fine. Edited April 9, 2007 by Obi-w00t Link to comment Share on other sites More sharing options...
McGod Posted April 10, 2007 Author Share Posted April 10, 2007 :"> Whoops, it was a fast func. I upload a new vers in an hour. [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...
Blackstar Posted April 10, 2007 Share Posted April 10, 2007 ;=============================================================================== ; ; Description: Connects you to a IRC Server, and gives your chosen Nick ; Parameter(s): $server - IRC Server you wish to connect to ; $port - Port to connect to (Usually 6667) ; $nick - Nick you choose to use (You can change later) ; Requirement(s): TCPStartup () to be run ; Return Value(s): On Success - Socket identifer ; On Failure - It will exit on error ; Author(s): Chip ; Note(s): English only ; ;=============================================================================== Could you please add the Version line in your code so I'll know I have older code and needs to download your updated code? Or even a date. thanks! Link to comment Share on other sites More sharing options...
mmavipc Posted April 10, 2007 Share Posted April 10, 2007 Good job. But there's one thing you forgot. Ip spoof protection. That is where a server checks for a ip spoofer by sending a ping. telnet output: :irc.toontownmovie.com NOTICE AUTH :*** Looking up your hostname... :irc.toontownmovie.com NOTICE AUTH :*** Couldn't resolve your hostname; using yo ur IP address instead NICK lol PING :907F36E1 to pass the ip spoof test you must reply with: PONG numhere E.G. server sends: PING :907F36E1 client must send to pass test: PONG 907F36E1 i edited your _IRCConnect function for you Func _IRCConnect ($server, $port, $nick) Local $i = TCPConnect(TCPNameToIP($server), $port) If $i = -1 Then Exit MsgBox(1, "IRC.au3 Error", "Server " & $server & " is not responding.") TCPSend($i, "NICK " & $nick & @CRLF) $ping = tcprecv($i,2048) if stringleft($ping,4) = "PING" Then $pong = stringreplace($ping,"PING :","") tcpsend($i,"PONG " & $pong & @LF) EndIf TCPSend($i, "USER " & $nick & " 0 0 " & $nick &@CRLF) Return $i EndFunc [size="10"]Pure Au3 crypt funcs(I'm currently also working on making a dll from this)[/size][Y] Be more active in the community[Y] Get 200 posts[N] Get 300 posts[N] Make a Topic in the example scripts forum with at least 50 replies.People who currently hate me:ValikSmOke_N Link to comment Share on other sites More sharing options...
Obi-w00t Posted April 11, 2007 Share Posted April 11, 2007 I think that might just be you, mmavipc, I get the following response when using the script: :irc.toontownmovie.com NOTICE AUTH :*** Looking up your hostname... :irc.toontownmovie.com NOTICE AUTH :*** Found your hostname PING :B9F31B30 Link to comment Share on other sites More sharing options...
mmavipc Posted April 12, 2007 Share Posted April 12, 2007 I think that might just be you, mmavipc, I get the following response when using the script: :irc.toontownmovie.com NOTICE AUTH :*** Looking up your hostname... :irc.toontownmovie.com NOTICE AUTH :*** Found your hostname PING :B9F31B30you still got the ip spoof protection PING :B9F31B30 [size="10"]Pure Au3 crypt funcs(I'm currently also working on making a dll from this)[/size][Y] Be more active in the community[Y] Get 200 posts[N] Get 300 posts[N] Make a Topic in the example scripts forum with at least 50 replies.People who currently hate me:ValikSmOke_N 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