Created
July 24, 2008 16:40
-
-
Save anonymous/2215 to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ def parse(x) $joined = 0 $counter = 0 # INITIALIZE VARIABLES upmynick = $irc_nick mynick = upmynick.downcase nick = "" chan = "" fullmsg = "" upfullmsg = "" msg = "" upmsg = "" # SPLIT CODE UP s = x.split("\:",3) if s[1] =~ /!/ then nick = s[1].split("!")[0] end if s[1] =~ /\ / then chan = s[1].split("\ ")[2] end if s[2] != nil then puts s[2] fullmsg = s[2].downcase upfullmsg = s[2] end if s[3] != nil then puts s[3] fullmsg = fullmsg + s[3].downcase upfullmsg = upfullmsg + s[3] end fullmsg = fullmsg.strip upfullmsg = upfullmsg.strip # CHECK IF MESSAGE IS DIRECTED AT BOT if upfullmsg =~ /^(#{upmynick}\:|#{$irc_prefix})(\ )*/ then direct = true upmsg = upfullmsg.split(/^(#{upmynick}\:|#{$irc_prefix})*/, 2) upmsg = upmsg[2].strip msg = upmsg.downcase.strip else upmsg = upfullmsg.strip msg = fullmsg.strip end if direct == true && msg =~ /^(msg)/ then place("PRIVMSG #{chan} test1 test2 test3") end end