discord / discord-api-docs

Official Discord API Documentation
https://discord.com/developers/docs/intro
Other
5.97k stars 1.27k forks source link

Interaction follow-ups aren't using bot permissions #5279

Closed FabienBounoir closed 1 year ago

FabienBounoir commented 2 years ago

Description

Permission calculation for webhook and interaction responses is available, but when updating an interaction, it hasn't been updated, there is still the old permission calculation system

Steps to Reproduce

create an interaction with a component that update during the update you will see that the emotes are not displayed anymore because everyone has no permission to send external emotes yet the bot can

Expected Behavior

have the same behavior as when I send an interaction

Current Behavior

there is not the same calculation system between an interaction and when updating the interaction

Screenshots/Videos

Before Update: image

After Interaction Update: image image

Client and System Information

"discord.js": "^14.0.1",

Canary 138282 (cf09f46) Host 0.0.285 OS X 10.15.7 (21.4.0)

ilxlodev commented 2 years ago

I have the same issue

Azeriius commented 2 years ago

Same issue

Stefouch commented 2 years ago

+1 This should be considered critical

I have the same issue and it's just killing my dice roller bot (see mentioned issue above) that now we are forced to use Slash commands (it was not a problem with prefixed commands and editing message contents).

MattTheCuber commented 2 years ago

+1 This should be considered critical

I have the same issue and it's just killing my dice roller bot (see mentioned issue above) that now we are forced to use Slash commands (it was not a problem with prefixed commands and editing message contents).

I agree, I have this issue many places in my bot. I have also seen it in large bots such as dyno and giveaway bot recently.

FabienBounoir commented 2 years ago

+1 This should be considered critical

I have the same issue and it's just killing my dice roller bot (see mentioned issue above) that now we are forced to use Slash commands (it was not a problem with prefixed commands and editing message contents).

you can send your message with interaction.channel.send this action send your message like "normal message" and you can get message for update after

Stefouch commented 2 years ago

+1 This should be considered critical I have the same issue and it's just killing my dice roller bot (see mentioned issue above) that now we are forced to use Slash commands (it was not a problem with prefixed commands and editing message contents).

you can send your message with interaction.channel.send this action send your message like "normal message" and you can get message for update after

In my situation, I would like to edit the original message. I can delete the original and send a new one.. but it can be confusing for the players, and it does not seem to work with ephemeral messages.

appellation commented 2 years ago

This is fixed and should be going out with the next API deploy.

ErwanGit commented 2 years ago

Hello ! đź‘‹ (@appellation)

I just tested using the Edit Original Interaction Response route and it still doesn't work properly at the moment. It's still relying on the @everyone role when it should be relying on the bot permissions. I don't have any problem when I try to edit a followup message.

Let me bring up the problem because I think there has been an update of the API since last week. Thank you !

appellation commented 2 years ago

It seems like this fix didn't resolve all of the scenarios in which this issue was occurring :( Currently looking into a complete resolution.

Walledgarden commented 2 years ago

Any news on when a fix is for this is gonna be implemented?

FabienBounoir commented 2 years ago

I don't know but it is really urgent

AlmostSuspense commented 2 years ago

can this be reopened since the bug hasn't been fixed?

Colton1070 commented 2 years ago

REOPEN

ilxlodev commented 2 years ago

Any update on this?

msetten commented 1 year ago

My bot is also experiencing this issue.

joeyk710 commented 1 year ago

I also seem to experience this issue with my bot. Ephemeral interaction replies don't show emojis that the bot does not have access to, but does show custom emojis in the current server. Using a select menu with using the emoji option does show all custom emojis regardless if the bot has access to it or not.

It's quite confusing on how interaction replies and follow-ups don't show this and yet, select menu components do. These are both interactions so shouldn't this be following the same functions for how emojis are shown?

Giving the bot External Emoji perms does not work so this is frustrating.

I use discord.js v14.6.0. Unsure if this has to do with discord itself or discord.js

Even though example pictures were posted in the original issue, these pictures are showing how the emojis work in a select menu and not in the reply.

image image
AlmostSuspense commented 1 year ago

I also seem to experience this issue with my bot. Ephemeral interaction replies don't show emojis that the bot does not have access to, but does show custom emojis in the current server. Using a select menu with using the emoji option does show all custom emojis regardless if the bot has access to it or not.

It's quite confusing on how interaction replies and follow-ups don't show this and yet, select menu components do. These are both interactions so shouldn't this be following the same functions for ...

i think the reasoning is that interaction replies are webhooks (which are supposed to inherit the bot's perms now) while select menus are just general ui elements

ilxlodev commented 1 year ago

Should we open a new issue?

msetten commented 1 year ago

Here are also two examples of how weird this is:

8DA0988B-B7F1-44A8-A14A-F9664B54F9FC The one above is without @everyone having the rights to use external emoji

D35251C5-292E-437D-8F55-356F3E0BBFF2 This one when @everyone has the right to use external emoji

The most weird thing about it (especially from the point of view of bot users) is that the buttons do show the icons, while the message doesn't (the two at the top are generic emojis). The message is created using the interaction.followup command and edited with the interaction.update command when using the buttons. I also did notice that were I to do a message.edit command on the message itself, the emojis would show up. But having actually retrieve the message with every interaction and then editing it is not very straightforward as the message id has to be saved and retrieved from the database object behind the post, then the message has to be retrieved and then edited. And that wouldn't fix the first time the post is created using the interaction.followup (or interaction.reply) statements.

ErwanGit commented 1 year ago

Hello, I would like to bring up this issue that dates back several months ago and is still not fixed to this day.

I am a developer of a multipurpose bot that has more than 350k+ guilds and we have game commands such as power 4 or tic-tac-toe where we use external emojis from emoji servers that we own and use to enhance the presentation of our messages.

If a server that uses our game controls and has not allowed the @everyone role to use external emojis, it really ruins the game experience. Here is an example with the power 4 without this permission on the @everyone role.

image

Some servers, especially servers with a certain number of members, make the choice not to allow all their members to send external emojis to avoid some outbursts, which is pretty normal. However, we cannot currently provide the experience we want to provide to our users without compromising their server moderation with incorrect emojis.

We also have some specific utility commands as well as some generic confirmation messages to our bot that are impacted by this issue.

I know the problem can be worked around right now by editing the message instead of interacting, but it impacts our performance, as we have to send any message and then edit it with the correct content. Not to mention the fact that these requests, which are no longer interaction requests, are not immune to a global ratelimit.

I really hope we finally get a response from Discord for this problem and that it is fixed soon. This issue has been around for several months now and this bug is problematic for bots like ours that use external emojis to enhance the user experience.

ManHatos commented 1 year ago

It’s been 5 months and this annoying bug is still not fixed. Please, just tell us anything already.

learnedtim commented 1 year ago

Happening to me aswell.

AlexFlipnote commented 1 year ago

Can confirm that this is still present, for me it is whenever you defer a message, making it send "Bot is thinking", then proceed with a followup that has a custom emoji in it. Made sure bot has access to the emoji, it works without the defer and no followup.

Pretty much noticed this right after I rewrote my entire bot to use interactions instead of message commands :(

JDJGInc commented 1 year ago

Why can user made webhooks allow any emoji to be sent but not bot owned webhooks?

Note, that user webhooks and the bot owned webhooks both have external emoji permissions

Smidul commented 1 year ago

Why can user made webhooks allow any emoji to be sent but not bot owned webhooks?

Note, that user webhooks and the bot owned webhooks both have external emoji permissions

Bot owned webhooks can only use emojis the bot itself has access to User owned ones doesn't have this restriction

ooliver1 commented 1 year ago

You just responded with what they just said. They were asking why that restriction exists.

AlmostSuspense commented 1 year ago

it's a side effect of bot webhooks using the bot's permissions. if the bot can't access the emoji then its webhooks can't either because they share the same permissions

iirc they originally said the change wouldn't impact emojis, then it did and they refused to change it

JDJGInc commented 1 year ago

it's a side effect of bot webhooks using the bot's permissions. if the bot can't access the emoji then its webhooks can't either because they share the same permissions

iirc they originally said the change wouldn't impact emojis, then it did and they refused to change it

it would be nice if discord commented on this.

Colton1070 commented 1 year ago

No, it isn’t. It’s a side effect of bot webhooks using @everyone permissions. Obviously if the bot had permissions as many in this thread have pointed out theirs do, they wouldn’t be reporting it as an issue. They are. I am. Bot webhooks need to use the bots calculated permissions. Fix it by next year please.

On Sun, Feb 19, 2023 at 05:15 Suspense @.***> wrote:

it's a side effect of bot webhooks using the bot's permissions. if the bot can't access the emoji then its webhooks can't either because they share the same permissions

iirc they originally said the change wouldn't impact emojis, then it did and they refused to change it

— Reply to this email directly, view it on GitHub https://github.com/discord/discord-api-docs/issues/5279#issuecomment-1435960322, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGKKCZJ3OSSL7YPPQ2ED4DWYH6FTANCNFSM55TNWLEQ . You are receiving this because you commented.Message ID: @.***>

Sayrix commented 1 year ago

bump

Beaend commented 1 year ago

7.5 months... When that 'iirc' fix it?..

Stefouch commented 1 year ago

Please Discord, fix this issue. It's killing many bots.

ErlandssonA commented 1 year ago

We really need a fix for this!

FabienBounoir commented 1 year ago

I reported this problem 8 months ago, and it still hasn't moved

ErlandssonA commented 1 year ago

I postponed this issue 8 months ago

Postponed meaning what? It should and needs to be fixed!

wlinator commented 1 year ago

bump.

Stefouch commented 1 year ago

Issue NOT Fixed! Please REOPEN! Related: https://github.com/discord/discord-api-docs/issues/5524

Edit: Oh! It's open. Why is it not fixed yet then?? It has been almost one year!

kieranedwards commented 1 year ago

Still struggling with this and really would love a resolution, please.

ogaudemar commented 1 year ago

Any update on this issue? We're experiencing the same issue with our bot.

JDJGInc commented 1 year ago

Bot owned webhooks have issues with this too

Pixeled99 commented 1 year ago

This is still an issue!

ltzmax commented 1 year ago

This issue still appear to happen.

Metritutus commented 1 year ago

Based on information from above, I'm putting this for readability as it took me quite a while to stumble upon this issue (and #5524) to find out why external emojis weren't showing up for the bot I was working on. The workaround, as opposed to granting @everyone the External Emojis permission, is to have the bot edit the message immediately after sending it.

Here's a quick example using DSharpPlus, but I'd imagine the process would be pretty similar for other libraries:

string messageContent = "<:youremojihere:0>";

DiscordMessage message
    = await interactionContext.FollowUpAsync(new DiscordFollowupMessageBuilder().WithContent(messageContent));

await message.ModifyAsync(messageContent);

It's important to note here that you can't use the DiscordMessage instance's Content value for the edit once you've sent the original message, eg message.Content, as the emoji will just be plain text at that point, so you'll want to have stored your message content in a variable beforehand so that you can use it again for the edit.

Posted in #5279 and #5524 for visibility.

I realise that this issue is about the Discord API, rather than bot libraries, but I'm hoping that this information is still of use.

EDIT: Unfortunately, as has been pointed out, this is only a partial workaround as it won't work for ephemeral messages, as they can't be edited via the standard edit message endpoint (in the above example, ModifyAsync()), only the edit response endpoints (in the above example, this would be done by EditFollowupAsync()), which are the ones with the issue. :(

Larsundso commented 1 year ago

bump workaround above works but uses 1 extra API call additionally it doesnt work on ephemeral replies

NotDemonix commented 1 year ago

Still an issue ❤️ wonder when will they finally fix this..

EzXabi commented 1 year ago

Hope that this gets resolved...

JDJGInc commented 1 year ago

What's the progress of this being fixed?

NotDemonix commented 1 year ago

What's the progress of this being fixed?

0, issue since 2022

maxgb-dev commented 1 year ago

I'm struggling to understanding why this issue is still open... it's a bad question for Discord's highly polished aesthetic. Users see strange :words: instead of emoji that define an high aesthetic level of the bots. Not only does the developer of the BOT make a bad impression, but Discord itself that loose this aesthetic care. Please up priority to this!

NotDemonix commented 1 year ago

I solved it by just straight up renaming emojis to like white_check_mark so when the everyone perm can't use external emojis, it shows discord default emoji with that name, why? I don't know