Skip to content

Commit

Permalink
Add commands manually and check for them
Browse files Browse the repository at this point in the history
  • Loading branch information
nishithshah2211 committed Jan 30, 2015
1 parent df3b88e commit 71945bb
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions chatlogger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,41 @@ function OnStartup()
tConfig, tChatHistory = {
sBotName = SetMan.GetString( 21 ) or "PtokaX",
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 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
Expand Down

0 comments on commit 71945bb

Please sign in to comment.