mirror of
https://github.com/fumiama/NanoBot.git
synced 2026-06-27 07:30:26 +08:00
fix: OnlyChannel & Intent
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
6
rules.go
6
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user