discordjs / guide

The official guide for discord.js, created and maintained by core members of its community.
https://discordjs.guide
MIT License
1.57k stars 2.3k forks source link

Unclear documentation - what does 'target' mean #1541

Closed Lauro235 closed 10 months ago

Lauro235 commented 10 months ago

Part of the guide the question is about

There are a number of times that the term 'target' is used to explain a method, however in most if not all cases this term is not given context. In the getRole('target') example, it would be helpful to know if the 'target' was the role id or the the role name provided as a string.

It would also be helpful if the getRole method could be officially written about in the documentation. It's all too vague for me. The same applies for the other methods like getMentionable, getMember etc.

Examples

guide/slash-commands/parsing-options.md

…in the guild where the command is being run, you can also use .getMember('target') to get their GuildMember object.

guide/popular-topics/faq.md

### How do I add a role to a guild member?

53 | const role = interaction.options.getRole('role');
54 | const member = interaction.options.getMember('target');
55 | member.roles.add(role);

At a minimum, please update so that we know if 'target' is a stand in. If it is a stand in, then please provide information on what it is a stand in for.

Thank you for reading.

Question

Please can we provide more context for the meaning of the word 'target' in its various contexts?

sdanialraza commented 10 months ago

'role', 'target', etc. are the option names you want to get the value of, these methods are documented here.

Lauro235 commented 10 months ago

Thank you for your response. I think there was another issue with my code so I will mark this as resolved. Thanks again for your time.