Created
July 24, 2008 16:40
-
-
Save anonymous/2215 to your computer and use it in GitHub Desktop.
This file contains 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 characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment