Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccessLog.php
More file actions
Latest commit
30 lines (24 loc) · 965 Bytes
/
Copy pathAccessLog.php
File metadata and controls
30 lines (24 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespacekjBotModule\kj415j45\CoreModule;
useDateTime;
usekjBot\Framework\DataStorage;
usekjBot\Framework\Event\MessageEvent;
class AccessLog{
constBaseDir = 'CoreModule.AccessLog/';
publicstaticfunctionLog($instance, MessageEvent$event, string$note = ''){
$className = get_class($instance);
$groupId = $event->fromGroup()?" (In {$event->groupId})":'';
$senderId = $event->getId();
$time = (newDateTime('now'))->format('Y-m-d H:i:s');
return DataStorage::SetData(static::BaseDir.$senderId,
"[{$time}]{$groupId}{$className}: {$note}\n"
, true);
}
publicstaticfunctionLogForModule($instance, string$note = ''){
$className = str_replace('\\', '.', get_class($instance));
$time = (newDateTime('now'))->format('Y-m-d H:i:s');
return DataStorage::SetData(static::BaseDir.$className,
"[{$time}] {$note}\n"
, true);
}
}