joytou commited on
Commit
308a9db
·
1 Parent(s): 4daff36
Files changed (1) hide show
  1. 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, *args, **kwargs):
154
- #super().__init__(*args, **kwargs)
155
  intents = kwargs.pop('intents', discord.Intents.default())
156
- super().__init__(intents=intents, *args, **kwargs)
 
 
 
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):