1
0
mirror of https://github.com/fumiama/NanoBot.git synced 2026-06-24 05:18:14 +08:00

fix: OnlyChannel & Intent

This commit is contained in:
源文雨
2023-10-19 13:51:03 +09:00
parent da5cad685a
commit 0f41190752
2 changed files with 9 additions and 3 deletions

View File

@@ -15,10 +15,16 @@ const (
IntentAudioAction = 1 << 29 IntentAudioAction = 1 << 29
IntentPublicGuildMessages = 1 << 30 IntentPublicGuildMessages = 1 << 30
// IntentAll 监听全部事件
IntentAll = IntentGuilds | IntentGuildMembers | IntentGuildMessages | IntentGuildMessageReactions | IntentAll = IntentGuilds | IntentGuildMembers | IntentGuildMessages | IntentGuildMessageReactions |
IntentDirectMessage | IntentOpenForumsEvent | IntentAudioOrLiveChannelMember | IntentInteraction | IntentDirectMessage | IntentOpenForumsEvent | IntentAudioOrLiveChannelMember | IntentInteraction |
IntentMessageAudit | IntentForumsEvent | IntentAudioAction | IntentPublicGuildMessages IntentMessageAudit | IntentForumsEvent | IntentAudioAction | IntentPublicGuildMessages
// IntentPublic 监听公域事件
IntentPublic = IntentGuilds | IntentGuildMembers | IntentGuildMessageReactions | IntentPublic = IntentGuilds | IntentGuildMembers | IntentGuildMessageReactions |
IntentDirectMessage | IntentOpenForumsEvent | IntentAudioOrLiveChannelMember | IntentInteraction | IntentDirectMessage | IntentOpenForumsEvent | IntentAudioOrLiveChannelMember | IntentInteraction |
IntentMessageAudit | IntentAudioAction | IntentPublicGuildMessages IntentMessageAudit | IntentAudioAction | IntentPublicGuildMessages
// IntentPrivate 监听私域事件
IntentPrivate = IntentGuilds | IntentGuildMembers | IntentGuildMessages | IntentGuildMessageReactions |
IntentDirectMessage | IntentAudioOrLiveChannelMember | IntentInteraction |
IntentMessageAudit | IntentForumsEvent | IntentAudioAction
) )

View File

@@ -298,9 +298,9 @@ func OnlyDirect(ctx *Ctx) bool {
return false return false
} }
// OnlyChannel requires that the ctx.Event is channel message // OnlyChannel is !OnlyDirect
func OnlyChannel(ctx *Ctx) bool { func OnlyChannel(ctx *Ctx) bool {
return !OnlyPrivate(ctx) return !OnlyDirect(ctx)
} }
// OnlyPublic requires that the ctx.Event is public message // OnlyPublic requires that the ctx.Event is public message
@@ -314,7 +314,7 @@ func OnlyPublic(ctx *Ctx) bool {
return false return false
} }
// OnlyPrivate requires that the ctx.Event is not public message // OnlyPrivate is !OnlyPublic
func OnlyPrivate(ctx *Ctx) bool { func OnlyPrivate(ctx *Ctx) bool {
return !OnlyPublic(ctx) return !OnlyPublic(ctx)
} }