feat: add info command

This commit is contained in:
2025-08-06 08:58:07 +08:00
parent 9cf9d0fbc8
commit b720c05e23
2 changed files with 20 additions and 0 deletions

View File

@@ -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
View 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)))
}