-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSystemInfo.php
More file actions
30 lines (25 loc) · 951 Bytes
/
SystemInfo.php
File metadata and controls
30 lines (25 loc) · 951 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
namespace plugin;
use phqagent\plugin\PluginBase;
use phqagent\console\MainLogger;
use phqagent\message\Message;
class SystemInfo extends PluginBase{
private $start;
public function onLoad(){
$this->start = time();
MainLogger::success('系统信息插件已加载');
}
public function onMessageReceive(Message $message){
if($message->getContent() == '/sysinfo'){
$version = 'PhQAgent Codename: [' . \phqagent\PROJECT . '] Version: ' . \phqagent\VERSION . "\n";
$uptime = "当前已运行 " . (int)(time() - $this->start) . " 秒\n";
$plugins = "当前已加载的插件: ";
foreach($this->getServer()->getPluginManager()->getPlugin() as $name => $p){
$plugins .= $name . " ";
}
$plugins .= "\n";
$text = $version . $uptime . $plugins;
new Message($message, $text, true);
}
}
}