mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 19:43:49 +08:00
fix: fix api-generator panic
This commit is contained in:
parent
a10aee8c8d
commit
05f7eeb5c9
@ -112,7 +112,7 @@ func main() {
|
|||||||
for _, decl := range file.Decls {
|
for _, decl := range file.Decls {
|
||||||
switch decl := decl.(type) {
|
switch decl := decl.(type) {
|
||||||
case *ast.FuncDecl:
|
case *ast.FuncDecl:
|
||||||
if decl.Recv == nil {
|
if !decl.Name.IsExported() || decl.Recv == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if st, ok := decl.Recv.List[0].Type.(*ast.StarExpr); !ok || st.X.(*ast.Ident).Name != "CQBot" {
|
if st, ok := decl.Recv.List[0].Type.(*ast.StarExpr); !ok || st.X.(*ast.Ident).Name != "CQBot" {
|
||||||
@ -137,8 +137,6 @@ func main() {
|
|||||||
for _, comment := range decl.Doc.List {
|
for _, comment := range decl.Doc.List {
|
||||||
annotation, args := match(comment.Text)
|
annotation, args := match(comment.Text)
|
||||||
switch annotation {
|
switch annotation {
|
||||||
case "":
|
|
||||||
continue
|
|
||||||
case "route":
|
case "route":
|
||||||
router.Path = args
|
router.Path = args
|
||||||
case "alias":
|
case "alias":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user