Skip to content
Permalink
Browse files

Command logs now include command name

Also changed the local caller to "%console%" to distinguish it from a
user with the name "console".
  • Loading branch information...
Davnit committed Apr 18, 2016
1 parent b9d610d commit d28fee616f32920b54d27326e67a84eb910be398
Showing with 13 additions and 35 deletions.
  1. +12 −3 trunk/modCommands.bas
  2. +1 −32 trunk/modOtherCode.bas
@@ -25,23 +25,32 @@ Public Function ProcessCommand(ByVal Username As String, ByVal Message As String

Dim commands As Collection
Dim Command As clsCommandObj
Dim sCommand As String

' replace message variables
Message = Replace(Message, "%me", IIf(IsLocal, GetCurrentUsername, Username), 1, -1, vbTextCompare)

' Should the command system be bypassed entirely?
If ((IsLocal) And (Left$(Message, 3) = "///")) Then
frmChat.AddQ Mid$(Message, 3)
Exit Function
End If

' Get all of the commands in the message
Set commands = clsCommandObj.IsCommand(Message, IIf(IsLocal, modGlobals.CurrentUsername, CleanUsername(Username)), _
IsLocal, WasWhispered, Chr$(0))

For Each Command In commands
If (Command.HasAccess) Then
'this is eww but i'll change it later
LogCommand IIf(Command.IsLocal, vbNullString, Username), Command.IsLocal & Space(1) & Command.Args

' Log the command
sCommand = Command.Name
If (LenB(Command.Args) > 0) Then
sCommand = sCommand & ": " & Command.Args
End If
LogCommand IIf(Command.IsLocal, vbNullString, Username), sCommand

' Fire the command event
If (LenB(Command.docs.Owner) = 0) Then
Call DispatchCommand(Command)
Call RunInSingle(Nothing, "Event_Command", Command)
@@ -56,7 +65,7 @@ Public Function ProcessCommand(ByVal Username As String, ByVal Message As String
If (commands.Count = 0) Then frmChat.AddQ Message
End If

'Unload memory - FrOzeN
'Unload memory
Set Command = Nothing
Set commands = Nothing

@@ -2570,41 +2570,10 @@ Public Sub LogCommand(ByVal Caller As String, ByVal CString As String)

If (LenB(CString) > 0) Then
If (LenB(Caller) = 0) Then
Caller = "console"
Caller = "%console%"
End If

g_Logger.WriteCommand Caller & " -> " & CString

'f = FreeFile
'
'sPath = GetProfilePath() & "\Logs\commands.txt"
'
'If (LenB(Caller) = 0) Then
' Caller = "bot console"
'End If
'
'If (LenB(dir$(sPath)) = 0) Then
' Open sPath For Output As #f
'Else
' Open sPath For Append As #f
'
' If ((LOF(f) > BotVars.MaxLogFileSize) And (BotVars.MaxLogFileSize > 0)) Then
' Close #f
'
' Call Kill(sPath)
'
' Open sPath For Output As #f
' Print #f, "Logfile cleared automatically on " & _
' Format(Now, "HH:MM:SS MM/DD/YY") & "."
' End If
'End If
'
'Action = "[" & Format(Now, "HH:MM:SS MM/DD/YY") & _
' "][" & Caller & "]-> " & CString
'
'Print #f, Action
'
'Close #f
End If

Exit Sub

0 comments on commit d28fee6

Please sign in to comment.
You can’t perform that action at this time.