From 0f4119075298483eb9489d0e61e6f448a5960038 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 13:51:03 +0900 Subject: [PATCH] fix: OnlyChannel & Intent --- intent.go | 6 ++++++ rules.go | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/intent.go b/intent.go index 16bb02e..10f11be 100644 --- a/intent.go +++ b/intent.go @@ -15,10 +15,16 @@ const ( IntentAudioAction = 1 << 29 IntentPublicGuildMessages = 1 << 30 + // IntentAll 监听全部事件 IntentAll = IntentGuilds | IntentGuildMembers | IntentGuildMessages | IntentGuildMessageReactions | IntentDirectMessage | IntentOpenForumsEvent | IntentAudioOrLiveChannelMember | IntentInteraction | IntentMessageAudit | IntentForumsEvent | IntentAudioAction | IntentPublicGuildMessages + // IntentPublic 监听公域事件 IntentPublic = IntentGuilds | IntentGuildMembers | IntentGuildMessageReactions | IntentDirectMessage | IntentOpenForumsEvent | IntentAudioOrLiveChannelMember | IntentInteraction | IntentMessageAudit | IntentAudioAction | IntentPublicGuildMessages + // IntentPrivate 监听私域事件 + IntentPrivate = IntentGuilds | IntentGuildMembers | IntentGuildMessages | IntentGuildMessageReactions | + IntentDirectMessage | IntentAudioOrLiveChannelMember | IntentInteraction | + IntentMessageAudit | IntentForumsEvent | IntentAudioAction ) diff --git a/rules.go b/rules.go index d28f67a..8808882 100644 --- a/rules.go +++ b/rules.go @@ -298,9 +298,9 @@ func OnlyDirect(ctx *Ctx) bool { return false } -// OnlyChannel requires that the ctx.Event is channel message +// OnlyChannel is !OnlyDirect func OnlyChannel(ctx *Ctx) bool { - return !OnlyPrivate(ctx) + return !OnlyDirect(ctx) } // OnlyPublic requires that the ctx.Event is public message @@ -314,7 +314,7 @@ func OnlyPublic(ctx *Ctx) bool { return false } -// OnlyPrivate requires that the ctx.Event is not public message +// OnlyPrivate is !OnlyPublic func OnlyPrivate(ctx *Ctx) bool { return !OnlyPublic(ctx) }