Spaces:
Running
Running
Test
Browse files- discord_bot.py +6 -3
discord_bot.py
CHANGED
@@ -150,10 +150,13 @@ for command in json_data["command"]:
|
|
150 |
|
151 |
|
152 |
class MyClient(discord.Client):
|
153 |
-
def __init__(self,
|
154 |
-
#
|
155 |
intents = kwargs.pop('intents', discord.Intents.default())
|
156 |
-
|
|
|
|
|
|
|
157 |
self.tree = app_commands.CommandTree(self)
|
158 |
|
159 |
async def setup_hook(self):
|
|
|
150 |
|
151 |
|
152 |
class MyClient(discord.Client):
|
153 |
+
def __init__(self, **kwargs):
|
154 |
+
# 从 kwargs 中获取 intents,或者使用默认 intents
|
155 |
intents = kwargs.pop('intents', discord.Intents.default())
|
156 |
+
|
157 |
+
# 调用 discord.Client 的 __init__,并将 intents 作为关键字参数传递
|
158 |
+
super().__init__(intents=intents, **kwargs)
|
159 |
+
|
160 |
self.tree = app_commands.CommandTree(self)
|
161 |
|
162 |
async def setup_hook(self):
|