I want to charge the ephemeral when my bot can confirm the message is not error.
How to do it?Or Can I do it?
be like that
@client.tree.command(name= abc , description= acb )
@app_commands.describe(...)
async def abc(ctx: discord.Interaction, ...)
await ctx.response.defer(ephemeral = True)
if error:
await ctx.followup.send("error", ephemeral = True)
return
else:
await ctx.followup.send("What I want to send", ephemeral = False, silent = True)
它保留<条码>phe=真实条码>。
edit_1
I attempted to send a regular message when there is no error, without using followup.send
.
This was not my expected solution, but at least it works.
However, I still believe that the best approach is to change the ephemeral state after the correct message is sent.
我的法典
@client.tree.command(name= abc , description= acb )
@app_commands.describe(...)
async def abc(ctx: discord.Interaction, ...)
sendmsg = True
await ctx.response.defer(ephemeral = True)
...skip some code...
sendmsg = False
...skip some code...
if error:
await ctx.followup.send("error")
return
if sendmsg:
await ctx.followup.send("is ok")
await ctx.channel.send("What I want to send")