Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created July 24, 2008 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/2215 to your computer and use it in GitHub Desktop.
Save anonymous/2215 to your computer and use it in GitHub Desktop.
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