You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Messages are not set as ephemeral when deferring response using yield in function generators
Info:
I need to perform an async request thus I use function generator to defer the discord response until my network operations are complete , To do so I used function generators to yield discord then return proper response after the network operation.
Using yield causes discord message to NOT be ephemeral and thus visible to everyone . I tried both <Message> and returning Object with content + flags: 64
Demo command handler:
functionbeepGen(): CommandHandler<Env>{useDescription("Send a boop");returnasyncfunction*(interaction,env,ctx){// Remove yield below and message will be ephemeral as expectedyield;return<Messageephemeral>🤖Boopfromslshx🤖</Message>;};}
Expected:
Message response for above function to be ephemeral and only visible to invoker of discord command
Hey! 👋 Thanks for reporting this. From that related issue it looks like this is an API limitation. I wonder if it's possible to return flags here though:
functionbeepGen(): CommandHandler<Env>{useDescription("Send a boop");returnasyncfunction*(interaction,env,ctx){// Remove yield below and message will be ephemeral as expectedyield$ephemeral;return<Messageephemeral>🤖 Boop from slshx 🤖</Message>;};}
As far as I understand from the referred issue , the ephemeral state cannot be changed by the follow up message but only the content , thus to make a message ephemeral , the 1st instance of it should be passed flag ephemeral
I think this could be done by passing the flags to data property of APIInteractionResponseDeferredChannelMessageWithSource
TL;DR :
Messages are not set as ephemeral when deferring response using yield in function generators
Info:
I need to perform an async request thus I use function generator to defer the discord response until my network operations are complete , To do so I used function generators to yield discord then return proper response after the network operation.
Using
yield
causes discord message to NOT be ephemeral and thus visible to everyone . I tried both<Message>
and returning Object with content +flags: 64
Demo command handler:
Expected:
Message response for above function to be ephemeral and only visible to invoker of discord command
Related
discordjs/discord.js#5702
The text was updated successfully, but these errors were encountered: