mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 13:59:39 +08:00
This reverts commit 263278d71d.
This commit is contained in:
parent
263278d71d
commit
6f1ec04ac8
@ -745,15 +745,13 @@ print("run[CQ:image,file="+j["img"]+"]")
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
<details>
|
<details>
|
||||||
<summary>中日韩 VITS 模型拟声</summary>
|
<summary>日韩 VITS 模型拟声</summary>
|
||||||
|
|
||||||
`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moegoe"`
|
`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moegoe"`
|
||||||
|
|
||||||
- [x] 让[宁宁|爱瑠|芳乃|茉子|丛雨|小春|七海]说(日语)
|
- [x] 让[宁宁|爱瑠|芳乃|茉子|丛雨|小春|七海]说(日语)
|
||||||
|
|
||||||
- [x] 让[수아|미미르|아린|연화|유화|선배]说(韩语)
|
- [x] 让[수아|미미르|아린|연화|유화|선배]说(韩语)
|
||||||
|
|
||||||
- [x] 让[派蒙|凯亚|安柏|丽莎|琴|香菱|枫原万叶|迪卢克|温迪|可莉|早柚|托马|芭芭拉|优菈|云堇|钟离|魈|凝光|雷电将军|北斗|甘雨|七七|刻晴|神里绫华|雷泽|神里绫人|罗莎莉亚|阿贝多|八重神子|宵宫|荒泷一斗|九条裟罗|夜兰|珊瑚宫心海|五郎|达达利亚|莫娜|班尼特|申鹤|行秋|烟绯|久岐忍|辛焱|砂糖|胡桃|重云|菲谢尔|诺艾尔|迪奥娜|鹿野院平藏]说(中文)
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
<details>
|
<details>
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import (
|
|||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
|
|
||||||
// 反并发
|
//反并发
|
||||||
"github.com/wdvxdr1123/ZeroBot/extension/single"
|
"github.com/wdvxdr1123/ZeroBot/extension/single"
|
||||||
// 数据库
|
// 数据库
|
||||||
sql "github.com/FloatTech/sqlite"
|
sql "github.com/FloatTech/sqlite"
|
||||||
|
|||||||
@ -1,351 +1,351 @@
|
|||||||
package qqwife
|
package qqwife
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
sql "github.com/FloatTech/sqlite"
|
sql "github.com/FloatTech/sqlite"
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
|
|
||||||
// 画图
|
// 画图
|
||||||
"github.com/Coloured-glaze/gg"
|
"github.com/Coloured-glaze/gg"
|
||||||
)
|
)
|
||||||
|
|
||||||
// nolint: asciicheck
|
//nolint: asciicheck
|
||||||
//nolint: asciicheck
|
// nolint: asciicheck
|
||||||
type 婚姻登记 struct {
|
type 婚姻登记 struct {
|
||||||
db *sql.Sqlite
|
db *sql.Sqlite
|
||||||
dbmu sync.RWMutex
|
dbmu sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
// 结婚证信息
|
// 结婚证信息
|
||||||
type userinfo struct {
|
type userinfo struct {
|
||||||
User int64 // 用户身份证
|
User int64 // 用户身份证
|
||||||
Target int64 // 对象身份证号
|
Target int64 // 对象身份证号
|
||||||
Username string // 户主名称
|
Username string // 户主名称
|
||||||
Targetname string // 对象名称
|
Targetname string // 对象名称
|
||||||
Updatetime string // 登记时间
|
Updatetime string // 登记时间
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 民政局的当前时间
|
// 民政局的当前时间
|
||||||
type updateinfo struct {
|
type updateinfo struct {
|
||||||
GID int64
|
GID int64
|
||||||
Updatetime string // 登记时间
|
Updatetime string // 登记时间
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sql *婚姻登记) 开门时间(gid int64) (ok bool, err error) {
|
func (sql *婚姻登记) 开门时间(gid int64) (ok bool, err error) {
|
||||||
sql.dbmu.Lock()
|
sql.dbmu.Lock()
|
||||||
defer sql.dbmu.Unlock()
|
defer sql.dbmu.Unlock()
|
||||||
ok = false
|
ok = false
|
||||||
err = sql.db.Create("updateinfo", &updateinfo{})
|
err = sql.db.Create("updateinfo", &updateinfo{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
gidstr := strconv.FormatInt(gid, 10)
|
gidstr := strconv.FormatInt(gid, 10)
|
||||||
dbinfo := updateinfo{}
|
dbinfo := updateinfo{}
|
||||||
// 获取表格更新的时间
|
// 获取表格更新的时间
|
||||||
err = sql.db.Find("updateinfo", &dbinfo, "where gid is "+gidstr)
|
err = sql.db.Find("updateinfo", &dbinfo, "where gid is "+gidstr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// 如果没有登记过就记录
|
// 如果没有登记过就记录
|
||||||
err = sql.db.Insert("updateinfo", &updateinfo{
|
err = sql.db.Insert("updateinfo", &updateinfo{
|
||||||
GID: gid,
|
GID: gid,
|
||||||
Updatetime: time.Now().Format("2006/01/02"),
|
Updatetime: time.Now().Format("2006/01/02"),
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
ok = true
|
ok = true
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 开门了就拿新的花名册
|
// 开门了就拿新的花名册
|
||||||
if time.Now().Format("2006/01/02") == dbinfo.Updatetime {
|
if time.Now().Format("2006/01/02") == dbinfo.Updatetime {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = sql.db.Drop(gidstr)
|
err = sql.db.Drop(gidstr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
updateinfo := updateinfo{
|
updateinfo := updateinfo{
|
||||||
GID: gid,
|
GID: gid,
|
||||||
Updatetime: time.Now().Format("2006/01/02"),
|
Updatetime: time.Now().Format("2006/01/02"),
|
||||||
}
|
}
|
||||||
err = sql.db.Insert("updateinfo", &updateinfo)
|
err = sql.db.Insert("updateinfo", &updateinfo)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
ok = true
|
ok = true
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sql *婚姻登记) 清理花名册(gid string) error {
|
func (sql *婚姻登记) 清理花名册(gid string) error {
|
||||||
sql.dbmu.Lock()
|
sql.dbmu.Lock()
|
||||||
defer sql.dbmu.Unlock()
|
defer sql.dbmu.Unlock()
|
||||||
grouplist, err := sql.db.ListTables()
|
grouplist, err := sql.db.ListTables()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if gid != "0" {
|
if gid != "0" {
|
||||||
grouplist = []string{gid}
|
grouplist = []string{gid}
|
||||||
}
|
}
|
||||||
for _, gid := range grouplist {
|
for _, gid := range grouplist {
|
||||||
err = sql.db.Drop(gid)
|
err = sql.db.Drop(gid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
gidint, _ := strconv.ParseInt(gid, 10, 64)
|
gidint, _ := strconv.ParseInt(gid, 10, 64)
|
||||||
updateinfo := updateinfo{
|
updateinfo := updateinfo{
|
||||||
GID: gidint,
|
GID: gidint,
|
||||||
Updatetime: time.Now().Format("2006/01/02"),
|
Updatetime: time.Now().Format("2006/01/02"),
|
||||||
}
|
}
|
||||||
err = sql.db.Insert("updateinfo", &updateinfo)
|
err = sql.db.Insert("updateinfo", &updateinfo)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sql *婚姻登记) 查户口(gid, uid int64) (info userinfo, status string, err error) {
|
func (sql *婚姻登记) 查户口(gid, uid int64) (info userinfo, status string, err error) {
|
||||||
sql.dbmu.Lock()
|
sql.dbmu.Lock()
|
||||||
defer sql.dbmu.Unlock()
|
defer sql.dbmu.Unlock()
|
||||||
gidstr := strconv.FormatInt(gid, 10)
|
gidstr := strconv.FormatInt(gid, 10)
|
||||||
uidstr := strconv.FormatInt(uid, 10)
|
uidstr := strconv.FormatInt(uid, 10)
|
||||||
status = "单"
|
status = "单"
|
||||||
err = sql.db.Create(gidstr, &userinfo{})
|
err = sql.db.Create(gidstr, &userinfo{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
status = "错"
|
status = "错"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = sql.db.Find(gidstr, &info, "where user = "+uidstr)
|
err = sql.db.Find(gidstr, &info, "where user = "+uidstr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
status = "攻"
|
status = "攻"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = sql.db.Find(gidstr, &info, "where target = "+uidstr)
|
err = sql.db.Find(gidstr, &info, "where target = "+uidstr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
status = "受"
|
status = "受"
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sql *婚姻登记) 登记(gid, uid, target int64, username, targetname string) error {
|
func (sql *婚姻登记) 登记(gid, uid, target int64, username, targetname string) error {
|
||||||
sql.dbmu.Lock()
|
sql.dbmu.Lock()
|
||||||
defer sql.dbmu.Unlock()
|
defer sql.dbmu.Unlock()
|
||||||
gidstr := strconv.FormatInt(gid, 10)
|
gidstr := strconv.FormatInt(gid, 10)
|
||||||
err := sql.db.Create(gidstr, &userinfo{})
|
err := sql.db.Create(gidstr, &userinfo{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
updatetime := time.Now().Format("2006/01/02")
|
updatetime := time.Now().Format("2006/01/02")
|
||||||
// 填写夫妻信息
|
// 填写夫妻信息
|
||||||
uidinfo := userinfo{
|
uidinfo := userinfo{
|
||||||
User: uid,
|
User: uid,
|
||||||
Username: username,
|
Username: username,
|
||||||
Target: target,
|
Target: target,
|
||||||
Targetname: targetname,
|
Targetname: targetname,
|
||||||
Updatetime: updatetime,
|
Updatetime: updatetime,
|
||||||
}
|
}
|
||||||
// 民政局登记数据
|
// 民政局登记数据
|
||||||
err = sql.db.Insert(gidstr, &uidinfo)
|
err = sql.db.Insert(gidstr, &uidinfo)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sql *婚姻登记) 离婚休妻(gid, wife int64) error {
|
func (sql *婚姻登记) 离婚休妻(gid, wife int64) error {
|
||||||
sql.dbmu.Lock()
|
sql.dbmu.Lock()
|
||||||
defer sql.dbmu.Unlock()
|
defer sql.dbmu.Unlock()
|
||||||
gidstr := strconv.FormatInt(gid, 10)
|
gidstr := strconv.FormatInt(gid, 10)
|
||||||
wifestr := strconv.FormatInt(wife, 10)
|
wifestr := strconv.FormatInt(wife, 10)
|
||||||
return sql.db.Del(gidstr, "where target = "+wifestr)
|
return sql.db.Del(gidstr, "where target = "+wifestr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sql *婚姻登记) 离婚休夫(gid, husband int64) error {
|
func (sql *婚姻登记) 离婚休夫(gid, husband int64) error {
|
||||||
sql.dbmu.Lock()
|
sql.dbmu.Lock()
|
||||||
defer sql.dbmu.Unlock()
|
defer sql.dbmu.Unlock()
|
||||||
gidstr := strconv.FormatInt(gid, 10)
|
gidstr := strconv.FormatInt(gid, 10)
|
||||||
husbandstr := strconv.FormatInt(husband, 10)
|
husbandstr := strconv.FormatInt(husband, 10)
|
||||||
return sql.db.Del(gidstr, "where user = "+husbandstr)
|
return sql.db.Del(gidstr, "where user = "+husbandstr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sql *婚姻登记) 花名册(gid int64) (list [][4]string, number int, err error) {
|
func (sql *婚姻登记) 花名册(gid int64) (list [][4]string, number int, err error) {
|
||||||
sql.dbmu.Lock()
|
sql.dbmu.Lock()
|
||||||
defer sql.dbmu.Unlock()
|
defer sql.dbmu.Unlock()
|
||||||
gidstr := strconv.FormatInt(gid, 10)
|
gidstr := strconv.FormatInt(gid, 10)
|
||||||
err = sql.db.Create(gidstr, &userinfo{})
|
err = sql.db.Create(gidstr, &userinfo{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
number, err = sql.db.Count(gidstr)
|
number, err = sql.db.Count(gidstr)
|
||||||
if err != nil || number <= 0 {
|
if err != nil || number <= 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
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 {
|
if info.Target == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
dbinfo := [4]string{
|
dbinfo := [4]string{
|
||||||
info.Username,
|
info.Username,
|
||||||
strconv.FormatInt(info.User, 10),
|
strconv.FormatInt(info.User, 10),
|
||||||
info.Targetname,
|
info.Targetname,
|
||||||
strconv.FormatInt(info.Target, 10),
|
strconv.FormatInt(info.Target, 10),
|
||||||
}
|
}
|
||||||
list = append(list, dbinfo)
|
list = append(list, dbinfo)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if len(list) == 0 {
|
if len(list) == 0 {
|
||||||
number = 0
|
number = 0
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func slicename(name string, canvas *gg.Context) (resultname string) {
|
func slicename(name string, canvas *gg.Context) (resultname string) {
|
||||||
usermane := []rune(name) // 将每个字符单独放置
|
usermane := []rune(name) // 将每个字符单独放置
|
||||||
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
|
||||||
}
|
}
|
||||||
numberlen = i
|
numberlen = i
|
||||||
}
|
}
|
||||||
if widthlen > 350 {
|
if widthlen > 350 {
|
||||||
resultname = string(usermane[:numberlen-1]) + "......" // 名字切片
|
resultname = string(usermane[:numberlen-1]) + "......" // 名字切片
|
||||||
} else {
|
} else {
|
||||||
resultname = name
|
resultname = name
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 以群号和昵称为限制
|
// 以群号和昵称为限制
|
||||||
func cdcheck(ctx *zero.Ctx) *rate.Limiter {
|
func cdcheck(ctx *zero.Ctx) *rate.Limiter {
|
||||||
limitID := strconv.FormatInt(ctx.Event.GroupID, 10) + strconv.FormatInt(ctx.Event.UserID, 10) + "1"
|
limitID := strconv.FormatInt(ctx.Event.GroupID, 10) + strconv.FormatInt(ctx.Event.UserID, 10) + "1"
|
||||||
return skillCD.Load(limitID)
|
return skillCD.Load(limitID)
|
||||||
}
|
}
|
||||||
func cdcheck2(ctx *zero.Ctx) *rate.Limiter {
|
func cdcheck2(ctx *zero.Ctx) *rate.Limiter {
|
||||||
limitID := strconv.FormatInt(ctx.Event.GroupID, 10) + strconv.FormatInt(ctx.Event.UserID, 10) + "2"
|
limitID := strconv.FormatInt(ctx.Event.GroupID, 10) + strconv.FormatInt(ctx.Event.UserID, 10) + "2"
|
||||||
return skillCD.Load(limitID)
|
return skillCD.Load(limitID)
|
||||||
}
|
}
|
||||||
func cdcheck3(ctx *zero.Ctx) *rate.Limiter {
|
func cdcheck3(ctx *zero.Ctx) *rate.Limiter {
|
||||||
limitID := strconv.FormatInt(ctx.Event.GroupID, 10) + strconv.FormatInt(ctx.Event.UserID, 10) + "3"
|
limitID := strconv.FormatInt(ctx.Event.GroupID, 10) + strconv.FormatInt(ctx.Event.UserID, 10) + "3"
|
||||||
return skillCD.Load(limitID)
|
return skillCD.Load(limitID)
|
||||||
}
|
}
|
||||||
func iscding(ctx *zero.Ctx) {
|
func iscding(ctx *zero.Ctx) {
|
||||||
ctx.SendChain(message.Text("你的技能现在正在CD中"))
|
ctx.SendChain(message.Text("你的技能现在正在CD中"))
|
||||||
}
|
}
|
||||||
func iscding2(ctx *zero.Ctx) {
|
func iscding2(ctx *zero.Ctx) {
|
||||||
ctx.SendChain(message.Text("打灭,禁止离婚 (你的技能正在CD中)"))
|
ctx.SendChain(message.Text("打灭,禁止离婚 (你的技能正在CD中)"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注入判断 是否为单身
|
// 注入判断 是否为单身
|
||||||
func checkdog(ctx *zero.Ctx) bool {
|
func checkdog(ctx *zero.Ctx) bool {
|
||||||
// 得先判断用户是否存在才行在,再重置
|
// 得先判断用户是否存在才行在,再重置
|
||||||
fiancee, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
fiancee, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("额,你的target好像不存在?"))
|
ctx.SendChain(message.Text("额,你的target好像不存在?"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// 判断是否需要重置
|
// 判断是否需要重置
|
||||||
gid := ctx.Event.GroupID
|
gid := ctx.Event.GroupID
|
||||||
ok, err := 民政局.开门时间(gid)
|
ok, err := 民政局.开门时间(gid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("群状态查询失败\n[error]", err))
|
ctx.SendChain(message.Text("群状态查询失败\n[error]", err))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if ok {
|
if ok {
|
||||||
return true // 重置后也全是单身
|
return true // 重置后也全是单身
|
||||||
}
|
}
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
uidtarget, uidstatus, err := 民政局.查户口(gid, uid)
|
uidtarget, uidstatus, err := 民政局.查户口(gid, uid)
|
||||||
switch {
|
switch {
|
||||||
case uidstatus == "错":
|
case uidstatus == "错":
|
||||||
ctx.SendChain(message.Text("用户状态查询失败\n[error]", err))
|
ctx.SendChain(message.Text("用户状态查询失败\n[error]", err))
|
||||||
return false
|
return false
|
||||||
case uidstatus != "单" && (uidtarget.Target == 0 || uidtarget.User == 0): // 如果是单身贵族
|
case uidstatus != "单" && (uidtarget.Target == 0 || uidtarget.User == 0): // 如果是单身贵族
|
||||||
ctx.SendChain(message.Text("今天的你是单身贵族噢"))
|
ctx.SendChain(message.Text("今天的你是单身贵族噢"))
|
||||||
return false
|
return false
|
||||||
case (uidstatus == "攻" && uidtarget.Target == fiancee) ||
|
case (uidstatus == "攻" && uidtarget.Target == fiancee) ||
|
||||||
(uidstatus == "受" && uidtarget.User == fiancee):
|
(uidstatus == "受" && uidtarget.User == fiancee):
|
||||||
ctx.SendChain(message.Text("笨蛋!你们已经在一起了!"))
|
ctx.SendChain(message.Text("笨蛋!你们已经在一起了!"))
|
||||||
return false
|
return false
|
||||||
case uidstatus == "攻": // 如果如为攻
|
case uidstatus == "攻": // 如果如为攻
|
||||||
ctx.SendChain(message.Text("笨蛋~你家里还有个吃白饭的w"))
|
ctx.SendChain(message.Text("笨蛋~你家里还有个吃白饭的w"))
|
||||||
return false
|
return false
|
||||||
case uidstatus == "受": // 如果为受
|
case uidstatus == "受": // 如果为受
|
||||||
ctx.SendChain(message.Text("该是0就是0,当0有什么不好"))
|
ctx.SendChain(message.Text("该是0就是0,当0有什么不好"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
fianceeinfo, fianceestatus, err := 民政局.查户口(gid, fiancee)
|
fianceeinfo, fianceestatus, err := 民政局.查户口(gid, fiancee)
|
||||||
switch {
|
switch {
|
||||||
case fianceestatus == "错":
|
case fianceestatus == "错":
|
||||||
ctx.SendChain(message.Text("对象状态查询失败\n[error]", err))
|
ctx.SendChain(message.Text("对象状态查询失败\n[error]", err))
|
||||||
case fianceestatus == "单": // 如果为单身狗
|
case fianceestatus == "单": // 如果为单身狗
|
||||||
return true
|
return true
|
||||||
case fianceestatus != "单" && (fianceeinfo.Target == 0 || fianceeinfo.User == 0): // 如果是单身贵族
|
case fianceestatus != "单" && (fianceeinfo.Target == 0 || fianceeinfo.User == 0): // 如果是单身贵族
|
||||||
ctx.SendChain(message.Text("今天的ta是单身贵族噢"))
|
ctx.SendChain(message.Text("今天的ta是单身贵族噢"))
|
||||||
case fianceestatus == "攻": // 如果如为攻
|
case fianceestatus == "攻": // 如果如为攻
|
||||||
ctx.SendChain(message.Text("他有别的女人了,你该放下了"))
|
ctx.SendChain(message.Text("他有别的女人了,你该放下了"))
|
||||||
case fianceestatus == "受": // 如果为受
|
case fianceestatus == "受": // 如果为受
|
||||||
ctx.SendChain(message.Text("ta被别人娶了,你来晚力"))
|
ctx.SendChain(message.Text("ta被别人娶了,你来晚力"))
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注入判断 是否满足小三要求
|
// 注入判断 是否满足小三要求
|
||||||
func checkcp(ctx *zero.Ctx) bool {
|
func checkcp(ctx *zero.Ctx) bool {
|
||||||
// 得先判断用户是否存在才行在,再重置
|
// 得先判断用户是否存在才行在,再重置
|
||||||
fiancee, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
fiancee, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("额,你的target好像不存在?"))
|
ctx.SendChain(message.Text("额,你的target好像不存在?"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// 判断是否需要重置
|
// 判断是否需要重置
|
||||||
gid := ctx.Event.GroupID
|
gid := ctx.Event.GroupID
|
||||||
ok, err := 民政局.开门时间(gid)
|
ok, err := 民政局.开门时间(gid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("群状态查询失败\n[error]", err))
|
ctx.SendChain(message.Text("群状态查询失败\n[error]", err))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if ok {
|
if ok {
|
||||||
ctx.SendChain(message.Text("ta现在还是单身哦,快向ta表白吧!"))
|
ctx.SendChain(message.Text("ta现在还是单身哦,快向ta表白吧!"))
|
||||||
return false // 重置后也全是单身
|
return false // 重置后也全是单身
|
||||||
}
|
}
|
||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
fianceeinfo, fianceestatus, err := 民政局.查户口(gid, fiancee)
|
fianceeinfo, fianceestatus, err := 民政局.查户口(gid, fiancee)
|
||||||
switch {
|
switch {
|
||||||
case fianceestatus == "错":
|
case fianceestatus == "错":
|
||||||
ctx.SendChain(message.Text("对象状态查询失败\n[error]", err))
|
ctx.SendChain(message.Text("对象状态查询失败\n[error]", err))
|
||||||
return false
|
return false
|
||||||
case fianceestatus == "单": // 如果为单身狗
|
case fianceestatus == "单": // 如果为单身狗
|
||||||
if fiancee == uid {
|
if fiancee == uid {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
ctx.SendChain(message.Text("ta现在还是单身哦,快向ta表白吧!"))
|
ctx.SendChain(message.Text("ta现在还是单身哦,快向ta表白吧!"))
|
||||||
return false
|
return false
|
||||||
case fianceestatus != "单" && (fianceeinfo.Target == 0 || fianceeinfo.User == 0): // 如果是单身贵族
|
case fianceestatus != "单" && (fianceeinfo.Target == 0 || fianceeinfo.User == 0): // 如果是单身贵族
|
||||||
ctx.SendChain(message.Text("今天的ta是单身贵族噢"))
|
ctx.SendChain(message.Text("今天的ta是单身贵族噢"))
|
||||||
return false
|
return false
|
||||||
case (fianceestatus == "攻" && fianceeinfo.Target == fiancee) ||
|
case (fianceestatus == "攻" && fianceeinfo.Target == fiancee) ||
|
||||||
(fianceestatus == "受" && fianceeinfo.User == fiancee):
|
(fianceestatus == "受" && fianceeinfo.User == fiancee):
|
||||||
ctx.SendChain(message.Text("笨蛋!你们已经在一起了!"))
|
ctx.SendChain(message.Text("笨蛋!你们已经在一起了!"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
uidtarget, uidstatus, err := 民政局.查户口(gid, uid)
|
uidtarget, uidstatus, err := 民政局.查户口(gid, uid)
|
||||||
switch {
|
switch {
|
||||||
case uidstatus == "错":
|
case uidstatus == "错":
|
||||||
ctx.SendChain(message.Text("用户状态查询失败\n[error]", err))
|
ctx.SendChain(message.Text("用户状态查询失败\n[error]", err))
|
||||||
case uidstatus == "单": // 如果为单身狗
|
case uidstatus == "单": // 如果为单身狗
|
||||||
return true
|
return true
|
||||||
case uidstatus != "单" && (uidtarget.Target == 0 || uidtarget.User == 0): // 如果是单身贵族
|
case uidstatus != "单" && (uidtarget.Target == 0 || uidtarget.User == 0): // 如果是单身贵族
|
||||||
ctx.SendChain(message.Text("今天的你是单身贵族噢"))
|
ctx.SendChain(message.Text("今天的你是单身贵族噢"))
|
||||||
case uidstatus == "攻": // 如果如为攻
|
case uidstatus == "攻": // 如果如为攻
|
||||||
ctx.SendChain(message.Text("打灭,不给纳小妾!"))
|
ctx.SendChain(message.Text("打灭,不给纳小妾!"))
|
||||||
case uidstatus == "受": // 如果为受
|
case uidstatus == "受": // 如果为受
|
||||||
ctx.SendChain(message.Text("该是0就是0,当0有什么不好"))
|
ctx.SendChain(message.Text("该是0就是0,当0有什么不好"))
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user