MCPcopy Create free account
hub / github.com/FloatTech/NanoBot-Plugin / botruntime

Function botruntime

plugin/status/main.go:464–479  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

462}
463
464func botruntime() (string, error) {
465 hostinfo, err := host.Info()
466 if err != nil {
467 return "", err
468 }
469 t := &strings.Builder{}
470 t.WriteString("NanoBot-Plugin 已运行 ")
471 t.WriteString(strconv.FormatInt((time.Now().Unix()-boottime.Unix())/86400, 10))
472 t.WriteString(" 天 ")
473 t.WriteString(time.Unix(time.Now().Unix()-boottime.Unix(), 0).UTC().Format("15:04:05"))
474 t.WriteString(" | 系统运行 ")
475 t.WriteString(strconv.FormatInt(int64(hostinfo.Uptime)/86400, 10))
476 t.WriteString(" 天 ")
477 t.WriteString(time.Unix(int64(hostinfo.Uptime), 0).UTC().Format("15:04:05"))
478 return t.String(), nil
479}
480
481func botstatus() (string, error) {
482 hostinfo, err := host.Info()

Callers 1

drawstatusFunction · 0.85

Calls 2

FormatMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected