diff --git a/chatlogger.lua b/chatlogger.lua index 2503b24..a16776f 100644 --- a/chatlogger.lua +++ b/chatlogger.lua @@ -10,24 +10,42 @@ function OnStartup() tConfig, tChatHistory = { sBotName = SetMan.GetString( 21 ) or "PtokaX", - sProfiles = "012", -- No history for commands from users with profiles sLogsPath = "/www/ChatLogs/", + tCommands = { + "history", "help", "custhelp", "me", "report", "topic", "say", "kick", "ban", "banip", + "fullban", "fullbanip", "nickban", "tempban", "tempbanip", "fulltempban", "fulltempbanip", + "nicktempban", "getblocks", "getmyblocks", "unban", "permunban", "tempunban", "getbans", + "getpermbans", "gettempbans", "clrpermbans", "clrtempbans", "rangeban", "fullrangeban", + "rangetempban", "fullrangetempban", "rangeunban", "rangepermunban", "rangetempunban", + "getrangebans", "getrangepermbans", "getrangetempbans", "clrrangepermbans", + "clrrangetempbans", "checknickban", "checkipban", "checkrangeban", "getpass", + "clrpassbans", "startscript", "stopscript", "restartscript", "restartscripts", + "getscripts", "reloadtxt", "restart", "hubtopic", "passwd", "warn", "send", + "revertnick", "changenick", "mute", "block", "unblock", "desu", "san", "chan", "sub", + "foreveralone", "nomorealone", "getprofiles", "unsub", "unmute", "drop", "getinfo", + "op", "gag", "ungag", "changereg", "addreguser", "delreguser", "massmsg", "opmassmsg", "myip", + }, iMaxLines = 100, }, { "Hi!" } end +CustomCommands = {} +for _, comm in ipairs(tConfig.tCommands) do + CustomCommands[comm] = true +end + function ChatArrival( tUser, sMessage ) LogMessage( sMessage:sub(1, -2) ) local sCmd, sData = sMessage:match( "%b<> [-+*/?!#](%w+)%s?(.*)|" ) local sTime = os.date( "%I:%M:%S %p" ) local sChatLine = "["..sTime.."] "..sMessage:sub( 1, -2 ) - if not( sCmd and tConfig.sProfiles:find(tUser.iProfile) ) then + if not CustomCommands[sCmd] then table.insert( tChatHistory, sChatLine ) if tChatHistory[tConfig.iMaxLines + 1] then table.remove( tChatHistory, 1 ) end end - if sCmd then + if CustomCommands[sCmd] then return ExecuteCommand( sCmd:lower(), sData, tUser ) end return false