mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin
This commit is contained in:
commit
5f3054d344
@ -89,7 +89,7 @@ func init() {
|
|||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
// 技能CD设置
|
// 技能CD设置
|
||||||
engine.OnRegex(`^设置CD为(\d+)小时`, zero.OnlyGroup, getdb).SetBlock(true).Limit(ctxext.LimitByUser).
|
engine.OnRegex(`^设置CD为(\d+)小时`, zero.OnlyGroup, zero.AdminPermission, getdb).SetBlock(true).Limit(ctxext.LimitByUser).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
cdTime, err := strconv.ParseFloat(ctx.State["regex_matched"].([]string)[1], 64)
|
cdTime, err := strconv.ParseFloat(ctx.State["regex_matched"].([]string)[1], 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -104,7 +104,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
ctx.SendChain(message.Text("设置成功"))
|
ctx.SendChain(message.Text("设置成功"))
|
||||||
})
|
})
|
||||||
engine.OnRegex(`^(允许|禁止)(自由恋爱|牛头人)$`, zero.AdminPermission, getdb).SetBlock(true).
|
engine.OnRegex(`^(允许|禁止)(自由恋爱|牛头人)$`, zero.OnlyGroup, zero.AdminPermission, getdb).SetBlock(true).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
status := ctx.State["regex_matched"].([]string)[1]
|
status := ctx.State["regex_matched"].([]string)[1]
|
||||||
mode := ctx.State["regex_matched"].([]string)[2]
|
mode := ctx.State["regex_matched"].([]string)[2]
|
||||||
@ -161,7 +161,7 @@ func init() {
|
|||||||
case status == "攻": // 娶过别人
|
case status == "攻": // 娶过别人
|
||||||
ctx.SendChain(
|
ctx.SendChain(
|
||||||
message.At(uid),
|
message.At(uid),
|
||||||
message.Text("\n今天你已经娶过了,群老婆是"),
|
message.Text("\n今天你在", targetinfo.Updatetime, "娶了群友"),
|
||||||
message.Image("http://q4.qlogo.cn/g?b=qq&nk="+strconv.FormatInt(targetinfo.Target, 10)+"&s=640").Add("cache", 0),
|
message.Image("http://q4.qlogo.cn/g?b=qq&nk="+strconv.FormatInt(targetinfo.Target, 10)+"&s=640").Add("cache", 0),
|
||||||
message.Text(
|
message.Text(
|
||||||
"\n",
|
"\n",
|
||||||
@ -173,12 +173,12 @@ func init() {
|
|||||||
case status == "受": // 嫁给别人
|
case status == "受": // 嫁给别人
|
||||||
ctx.SendChain(
|
ctx.SendChain(
|
||||||
message.At(uid),
|
message.At(uid),
|
||||||
message.Text("\n今天你被娶了,群老公是"),
|
message.Text("\n今天你在", targetinfo.Updatetime, "被群友"),
|
||||||
message.Image("http://q4.qlogo.cn/g?b=qq&nk="+strconv.FormatInt(targetinfo.User, 10)+"&s=640").Add("cache", 0),
|
message.Image("http://q4.qlogo.cn/g?b=qq&nk="+strconv.FormatInt(targetinfo.User, 10)+"&s=640").Add("cache", 0),
|
||||||
message.Text(
|
message.Text(
|
||||||
"\n",
|
"\n",
|
||||||
"[", targetinfo.Username, "]",
|
"[", targetinfo.Username, "]",
|
||||||
"(", targetinfo.User, ")哒",
|
"(", targetinfo.User, ")娶了",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@ -243,6 +243,11 @@ func init() {
|
|||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
choice := ctx.State["regex_matched"].([]string)[1]
|
choice := ctx.State["regex_matched"].([]string)[1]
|
||||||
fiancee, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
fiancee, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
||||||
|
// 写入CD
|
||||||
|
err := 民政局.writeCDtime(gid, uid, 1)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.At(uid), message.Text("[qqwife]你的技能CD记录失败\n", err))
|
||||||
|
}
|
||||||
if uid == fiancee { // 如果是自己
|
if uid == fiancee { // 如果是自己
|
||||||
switch rand.Intn(3) {
|
switch rand.Intn(3) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -307,6 +312,11 @@ func init() {
|
|||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
fid := ctx.State["regex_matched"].([]string)
|
fid := ctx.State["regex_matched"].([]string)
|
||||||
fiancee, _ := strconv.ParseInt(fid[2]+fid[3], 10, 64)
|
fiancee, _ := strconv.ParseInt(fid[2]+fid[3], 10, 64)
|
||||||
|
// 写入CD
|
||||||
|
err := 民政局.writeCDtime(gid, uid, 2)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.At(uid), message.Text("[qqwife]你的技能CD记录失败\n", err))
|
||||||
|
}
|
||||||
if fiancee == uid {
|
if fiancee == uid {
|
||||||
ctx.SendChain(message.Text("今日获得成就:自我攻略"))
|
ctx.SendChain(message.Text("今日获得成就:自我攻略"))
|
||||||
return
|
return
|
||||||
@ -391,6 +401,11 @@ func init() {
|
|||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
gayOne, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
gayOne, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
||||||
gayZero, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
gayZero, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
||||||
|
// 写入CD
|
||||||
|
err := 民政局.writeCDtime(gid, uid, 3)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.At(uid), message.Text("[qqwife]你的技能CD记录失败\n", err))
|
||||||
|
}
|
||||||
favor, err := 民政局.getFavorability(gayOne, gayZero)
|
favor, err := 民政局.getFavorability(gayOne, gayZero)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("[qqwife]好感度库发生问题力\n", err))
|
ctx.SendChain(message.Text("[qqwife]好感度库发生问题力\n", err))
|
||||||
@ -447,6 +462,11 @@ func init() {
|
|||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
gid := ctx.Event.GroupID
|
gid := ctx.Event.GroupID
|
||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
|
// 写入CD
|
||||||
|
err := 民政局.writeCDtime(gid, uid, 4)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.At(uid), message.Text("[qqwife]你的技能CD记录失败\n", err))
|
||||||
|
}
|
||||||
info, uidstatus, err := 民政局.查户口(gid, uid)
|
info, uidstatus, err := 民政局.查户口(gid, uid)
|
||||||
mun := 2
|
mun := 2
|
||||||
var fiancee int64
|
var fiancee int64
|
||||||
@ -466,7 +486,10 @@ func init() {
|
|||||||
ctx.SendChain(message.Text("[qqwife]好感度库发生问题力\n", err))
|
ctx.SendChain(message.Text("[qqwife]好感度库发生问题力\n", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if rand.Intn(1+favor) > favor/10 {
|
if favor < 20 {
|
||||||
|
favor = 10
|
||||||
|
}
|
||||||
|
if rand.Intn(101) > 100-favor {
|
||||||
ctx.SendChain(message.Text(sendtext[3][rand.Intn(len(sendtext[3]))]))
|
ctx.SendChain(message.Text(sendtext[3][rand.Intn(len(sendtext[3]))]))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// nolint: asciicheck
|
// nolint: asciicheck
|
||||||
//nolint: asciicheck
|
// nolint: asciicheck
|
||||||
type 婚姻登记 struct {
|
type 婚姻登记 struct {
|
||||||
db *sql.Sqlite
|
db *sql.Sqlite
|
||||||
dbmu sync.RWMutex
|
dbmu sync.RWMutex
|
||||||
@ -59,14 +59,9 @@ func (sql *婚姻登记) 开门时间(gid int64) (ok bool, err error) {
|
|||||||
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 = sql.db.Drop("updateinfo"); err == nil {
|
|
||||||
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{}
|
||||||
// 获取表格更新的时间
|
// 获取表格更新的时间
|
||||||
@ -243,7 +238,7 @@ func (sql *婚姻登记) 登记(gid, uid, target int64, username, targetname str
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
updatetime := time.Now().Format("2006/01/02")
|
updatetime := time.Now().Format("15:04:05")
|
||||||
// 填写夫妻信息
|
// 填写夫妻信息
|
||||||
uidinfo := userinfo{
|
uidinfo := userinfo{
|
||||||
User: uid,
|
User: uid,
|
||||||
@ -498,7 +493,6 @@ func (sql *婚姻登记) compareCDtime(gid, uid, mun int64, cdtime float64) (ok
|
|||||||
|
|
||||||
// 注入判断 是否为单身
|
// 注入判断 是否为单身
|
||||||
func checkdog(ctx *zero.Ctx) bool {
|
func checkdog(ctx *zero.Ctx) bool {
|
||||||
mode := int64(1) // 指代技能1
|
|
||||||
gid := ctx.Event.GroupID
|
gid := ctx.Event.GroupID
|
||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
// 获取CD
|
// 获取CD
|
||||||
@ -506,7 +500,7 @@ func checkdog(ctx *zero.Ctx) bool {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("[qqwife]获取该群技能CD错误(将以CD12H计算)\n", err))
|
ctx.SendChain(message.Text("[qqwife]获取该群技能CD错误(将以CD12H计算)\n", err))
|
||||||
}
|
}
|
||||||
ok, err := 民政局.compareCDtime(gid, uid, mode, cdTime)
|
ok, err := 民政局.compareCDtime(gid, uid, 1, cdTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("[qqwife]查询用户CD状态失败,请重试\n", err))
|
ctx.SendChain(message.Text("[qqwife]查询用户CD状态失败,请重试\n", err))
|
||||||
return false
|
return false
|
||||||
@ -515,11 +509,6 @@ func checkdog(ctx *zero.Ctx) bool {
|
|||||||
ctx.SendChain(message.Text("你的技能还在CD中..."))
|
ctx.SendChain(message.Text("你的技能还在CD中..."))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// 写入CD
|
|
||||||
err = 民政局.writeCDtime(gid, uid, mode)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.At(uid), message.Text("[qqwife]你的技能CD记录失败\n", err))
|
|
||||||
}
|
|
||||||
// 判断是否符合条件
|
// 判断是否符合条件
|
||||||
stauts, _, err := 民政局.营业模式(gid)
|
stauts, _, err := 民政局.营业模式(gid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -583,7 +572,6 @@ func checkdog(ctx *zero.Ctx) bool {
|
|||||||
|
|
||||||
// 注入判断 是否满足小三要求
|
// 注入判断 是否满足小三要求
|
||||||
func checkcp(ctx *zero.Ctx) bool {
|
func checkcp(ctx *zero.Ctx) bool {
|
||||||
mode := int64(2) // 指代技能2
|
|
||||||
gid := ctx.Event.GroupID
|
gid := ctx.Event.GroupID
|
||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
// 获取CD
|
// 获取CD
|
||||||
@ -591,7 +579,7 @@ func checkcp(ctx *zero.Ctx) bool {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("[qqwife]获取该群技能CD错误(将以CD12H计算)\n", err))
|
ctx.SendChain(message.Text("[qqwife]获取该群技能CD错误(将以CD12H计算)\n", err))
|
||||||
}
|
}
|
||||||
ok, err := 民政局.compareCDtime(gid, uid, mode, cdTime)
|
ok, err := 民政局.compareCDtime(gid, uid, 2, cdTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("[qqwife]查询用户CD状态失败,请重试\n", err))
|
ctx.SendChain(message.Text("[qqwife]查询用户CD状态失败,请重试\n", err))
|
||||||
return false
|
return false
|
||||||
@ -600,11 +588,6 @@ func checkcp(ctx *zero.Ctx) bool {
|
|||||||
ctx.SendChain(message.Text("你的技能还在CD中..."))
|
ctx.SendChain(message.Text("你的技能还在CD中..."))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// 写入CD
|
|
||||||
err = 民政局.writeCDtime(gid, uid, mode)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.At(uid), message.Text("[qqwife]你的技能CD记录失败\n", err))
|
|
||||||
}
|
|
||||||
// 判断是否符合条件
|
// 判断是否符合条件
|
||||||
_, stauts, err := 民政局.营业模式(gid)
|
_, stauts, err := 民政局.营业模式(gid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -669,7 +652,6 @@ func checkcp(ctx *zero.Ctx) bool {
|
|||||||
|
|
||||||
// 注入判断 是否满足离婚要求
|
// 注入判断 是否满足离婚要求
|
||||||
func checkdivorce(ctx *zero.Ctx) bool {
|
func checkdivorce(ctx *zero.Ctx) bool {
|
||||||
mode := int64(3) // 指代技能3
|
|
||||||
gid := ctx.Event.GroupID
|
gid := ctx.Event.GroupID
|
||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
// 获取CD
|
// 获取CD
|
||||||
@ -677,7 +659,7 @@ func checkdivorce(ctx *zero.Ctx) bool {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("[qqwife]获取该群技能CD错误(将以CD12H计算)\n", err))
|
ctx.SendChain(message.Text("[qqwife]获取该群技能CD错误(将以CD12H计算)\n", err))
|
||||||
}
|
}
|
||||||
ok, err := 民政局.compareCDtime(gid, uid, mode, cdTime)
|
ok, err := 民政局.compareCDtime(gid, uid, 4, cdTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("[qqwife]查询用户CD状态失败,请重试\n", err))
|
ctx.SendChain(message.Text("[qqwife]查询用户CD状态失败,请重试\n", err))
|
||||||
return false
|
return false
|
||||||
@ -686,11 +668,6 @@ func checkdivorce(ctx *zero.Ctx) bool {
|
|||||||
ctx.SendChain(message.Text("你的技能还在CD中..."))
|
ctx.SendChain(message.Text("你的技能还在CD中..."))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// 写入CD
|
|
||||||
err = 民政局.writeCDtime(gid, uid, mode)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.At(uid), message.Text("[qqwife]你的技能CD记录失败\n", err))
|
|
||||||
}
|
|
||||||
// 判断是否符合条件
|
// 判断是否符合条件
|
||||||
_, uidstatus, err := 民政局.查户口(gid, uid)
|
_, uidstatus, err := 民政局.查户口(gid, uid)
|
||||||
switch uidstatus {
|
switch uidstatus {
|
||||||
@ -706,7 +683,6 @@ func checkdivorce(ctx *zero.Ctx) bool {
|
|||||||
|
|
||||||
// 注入判断 是否满足做媒要求
|
// 注入判断 是否满足做媒要求
|
||||||
func checkCondition(ctx *zero.Ctx) bool {
|
func checkCondition(ctx *zero.Ctx) bool {
|
||||||
mode := int64(4) // 指代技能4
|
|
||||||
gid := ctx.Event.GroupID
|
gid := ctx.Event.GroupID
|
||||||
uid := ctx.Event.UserID
|
uid := ctx.Event.UserID
|
||||||
// 获取CD
|
// 获取CD
|
||||||
@ -714,7 +690,7 @@ func checkCondition(ctx *zero.Ctx) bool {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("[qqwife]获取该群技能CD错误(将以CD12H计算)\n", err))
|
ctx.SendChain(message.Text("[qqwife]获取该群技能CD错误(将以CD12H计算)\n", err))
|
||||||
}
|
}
|
||||||
ok, err := 民政局.compareCDtime(gid, uid, mode, cdTime)
|
ok, err := 民政局.compareCDtime(gid, uid, 3, cdTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("[qqwife]查询用户CD状态失败,请重试\n", err))
|
ctx.SendChain(message.Text("[qqwife]查询用户CD状态失败,请重试\n", err))
|
||||||
return false
|
return false
|
||||||
@ -723,11 +699,6 @@ func checkCondition(ctx *zero.Ctx) bool {
|
|||||||
ctx.SendChain(message.Text("你的技能还在CD中..."))
|
ctx.SendChain(message.Text("你的技能还在CD中..."))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// 写入CD
|
|
||||||
err = 民政局.writeCDtime(gid, uid, mode)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.At(uid), message.Text("[qqwife]你的技能CD记录失败\n", err))
|
|
||||||
}
|
|
||||||
// 得先判断用户是否存在才行在,再重置
|
// 得先判断用户是否存在才行在,再重置
|
||||||
gayOne, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
gayOne, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user