mirror of
https://github.com/fumiama/ReiBot.git
synced 2026-06-12 06:00:35 +08:00
add only private
This commit is contained in:
9
rules.go
9
rules.go
@@ -199,6 +199,15 @@ func CheckChat(chatId ...int64) Rule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OnlyPrivate requires that the ctx.Event is private message
|
||||||
|
func OnlyPrivate(ctx *Ctx) bool {
|
||||||
|
msg, ok := ctx.Value.(*tgba.Message)
|
||||||
|
if !ok || msg.Chat == nil { // 确保无空
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return msg.Chat.Type == "private"
|
||||||
|
}
|
||||||
|
|
||||||
// SuperUserPermission only triggered by the bot's owner
|
// SuperUserPermission only triggered by the bot's owner
|
||||||
func SuperUserPermission(ctx *Ctx) bool {
|
func SuperUserPermission(ctx *Ctx) bool {
|
||||||
msg, ok := ctx.Value.(*tgba.Message)
|
msg, ok := ctx.Value.(*tgba.Message)
|
||||||
|
|||||||
Reference in New Issue
Block a user