phew Posted October 5, 2007 Share Posted October 5, 2007 hi! i am trying to write my own IRC-Channel-Service bot in autoit! just i get a problem to use an authhost-matching so i.e. only the user with the host *!*@hostname.com can send commands like ".say test" (makes the bot say "test") and stuff. here is a part of my code: While (1) $msg = GUIGetMsg() Select Case $msg = $quit ExitLoop EndSelect If $start = 1 Then $srcv = TCPRecv($socket, 512) If ($srcv <> "") Then doStart($srcv, $socket) PingPong($srcv, $socket) doVarClean() EndIf EndIf WEnd i am not too good with regexp so a friend helped me: $auth = StringRegExp($srcv, '.*?)!(.*?)@(.*?) (.*?) (.*?) .*)', 1) (should be working for grab the hostname from the RAW) RAW in IRC looks like: <- :nick!ident@hostname.com PRIVMSG #chan :text my authhost is set on top of the script: Global Const $authhost = "@hostname.com" so i guess i have to check if $auth = $authhost and if that is true, the bot shall execute the command, if $authhost <> $auth it should not do anything. i think i have to set it somewhere into this peace of code: If ($srcv <> "") Then doStart($srcv, $socket) PingPong($srcv, $socket) doVarClean() EndIf but i have not even a clue how to get startet with grabbing the host from $srcv which is receiving all the RAW stuff. i know its kinda bad description but perhaps someone can help thanks! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 5, 2007 Moderators Share Posted October 5, 2007 You can't compare a var to an array as you did... $authhost <> $auth << using regexp's $auth should be an array... $authhost <> $auth[0] would be proper. Your RegExp is not right either if I'm understanding what you are trying to do... Looks like you want the entire thing (not in bits). So this:$auth = StringRegExp($srcv, ':(.*?)!(.*?)@(.*?) (.*?) (.*?) sad.gif.*)', 1)oÝ÷ Ùj.Ùh¢K(ëax%GºÚ"µÍÌÍØ]]HÝ[ÔYÑ^ ÌÍÜÜÝ ][ÝÊÜÊIÌLÎÉÌLÉÌÌÎËÉÌLÐÉÌLËÛÛJI][ÝËJI would think. About the other stuff... I have no idea what you are saying or asking. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
phew Posted October 5, 2007 Author Share Posted October 5, 2007 You can't compare a var to an array as you did... $authhost <> $auth << using regexp's $auth should be an array... $authhost <> $auth[0] would be proper. Your RegExp is not right either if I'm understanding what you are trying to do... Looks like you want the entire thing (not in bits). So this:$auth = StringRegExp($srcv, ':(.*?)!(.*?)@(.*?) (.*?) (.*?) sad.gif.*)', 1)oÝ÷ Ùj.Ùh¢K(ëax%GºÚ"µÍÌÍØ]]HÝ[ÔYÑ^ ÌÍÜÜÝ ][ÝÊÜÊIÌLÎÉÌLÉÌÌÎËÉÌLÐÉÌLËÛÛJI][ÝËJI would think. About the other stuff... I have no idea what you are saying or asking. thanks, i think you already answered what i needed someone could remove smileys on CODE /CODE bb-codes? Link to comment Share on other sites More sharing options...
McGod Posted October 5, 2007 Share Posted October 5, 2007 You could look at my IRC Bot in my signature for a base for the bot. [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...
phew Posted October 5, 2007 Author Share Posted October 5, 2007 You could look at my IRC Bot in my signature for a base for the bot.thanks man 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