This commit is contained in:
nothamor 2024-05-29 09:59:12 +08:00
parent 402d20109c
commit c91e2b8ac0
2 changed files with 25 additions and 0 deletions

22
plugin/chips/insurance.go Normal file
View File

@ -0,0 +1,22 @@
package chips
import (
redisrepo "amor/repository/redisRepo"
"strings"
"github.com/spf13/cast"
zero "github.com/wdvxdr1123/ZeroBot"
)
func Insurance(ctx *zero.Ctx) {
msg := strings.Split(ctx.Event.Message.String(), " ")
if len(msg) != 2 {
ctx.Send("命令格式错误")
return
}
userID := ctx.Event.UserID
chips := cast.ToInt64(msg[1])
redisrepo.AddUserBalance(userID, chips)
ctx.Send("索赔成功")
}

View File

@ -20,6 +20,9 @@ func Router() {
// 群内筹码排名
zero.OnFullMatch("rank").Handle(chips.Rank)
// 赔钱
zero.OnCommand("我不玩了还我钱").Handle(chips.Insurance)
// 帮助
zero.OnFullMatch("help").Handle(plugin.Help)