forked from FloatTech/ZeroBot-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
49 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package cpstory | ||
|
||
type CpStory struct { | ||
Id int64 `db:"id"` | ||
type cpstory struct { | ||
ID int64 `db:"id"` | ||
Gong string `db:"gong"` | ||
Shou string `db:"shou"` | ||
Story string `db:"story"` | ||
} | ||
|
||
func getRandomCpStory() (cs CpStory) { | ||
func getRandomCpStory() (cs cpstory) { | ||
_ = db.Pick("cp_story", &cs) | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Package ctxext zero ctx 扩展 | ||
package ctxext | ||
|
||
import ( | ||
"strconv" | ||
|
||
zero "github.com/wdvxdr1123/ZeroBot" | ||
) | ||
|
||
// NickName 从 args 获取名字 | ||
func NickName(ctx *zero.Ctx) (name string) { | ||
name = ctx.State["args"].(string) | ||
if len(ctx.Event.Message) > 1 && ctx.Event.Message[1].Type == "at" { | ||
qq, _ := strconv.ParseInt(ctx.Event.Message[1].Data["qq"], 10, 64) | ||
name = ctx.GetGroupMemberInfo(ctx.Event.GroupID, qq, false).Get("nickname").Str | ||
} else if name == "" { | ||
name = ctx.Event.Sender.NickName | ||
} | ||
return | ||
} | ||
|
||
// CardOrNickName 从 uid 获取名字 | ||
func CardOrNickName(ctx *zero.Ctx, uid int64) (name string) { | ||
name = ctx.GetGroupMemberInfo(ctx.Event.GroupID, uid, false).Get("card").String() | ||
if name == "" { | ||
name = ctx.GetStrangerInfo(uid, false).Get("nickname").String() | ||
} | ||
return | ||
} |