-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(MessageReaction): add react method #7810
Conversation
I mean no, you know the emoji since you have the message reaction class :P (+ you don't neeeed the emoji cached to add reactions) |
Exactly, I said make it easier not make it possible :) |
I don't quite understand this. It's a shortcut for the bot to react with the same emoji a user did? ...I guess it's fine? |
Yep that’s pretty much it |
I don't understand why this method needs to be a part of discord.js. Making a utility method for this would be trivial: const rereact = async (msg: Message, reaction: MessageReaction) => msg.react(reaction.emoji); In addition, the use cases to "duplicate" a reaction on a message seem niche. Beyond that, this method makes no structural sense. A message is a parent to its reactions, the reactions are children of the message. It doesn't make sense for a child to be able to manage its parent. It's the same reason there's no These kinds of methods also lack readability. messageRxn.react() Are we reacting to a message reaction? How is that possible? Where's the arguments? Even with a better name the method will always feel out of place due to the fact that a single message reaction isn't responsible for modifying the collection of message reactions on a given message. message.react(...) This is much clearer to see we're reacting to a message here. And the method feels like it's in the right place because messages own reactions, not vice-versa. |
On the Discord client you can't click a message to send one similar to it and you can click a reaction to react with that emoji too, that was the rationale behind this
You know that's not the case so why are you even making that an argument, that's just stupid. This is simply grabbing an existing reaction by someone else and adding a reaction from the client user similar to the one that was given, nothing more nothing less. If the maintainers don't want to add this they can close the PR but I'm tired of reading a thesis from you every time I open a PR, so please stop, you're not a maintainer |
I find the addition of this shortcut relevant, especially in the case of reaction vents where Reading is much easier in the second demo, and someone who has read the doc knows that reactionMessage represents an emoji linked to a message. client.on('messageReactionAdd', async (reactionMessage, _user) => {
await reactionMessage.message.react(reactionMessage.emoji);
})
client.on('messageReactionAdd', async (reactionMessage, _user) => {
await reactionMessage.react();
}) If the lack of arguments to this method is problematic at this point, could a name change be considered? Something like
|
Personally I'd rather approve the PR with the current naming rather than going with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Past the naming argument which I've mentioned like 3? times now, LGTM
I personally like this change. It's sometimes fun to see a bot agree with your reaction, even if you know the cases where it might and it's mostly arbitrary. Since I know one and a half bots myself that have this functionality already, making that code easier is a win imo. |
Has @suneettipirneni's helper function's name ( The point's been made that some devs unfamiliar with this new This might be the bot (author?) agreeing with the first reaction. TL;DR: The new method does appear to modify a (EDIT: Some more naming options I thought about just after sending) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Just to be clear: if the maintainers agree on any better naming for this method I'll gladly change it but I'd like that opinion to come from them so we don't keep changing things back and forth. Appreciate the feedback so far though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of reaction.users.addMe()
, but I really can't think of a better name.
Please describe the changes this PR makes and why it should be merged:
This PR adds the MessageReaction#react method to make it easier to add an existing reaction to a message. Its purpose is to make it easier for bots to react with emojis they do not know in their cache. The name is up for debate if anyone has better ideas, this was the best I could come up with
Status and versioning classification: