1
0
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:
源文雨
2023-10-11 17:50:57 +09:00
parent f2f6f52b8a
commit 64f912e856
20 changed files with 395 additions and 115 deletions

View File

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