rendered paste bodyechoNick = "mybotname"function irc_onRaw( text ) local irc_echo_action = gettok( text, 2, 32 ) if irc_echo_action == "PRIVMSG" then local irc_echo_userRaw = gettok( text, 1, 32 ) local irc_echo_nick = string.sub( gettok( irc_echo_userRaw, 1, string.byte('!') ), 2 ) local irc_echo_channel = gettok( text, 3, 32 ) local posS,posE = string.find( text, " :", 1 ) local irc_echo_text = string.sub( text, posE+1 ) if irc_echo_channel == echoNick then triggerEvent( "ircecho_onPrivMessage", getRootElement(), false, irc_echo_nick, string.sub( irc_echo_userRaw, 2 ), irc_echo_text ) else triggerEvent( "ircecho_onPrivMessage", getRootElement(), irc_echo_channel, irc_echo_nick, string.sub( irc_echo_userRaw, 2 ), irc_echo_text ) end elseif irc_echo_action == "NOTICE" then local irc_echo_userRaw = gettok( text, 1, 32 ) local irc_echo_nick = string.sub( gettok( irc_echo_userRaw, 1, string.byte('!') ), 2 ) local irc_echo_channel = gettok( text, 3, 32 ) local posS,posE = string.find( text, " :", 1 ) local irc_echo_text = string.sub( text, posE+1 ) if irc_echo_channel == echoNick then triggerEvent( "ircecho_onNotice", getRootElement(), false, irc_echo_nick, string.sub( irc_echo_userRaw, 2 ), irc_echo_text ) else triggerEvent( "ircecho_onNotice", getRootElement(), irc_echo_channel, irc_echo_nick, string.sub( irc_echo_userRaw, 2 ), irc_echo_text ) end elseif irc_echo_action == "JOIN" then local irc_echo_userRaw = gettok( text, 1, 32 ) local irc_echo_nick = string.sub( gettok( irc_echo_userRaw, 1, string.byte('!') ), 2 ) local irc_echo_channel = string.sub( gettok( text, 3, 32 ), 2 ) triggerEvent( "ircecho_onUserJoin", getRootElement(), irc_echo_nick, string.sub( irc_echo_userRaw, 2 ), irc_echo_channel ) elseif irc_echo_action == "PART" then local irc_echo_userRaw = gettok( text, 1, 32 ) local irc_echo_nick = string.sub( gettok( irc_echo_userRaw, 1, string.byte('!') ), 2 ) local irc_echo_channel = string.sub( gettok( text, 3, 32 ), 1 ) triggerEvent( "ircecho_onUserPart", getRootElement(), irc_echo_nick, string.sub( irc_echo_userRaw, 2 ), irc_echo_channel ) elseif irc_echo_action == "NICK" then local irc_echo_userRaw = gettok( text, 1, 32 ) local irc_echo_oldNick = string.sub( gettok( irc_echo_userRaw, 1, string.byte('!') ), 2 ) local irc_echo_newNick = string.sub( gettok( text, 3, 32 ), 2 ) triggerEvent( "ircecho_onUserNickChange", getRootElement(), irc_echo_oldNick, string.sub( irc_echo_userRaw, 2 ), irc_echo_newNick ) endendaddEvent( "ircecho_onPrivMessage" )addEvent( "ircecho_onNotice" )addEvent( "ircecho_onUserJoin" ) -- also triggered when the bot itself joinsaddEvent( "ircecho_onUserPart" ) -- can't say if toggled when bot itself parts, has no use then anyway =paddEvent( "ircecho_onUserNickChange" )function privateMessageHandler( theChannel, theNick, theHost, theText ) if theChannel == false then outputServerLog( "<" .. theNick .. "> (" .. theHost .. ") said on PM: " .. theText ) else outputServerLog( "<" .. theNick .. "> (" .. theHost .. ") said on " .. theChannel .. ": " .. theText ) endendaddEventHandler( "ircecho_onPrivMessage", getRootElement(), privateMessageHandler )function noticeHandler( theChannel, theNick, theHost, theText ) if theChannel == false then outputServerLog( "<" .. theNick .. "> (" .. theHost .. ") notices me: " .. theText ) else outputServerLog( "<" .. theNick .. "> (" .. theHost .. ") notices " .. theChannel .. ": " .. theText ) endendaddEventHandler( "ircecho_onNotice", getRootElement(), noticeHandler )function userJoinHandler( theNick, theHost, theChannel ) outputServerLog( "** " .. theNick .. " (" .. theHost .. ") joined " .. theChannel )endaddEventHandler( "ircecho_onUserJoin", getRootElement(), userJoinHandler )function userPartHandler( theNick, theHost, theChannel ) outputServerLog( "** " .. theNick .. " (" .. theHost .. ") parted " .. theChannel )endaddEventHandler( "ircecho_onUserPart", getRootElement(), userPartHandler )function userNickChangeHandler( oldNick, theHost, newNick ) outputServerLog( "** " .. oldNick .. " (" .. theHost .. ") changed their nick to " .. newNick )endaddEventHandler( "ircecho_onUserNickChange", getRootElement(), userNickChangeHandler )