From a3ecb52ee7da82aee49ca04ca5fb0b1d8b035e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:30:43 +0900 Subject: [PATCH] fix: rules --- rules.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/rules.go b/rules.go index 8808882..7616f3e 100644 --- a/rules.go +++ b/rules.go @@ -287,11 +287,8 @@ func CheckGuild(guildID ...string) Rule { } } -// OnlyDirect requires that the ctx.Event is direct message +// OnlyDirect requires that the ctx.Type is direct message func OnlyDirect(ctx *Ctx) bool { - if ctx.Message != nil { - return ctx.Message.SrcGuildID != "" - } if ctx.Type != "" { return strings.HasPrefix(ctx.Type, "Direct") } @@ -303,11 +300,8 @@ func OnlyChannel(ctx *Ctx) bool { return !OnlyDirect(ctx) } -// OnlyPublic requires that the ctx.Event is public message +// OnlyPublic requires that the ctx.Type is at/public message func OnlyPublic(ctx *Ctx) bool { - if ctx.Message != nil && ctx.Message.SrcGuildID != "" { - return false - } if ctx.Type != "" { return strings.HasPrefix(ctx.Type, "At") || strings.HasPrefix(ctx.Type, "Public") }