Skip to content

Instantly share code, notes, and snippets.

/gist:2215
Created Jul 24, 2008

Embed
What would you like to do?
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
You can’t perform that action at this time.