mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
修复花名册会显示单身贵族的问题 (#269)
* 修复花名册会显示单身贵族的问题 * Update qqmapwife.go * Update qqmapwife.go
This commit is contained in:
parent
394d2e4a08
commit
bf6bac7be6
@ -168,6 +168,9 @@ func (sql *婚姻登记) 花名册(gid int64) (list [][4]string, number int, err
|
|||||||
var info userinfo
|
var info userinfo
|
||||||
list = make([][4]string, 0, number)
|
list = make([][4]string, 0, number)
|
||||||
err = sql.db.FindFor(gidstr, &info, "GROUP BY user", func() error {
|
err = sql.db.FindFor(gidstr, &info, "GROUP BY user", func() error {
|
||||||
|
if info.Target == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
dbinfo := [4]string{
|
dbinfo := [4]string{
|
||||||
info.Username,
|
info.Username,
|
||||||
strconv.FormatInt(info.User, 10),
|
strconv.FormatInt(info.User, 10),
|
||||||
@ -177,6 +180,9 @@ func (sql *婚姻登记) 花名册(gid int64) (list [][4]string, number int, err
|
|||||||
list = append(list, dbinfo)
|
list = append(list, dbinfo)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
if len(list) == 0 {
|
||||||
|
number = 0
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +191,7 @@ func slicename(name string, canvas *gg.Context) (resultname string) {
|
|||||||
widthlen := 0
|
widthlen := 0
|
||||||
numberlen := 0
|
numberlen := 0
|
||||||
for i, v := range usermane {
|
for i, v := range usermane {
|
||||||
width, _ := canvas.MeasureString(string(v)) // 获取单个字符的宽度
|
width, _ := canvas.MeasureString(string(v)) //获取单个字符的宽度
|
||||||
widthlen += int(width)
|
widthlen += int(width)
|
||||||
if widthlen > 350 {
|
if widthlen > 350 {
|
||||||
break // 总宽度不能超过350
|
break // 总宽度不能超过350
|
||||||
@ -397,16 +403,16 @@ func init() {
|
|||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
gid := ctx.Event.GroupID
|
gid := ctx.Event.GroupID
|
||||||
if uid == fiancee { // 如果是自己
|
if uid == fiancee { // 如果是自己
|
||||||
switch rand.Intn(2) { // 二分之一概率浪费技能
|
switch rand.Intn(3) {
|
||||||
case 0:
|
case 1:
|
||||||
ctx.SendChain(message.Text("今日获得成就:自恋狂"))
|
|
||||||
default:
|
|
||||||
err := 民政局.登记(gid, uid, 0, "", "")
|
err := 民政局.登记(gid, uid, 0, "", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("数据库发生问题力,请联系bot管理员\n[error]", err))
|
ctx.SendChain(message.Text("数据库发生问题力,请联系bot管理员\n[error]", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.SendChain(message.Text("今日获得成就:单身贵族"))
|
ctx.SendChain(message.Text("今日获得成就:单身贵族"))
|
||||||
|
default:
|
||||||
|
ctx.SendChain(message.Text("今日获得成就:自恋狂"))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -683,25 +689,26 @@ func checkdog(ctx *zero.Ctx) bool {
|
|||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
uidtarget, uidstatus, err1 := 民政局.查户口(gid, uid)
|
uidtarget, uidstatus, err1 := 民政局.查户口(gid, uid)
|
||||||
fianceeinfo, fianceestatus, err2 := 民政局.查户口(gid, fiancee)
|
fianceeinfo, fianceestatus, err2 := 民政局.查户口(gid, fiancee)
|
||||||
if uidstatus == 2 || fianceestatus == 2 {
|
switch {
|
||||||
|
case uidstatus == 2 || fianceestatus == 2:
|
||||||
ctx.SendChain(message.Text("数据库发生问题力,请联系bot管理员\n[error]", err1, "\n", err2))
|
ctx.SendChain(message.Text("数据库发生问题力,请联系bot管理员\n[error]", err1, "\n", err2))
|
||||||
return false
|
return false
|
||||||
}
|
case uidstatus == 3 && fianceestatus == 3: // 必须是两个单身
|
||||||
if uidstatus == 3 && fianceestatus == 3 { // 必须是两个单身
|
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
switch {
|
|
||||||
case uidtarget.Target == fiancee: // 如果本就是一块
|
case uidtarget.Target == fiancee: // 如果本就是一块
|
||||||
ctx.SendChain(message.Text("笨蛋~你们明明已经在一起了啊w"))
|
ctx.SendChain(message.Text("笨蛋~你们明明已经在一起了啊w"))
|
||||||
return false
|
return false
|
||||||
|
case uidstatus != 3 && uidtarget.Target == 0: // 如果是单身贵族
|
||||||
|
ctx.SendChain(message.Text("今天的你是单身贵族噢"))
|
||||||
|
return false
|
||||||
case uidstatus == 1: // 如果如为攻
|
case uidstatus == 1: // 如果如为攻
|
||||||
ctx.SendChain(message.Text("笨蛋~你家里还有个吃白饭的w"))
|
ctx.SendChain(message.Text("笨蛋~你家里还有个吃白饭的w"))
|
||||||
return false
|
return false
|
||||||
case uidstatus == 0: // 如果为受
|
case uidstatus == 0: // 如果为受
|
||||||
ctx.SendChain(message.Text("该是0就是0,当0有什么不好"))
|
ctx.SendChain(message.Text("该是0就是0,当0有什么不好"))
|
||||||
return false
|
return false
|
||||||
case uidstatus != 3 && uidtarget.Target == 0: // 如果是单身贵族
|
case fianceestatus != 3 && fianceeinfo.Target == 0:
|
||||||
ctx.SendChain(message.Text("今天的你是单身贵族噢"))
|
ctx.SendChain(message.Text("今天的ta是单身贵族噢"))
|
||||||
return false
|
return false
|
||||||
case fianceestatus == 1: // 如果如为攻
|
case fianceestatus == 1: // 如果如为攻
|
||||||
ctx.SendChain(message.Text("他有别的女人了,你该放下了"))
|
ctx.SendChain(message.Text("他有别的女人了,你该放下了"))
|
||||||
@ -709,9 +716,6 @@ func checkdog(ctx *zero.Ctx) bool {
|
|||||||
case fianceestatus == 0: // 如果为受
|
case fianceestatus == 0: // 如果为受
|
||||||
ctx.SendChain(message.Text("这是一个纯爱的世界,拒绝NTR"))
|
ctx.SendChain(message.Text("这是一个纯爱的世界,拒绝NTR"))
|
||||||
return false
|
return false
|
||||||
case fianceestatus != 3 && fianceeinfo.Target == 0:
|
|
||||||
ctx.SendChain(message.Text("今天的ta是单身贵族噢"))
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -739,11 +743,8 @@ func checkcp(ctx *zero.Ctx) bool {
|
|||||||
ctx.SendChain(message.Text("额,你的对象好像不存在?"))
|
ctx.SendChain(message.Text("额,你的对象好像不存在?"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
uid := ctx.Event.UserID
|
|
||||||
if fiancee == uid {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
// 检查用户是否登记过
|
// 检查用户是否登记过
|
||||||
|
uid := ctx.Event.UserID
|
||||||
userinfo, uidstatus, err := 民政局.查户口(gid, uid)
|
userinfo, uidstatus, err := 民政局.查户口(gid, uid)
|
||||||
switch {
|
switch {
|
||||||
case uidstatus == 2:
|
case uidstatus == 2:
|
||||||
@ -755,6 +756,8 @@ func checkcp(ctx *zero.Ctx) bool {
|
|||||||
case uidstatus != 3 && userinfo.Target == 0: // 如果是单身贵族
|
case uidstatus != 3 && userinfo.Target == 0: // 如果是单身贵族
|
||||||
ctx.SendChain(message.Text("今天的你是单身贵族哦"))
|
ctx.SendChain(message.Text("今天的你是单身贵族哦"))
|
||||||
return false
|
return false
|
||||||
|
case fiancee == uid: //自我攻略
|
||||||
|
return true
|
||||||
case uidstatus == 1: // 如果如为攻
|
case uidstatus == 1: // 如果如为攻
|
||||||
ctx.SendChain(message.Text("打灭,不给纳小妾!"))
|
ctx.SendChain(message.Text("打灭,不给纳小妾!"))
|
||||||
return false
|
return false
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user