Skip to content

Message not ephemeral in function generators #7

Description

@solaris7x

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:

function beepGen(): CommandHandler<Env> {
  useDescription("Send a boop");
  return async function* (interaction, env, ctx) {
   // Remove yield below and message will be ephemeral as expected
    yield;
    return <Message ephemeral>🤖 Boop from slshx 🤖</Message>;
  };
}

Expected:

Message response for above function to be ephemeral and only visible to invoker of discord command

Related

discordjs/discord.js#5702

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions