discord / discord-api-docs

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

Allow webhooks to use reply messages #2251

Closed davfsa closed 3 years ago

davfsa commented 3 years ago

A webhook is attached to a specific channel. Surely the channel association alone would be enough to say "this webhook can reply to messages in this channel"? If that's not enough, what about the (bot) user that created the webhook?

In our particular use case, we use a bot user for reading messages, but a webhook for sending messages. So we would always be able to get message IDs of non-webhook-sent messages. It's just that the webhook specifically allows for added flexibility in setting the username/avatar.

Note that WebhookExecute returns the message ID that was created (if you provide ?wait=1), so a webhook on its own (without a bot user) is always able to get some message ID to reply to.

And similarly webhooks have these other endpoints that allow a webhook to modify messages that it sent:

So, at the very least, the functionality to reply to a webhook's own messages seems reasonable to me. Although, it would be ideal if a webhook could reply to any messages in its channel. I would be extremely thankful if you could consider this.

Originally posted by @qaisjp in https://github.com/discord/discord-api-docs/issues/2118#issuecomment-728042534

muddyfish commented 3 years ago

Not being able to receive the message reference through ?wait=1 or through editing would be completely fine for my use case, and could potentially clear some security issues on your side. An alternate could be providing some proof that you know the message content regardless so no information is leaked.

For what it's worth, I've already had 5 users of my bot ask why this isn't already a thing

EvyBongers commented 3 years ago

Any news if/when this might be implemented?

sairam4123 commented 3 years ago

Would it be possible for a webhook to reply to it's own messages?

qaisjp commented 3 years ago

https://github.com/discord/discord-api-docs/issues/2410#issuecomment-816330225 is pretty awesome!

The slash command interactions support fetching a previously created message:

/webhooks/<webhook_id>/<webhook_token>/messages/@original
/webhooks/<webhook_id>/<webhook_token>/messages/<message_id>

And slash command message posting is based on webhook infrastructure.

I'm hoping that the implementation of these endpoints has paved the road for potential future support of Webhook Replies.

sairam4123 commented 3 years ago

That's good to hear! I am still here waiting for the replies system! And I got a little question, can you change the discriminator number of the webhooks, I'd be happy to see it, because I am making a global chat system, and if the user had same same and avatar, it'd become confusing, so I hope it's possible to create something like that sometime in the future.

Edit: Let me know if it's possible to get all the messages a webhook sent? Thank you.

qaisjp commented 3 years ago

if the user had same same and avatar, it'd become confusing

FYI, you can use something like an avatar generator, and salt the username with the source platform.

In practice I've never seen two different people with the same name and avatar, so I wouldn't bother accounting for situations where they have the same avatar.

E.g.

cherryblossom000 commented 3 years ago

This would be really useful for bots that bridge other communication services to Discord. For example, the Matrix appservice for Discord uses webhooks to simulate users sending messages from Matrix. It would be great if a Matrix user could use the reply feature in Matrix and it would be properly represented in Discord (see https://github.com/Half-Shot/matrix-appservice-discord/issues/693).

JDJGInc commented 3 years ago

People have made bridges already, and also for revolt.chat but yeah.