1
0
mirror of https://github.com/fumiama/ReiBot.git synced 2026-06-06 09:30:25 +08:00

add only private

This commit is contained in:
源文雨
2022-06-03 00:27:11 +08:00
parent 131fd9727c
commit e31ccdbd69

View File

@@ -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
func SuperUserPermission(ctx *Ctx) bool {
msg, ok := ctx.Value.(*tgba.Message)