Spaces:
Running
Running
Test
Browse files- discord_bot.py +12 -0
discord_bot.py
CHANGED
@@ -148,7 +148,18 @@ for command in json_data["command"]:
|
|
148 |
bot.tree.add_command(tree_command)
|
149 |
"""
|
150 |
|
|
|
|
|
|
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
class MyClient(discord.Client):
|
153 |
def __init__(self, **kwargs):
|
154 |
# 从 kwargs 中获取 intents,或者使用默认 intents
|
@@ -171,6 +182,7 @@ class MyClient(discord.Client):
|
|
171 |
print(y)
|
172 |
await interaction.response.send_message(f"x: {x}, y: {y}")
|
173 |
MyClient(bot)
|
|
|
174 |
|
175 |
|
176 |
|
|
|
148 |
bot.tree.add_command(tree_command)
|
149 |
"""
|
150 |
|
151 |
+
async def dynamic_command(interaction: discord.Interaction, **kwargs):
|
152 |
+
print(kwargs)
|
153 |
+
await interaction.followup.send("This is a test message, it send from dynamic_command.")
|
154 |
|
155 |
+
tree_command = app_commands.Command(
|
156 |
+
name="test",
|
157 |
+
description="test",
|
158 |
+
callback=dynamic_command
|
159 |
+
)
|
160 |
+
bot.tree.add_command(tree_command)
|
161 |
+
|
162 |
+
"""
|
163 |
class MyClient(discord.Client):
|
164 |
def __init__(self, **kwargs):
|
165 |
# 从 kwargs 中获取 intents,或者使用默认 intents
|
|
|
182 |
print(y)
|
183 |
await interaction.response.send_message(f"x: {x}, y: {y}")
|
184 |
MyClient(bot)
|
185 |
+
"""
|
186 |
|
187 |
|
188 |
|