mirror of
https://github.com/awfufu/go-hurobot.git
synced 2026-03-01 05:29:43 +08:00
feat: add info command
This commit is contained in:
@@ -41,6 +41,7 @@ func init() {
|
||||
"rps": cmd_rps,
|
||||
"dice": cmd_dice,
|
||||
"memberinfo": cmd_memberinfo,
|
||||
"info": cmd_info,
|
||||
}
|
||||
|
||||
for key := range cmdMap {
|
||||
|
||||
19
cmds/info.go
Normal file
19
cmds/info.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package cmds
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go-hurobot/qbot"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func cmd_info(c *qbot.Client, msg *qbot.Message, args *ArgsList) {
|
||||
cmd := exec.Command("top", "-l", "1", "-n", "0")
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
c.SendReplyMsg(msg, fmt.Sprintf("Failed to get system info: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
c.SendReplyMsg(msg, strings.TrimSpace(string(output)))
|
||||
}
|
||||
Reference in New Issue
Block a user