mirror of
https://github.com/awfufu/go-hurobot.git
synced 2026-03-01 13:39:42 +08:00
fix:Prevent someone from abusing this feature
This commit is contained in:
@@ -3,10 +3,19 @@ package cmds
|
||||
import (
|
||||
"go-hurobot/qbot"
|
||||
"log"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func cmd_delete(c *qbot.Client, msg *qbot.Message, args *ArgsList) {
|
||||
// 禁止某个无锡人滥用删除功能,只有0.6%概率允许
|
||||
if msg.UserID == 3112813730 {
|
||||
if rand.Float64() > 0.006 {
|
||||
c.SendMsg(msg, "无锡人本次运气不佳,删除失败!建议明天再试,或者考虑搬家")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if msg.Array[0].Type == qbot.Reply {
|
||||
if msgid, err := strconv.ParseUint(msg.Array[0].Content, 10, 64); err == nil {
|
||||
c.DeleteMsg(msgid)
|
||||
|
||||
Reference in New Issue
Block a user