With discord.py, how can I make a slash command only visible to me? example:
在我的互联网搜索中,我找到的唯一一件事就是如何发出斜杠命令.有人知道怎么做吗?
With discord.py, how can I make a slash command only visible to me? example:
在我的互联网搜索中,我找到的唯一一件事就是如何发出斜杠命令.有人知道怎么做吗?
@bot.tree.command(name="something")
async def something(interaction:discord.Interaction):
await interaction.response.send_message("NOTHING",ephemeral=True)
# optional (if you want to edit the response later,delete it, or send a followup)
await interaction.edit_original_response(content="Something")
await interaction.followup.send("This is a message too.",ephemeral=True)
await interaction.delete_original_response()
# if you have deleted the original response you can't edit it or send a followup after it
这些都是最基本的.如果您不知道如何加载命令:
@bot.event
async def on_ready():
print("Bot is online!")
try:
synced = await bot.tree.sync()
print(f"Synced {len(synced)} commands.")
except Exception as e:
print(e)
都准备好了!祝你在编码方面好运.如果您需要进一步的帮助,我的不一致是@rexy.py