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

Function moreinfo

plugin/status/main.go:599–622  ·  view source on GitHub ↗
(m *ctrl.Control[*nano.Ctx])

Source from the content-addressed store, hash-verified

597}
598
599func moreinfo(m *ctrl.Control[*nano.Ctx]) (stateinfo []*status, err error) {
600 var mems runtime.MemStats
601 runtime.ReadMemStats(&mems)
602 fmtmem := storagefmt(float64(mems.Sys))
603
604 hostinfo, err := host.Info()
605 if err != nil {
606 return
607 }
608 cpuinfo, err := cpu.Info()
609 if err != nil {
610 return
611 }
612
613 count := len(m.Manager.M)
614 stateinfo = []*status{
615 {name: "OS", text: []string{hostinfo.Platform}},
616 {name: "CPU", text: []string{strings.TrimSpace(cpuinfo[0].ModelName)}},
617 {name: "Version", text: []string{hostinfo.PlatformVersion}},
618 {name: "Plugin", text: []string{"共 " + strconv.Itoa(count) + " 个"}},
619 {name: "Memory", text: []string{"已用 " + fmtmem}},
620 }
621 return
622}
623
624func colorswitch(a uint8) color.Color {
625 if isday {

Callers 1

drawstatusFunction · 0.85

Calls 1

storagefmtFunction · 0.85

Tested by

no test coverage detected