@@ -575,28 +575,12 @@ func init() {
575
575
ctx .SendChain (message .ImageBytes (data ))
576
576
cl ()
577
577
})
578
- engine .OnFullMatchGroup ([]string {"闹离婚" , "办离婚" }, zero .OnlyGroup , getdb ).SetBlock (true ).Limit (cdcheck , iscding2 ).
578
+ engine .OnFullMatchGroup ([]string {"闹离婚" , "办离婚" }, zero .OnlyGroup , getdb , checkfiancee ).SetBlock (true ).Limit (cdcheck , iscding2 ).
579
579
Handle (func (ctx * zero.Ctx ) {
580
580
gid := ctx .Event .GroupID
581
- updatetime , err := 民政局 .checkupdate (gid )
582
- switch {
583
- case err != nil :
584
- ctx .SendChain (message .Text ("数据库发生问题力,请联系bot管理员\n [error]" , err ))
585
- return
586
- case time .Now ().Format ("2006/01/02" ) != updatetime :
587
- if err := 民政局 .重置 (strconv .FormatInt (gid , 10 )); err != nil {
588
- ctx .SendChain (message .Text ("数据库发生问题力,请联系bot管理员\n [error]" , err ))
589
- return
590
- }
591
- ctx .SendChain (message .Text ("今天你还没有结婚哦" ))
592
- return
593
- }
594
- // 获取用户信息
595
581
uid := ctx .Event .UserID
596
582
info , uidstatus , err := 民政局 .查户口 (gid , uid )
597
583
switch uidstatus {
598
- case 3 :
599
- return
600
584
case 2 :
601
585
ctx .SendChain (message .Text ("数据库发生问题力,请联系bot管理员\n [error]" , err ))
602
586
return
@@ -779,6 +763,36 @@ func checkcp(ctx *zero.Ctx) bool {
779
763
}
780
764
return true
781
765
}
766
+
767
+ func checkfiancee (ctx * zero.Ctx ) bool {
768
+ gid := ctx .Event .GroupID
769
+ updatetime , err := 民政局 .checkupdate (gid )
770
+ switch {
771
+ case err != nil :
772
+ ctx .SendChain (message .Text ("数据库发生问题力,请联系bot管理员\n [error]" , err ))
773
+ return false
774
+ case time .Now ().Format ("2006/01/02" ) != updatetime :
775
+ if err := 民政局 .重置 (strconv .FormatInt (gid , 10 )); err != nil {
776
+ ctx .SendChain (message .Text ("数据库发生问题力,请联系bot管理员\n [error]" , err ))
777
+ return false
778
+ }
779
+ ctx .SendChain (message .Text ("今天你还没有结婚哦" ))
780
+ return false
781
+ }
782
+ // 获取用户信息
783
+ uid := ctx .Event .UserID
784
+ _ , uidstatus , err := 民政局 .查户口 (gid , uid )
785
+ switch uidstatus {
786
+ case 2 :
787
+ ctx .SendChain (message .Text ("数据库发生问题力,请联系bot管理员\n [error]" , err ))
788
+ return false
789
+ case 3 : // 如果是单身
790
+ ctx .SendChain (message .Text ("今天你还没有结婚哦" ))
791
+ return false
792
+ }
793
+ return true
794
+ }
795
+
782
796
func iscding2 (ctx * zero.Ctx ) {
783
- ctx .SendChain (message .Text ("打灭,禁止离婚" ))
797
+ ctx .SendChain (message .Text ("打灭,禁止离婚 (你的技能正在CD中) " ))
784
798
}
0 commit comments