Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): various fixes for overlooked stuff #9588

Merged
merged 7 commits into from
May 22, 2023
Merged

fix(api): various fixes for overlooked stuff #9588

merged 7 commits into from
May 22, 2023

Conversation

D4isDAVID
Copy link
Contributor

@D4isDAVID D4isDAVID commented May 19, 2023

Please describe the changes this PR makes and why it should be merged:

This PR mainly contains corrections for incorrect typings that were overlooked.

In addition this also makes InteractionsAPI#followUp() return a result which should always be Promise<APIMessage> on success (according to the Discord docs on the creation of followup messages: "Functions the same as Execute Webhook, but wait is always true.")

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

@vercel
Copy link

vercel bot commented May 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) May 20, 2023 10:14pm
discord-js-guide ⬜️ Ignored (Inspect) May 20, 2023 10:14pm

D4isDAVID added 3 commits May 19, 2023 22:53
According to the Discord docs, creating a followup message is the same as executing a webhook, but *wait is always true*, meaning we always get the message.
@D4isDAVID D4isDAVID changed the title types(api): various fixes fix(api): various fixes for overlooked stuff May 19, 2023
@D4isDAVID D4isDAVID marked this pull request as ready for review May 19, 2023 23:27
@D4isDAVID D4isDAVID requested a review from a team as a code owner May 19, 2023 23:27
@suneettipirneni
Copy link
Member

In addition this also makes InteractionsAPI#followUp() return a result which should always be Promise on success

Can you test if this is the case? If I recall correctly, followUp didn't return anything.

@D4isDAVID
Copy link
Contributor Author

In addition this also makes InteractionsAPI#followUp() return a result which should always be Promise on success

Can you test if this is the case? If I recall correctly, followUp didn't return anything.

The following code leaves me with a message variable which is an APIMessage object (tried with chat input command, button, string select menu, and modal):

client.on(GatewayDispatchEvents.InteractionCreate, async ({ api, data: interaction }) => {
    await api.interactions.reply(interaction.id, interaction.token, {
        content: 'reply',
    });
    const message = await api.interactions.followUp(interaction.application_id, interaction.token, {
        content: 'followup',
    });
    console.log(message);
});

console.log result:
Screenshot 2023-05-20 at 2 27 59

Other than this test the Discord docs say that wait is always true here meaning that the message should be returned, and also discord.js v14 docs say Promise<Message> too

@suneettipirneni
Copy link
Member

suneettipirneni commented May 20, 2023

In addition this also makes InteractionsAPI#followUp() return a result which should always be Promise on success

Can you test if this is the case? If I recall correctly, followUp didn't return anything.

The following code leaves me with a message variable which is an APIMessage object (tried with chat input command, button, string select menu, and modal):

client.on(GatewayDispatchEvents.InteractionCreate, async ({ api, data: interaction }) => {
    await api.interactions.reply(interaction.id, interaction.token, {
        content: 'reply',
    });
    const message = await api.interactions.followUp(interaction.application_id, interaction.token, {
        content: 'followup',
    });
    console.log(message);
});

console.log result: Screenshot 2023-05-20 at 2 27 59

Other than this test the Discord docs say that wait is always true here meaning that the message should be returned, and also discord.js v14 docs say Promise<Message> too

Apologies, I got this endpoint mixed up the the reply endpoint.

@kodiakhq kodiakhq bot merged commit 6c7a5ed into discordjs:main May 22, 2023
@D4isDAVID D4isDAVID deleted the core-api-fixes branch May 22, 2023 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants