Skip to content

Commit 2eae3cb

Browse files
author
veehou
committed
fix: 修复intents的默认和all的方法
1 parent 4a2373f commit 2eae3cb

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

botpy/flags.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class Intents(BaseFlags):
115115
forums 论坛事件 (仅 私域 机器人能够设置此 intents)
116116
audio_action 音频事件
117117
"""
118+
118119
__slots__ = ()
119120

120121
def __init__(self, **kwargs: bool) -> None:
@@ -128,9 +129,17 @@ def __init__(self, **kwargs: bool) -> None:
128129
@classmethod
129130
def all(cls):
130131
"""打开所有事件的监听"""
131-
value = max(cls.VALID_FLAGS.values()) * 2 - 1
132-
self = cls.__new__(cls)
133-
self.value = value
132+
self = cls.none()
133+
self.guild_messages = True
134+
self.forums = True
135+
self.interaction = True
136+
self.audio_action = True
137+
self.guilds = True
138+
self.guild_members = True
139+
self.guild_message_reactions = True
140+
self.direct_message = True
141+
self.message_audit = True
142+
self.public_guild_messages = True
134143
return self
135144

136145
@classmethod

0 commit comments

Comments
 (0)