add command prefix check

This commit is contained in:
Jay 2018-10-10 00:52:40 +08:00
parent 63a6856e45
commit 8e1b0c1ef6
2 changed files with 6 additions and 2 deletions

View File

@ -84,7 +84,7 @@ func main() {
go func() {
for {
PrintMemUsage()
time.Sleep(time.Second * 10)
time.Sleep(time.Second * 20)
}
}()
@ -100,6 +100,9 @@ func PrintMemUsage() {
fmt.Printf("\tTotalAlloc = %v MiB", bToMb(m.TotalAlloc))
fmt.Printf("\tSys = %v MiB", bToMb(m.Sys))
fmt.Printf("\tNumGC = %v\n", m.NumGC)
fmt.Printf("HeapAlloc = %v MiB", bToMb(m.HeapAlloc))
fmt.Printf("\t HeapSys = %v MiB", bToMb(m.HeapSys))
fmt.Printf("\t NextGC = %v MiB\n", bToMb(m.NextGC))
}
func bToMb(b uint64) uint64 {
return b / 1024 / 1024

View File

@ -33,7 +33,8 @@ func ParseLineMsg(txt, replyToken string, source *lineobj.SourceObject) {
return
}
if strings.HasPrefix(strs[0], "!") || strings.HasPrefix(strs[0], "") {
firstNum := []rune(strs[0])[0]
if firstNum == 33 || firstNum == 65281 {
// nor cmd
cmd := strs[0][1:]
if len(cmd) == 0 {