Skip to content

Commit

Permalink
Restrict temp users from writing to mainchat
Browse files Browse the repository at this point in the history
* Show error when temp users write to mainchat.
* Don't maintain history for messages to mainchat by temp users.
  • Loading branch information
nishithshah2211 committed Oct 1, 2015
1 parent 8e8c191 commit ec4fdff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions chatlogger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local tConfig, tChatHistory = {
sTimeFormat = "[%I:%M:%S %p] ",
sPath = Core.GetPtokaXPath().."scripts/texts/",
iMaxLines = 100,
iTempProfile = 6,
}, { "Hi!" }
local tTickers = {
tTopics = {},
Expand Down Expand Up @@ -80,6 +81,7 @@ function OnTimer( iTimerID )
end

function AddHistory( tUser, sInput, bIsCommand )
if tUser.iProfile == tConfig.iTempProfile then return false end
local sChatLine = os.date( tConfig.sTimeFormat )..sInput
if not( bIsCommand and tConfig.sProfiles:find(tUser.iProfile) ) then
table.insert( tChatHistory, sChatLine )
Expand Down
2 changes: 1 addition & 1 deletion external/restrict/chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function RestrictChat( sBotName, Error )
local sError = ( "<%s> %s" ):format( sBotName, Error("gen", 2) )
return function( tUser, sMessage, bFlag )
if not bFlag then return bFlag end
if tUser.iProfile == -1 then
if tUser.iProfile == -1 or tUser.iProfile == 6 then
Core.SendToUser( tUser, sError )
return true
end
Expand Down

0 comments on commit ec4fdff

Please sign in to comment.