mirror of
https://github.com/fumiama/NanoBot.git
synced 2026-06-12 06:00:29 +08:00
finish half of message
This commit is contained in:
15
helper.go
15
helper.go
@@ -5,9 +5,8 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// getCallerFuncName 获取调用者函数名
|
||||
func getCallerFuncName() string {
|
||||
pc, _, _, ok := runtime.Caller(2)
|
||||
func getFuncNameWithSkip(n int) string {
|
||||
pc, _, _, ok := runtime.Caller(n)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
@@ -18,3 +17,13 @@ func getCallerFuncName() string {
|
||||
}
|
||||
return fullname[i:]
|
||||
}
|
||||
|
||||
// getThisFuncName 获取正在执行的函数名
|
||||
func getThisFuncName() string {
|
||||
return getFuncNameWithSkip(1)
|
||||
}
|
||||
|
||||
// getCallerFuncName 获取调用者函数名
|
||||
func getCallerFuncName() string {
|
||||
return getFuncNameWithSkip(2)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user