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

Context menu, checks, and cooldowns guide #7952

Open
wants to merge 22 commits into
base: docs/guide
Choose a base branch
from

Conversation

Aryathel
Copy link
Contributor

@Aryathel Aryathel commented Apr 29, 2022

Summary

Updating the Context Menus guide (Just something I threw together as it is already being worked on by another as well).
I plan to also specifically add an app_commands.checks guide, which will include information on cooldowns.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@Rapptz Rapptz added the guide This relates to the discord.py guide label Apr 29, 2022
@Aryathel
Copy link
Contributor Author

Added the checks guide, which includes the information on cooldowns. This guide is specifically for AppCommand checks, as there are differences from standard checks. Not sure if it deserves its own page, but the document is written up now and can be put wherever later.

@Aryathel Aryathel marked this pull request as ready for review April 30, 2022 02:20
@Aryathel Aryathel changed the title [WIP] Context menu, checks, and cooldowns guide Context menu, checks, and cooldowns guide Apr 30, 2022
Copy link
Contributor

@GoogolGenius GoogolGenius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

docs/interactions/checks.rst Outdated Show resolved Hide resolved
docs/interactions/checks.rst Outdated Show resolved Hide resolved
docs/interactions/checks.rst Outdated Show resolved Hide resolved
docs/interactions/checks.rst Outdated Show resolved Hide resolved
Aryathel and others added 4 commits June 7, 2022 19:28
Co-authored-by: GoogleGenius <[email protected]>
Co-authored-by: GoogleGenius <[email protected]>
Co-authored-by: GoogleGenius <[email protected]>
Co-authored-by: GoogleGenius <[email protected]>
@Aryathel
Copy link
Contributor Author

Aryathel commented Jun 8, 2022

Great job!

Thanks for catching stuff I missed!

@No767
Copy link

No767 commented Sep 11, 2023

Just did a quick scan of this PR. Global interaction checks are not documented yet, which I will probably do in a bit

Copy link
Contributor

@IAmTomahawkx IAmTomahawkx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guide itself looks pretty good, however the rst files need to be moved into a guide folder, eg /docs/guide/interactions/.

docs/interactions/context_menus.rst Outdated Show resolved Hide resolved
docs/interactions/checks.rst Outdated Show resolved Hide resolved
docs/interactions/context_menus.rst Outdated Show resolved Hide resolved
docs/interactions/context_menus.rst Outdated Show resolved Hide resolved
docs/interactions/checks.rst Outdated Show resolved Hide resolved
docs/interactions/checks.rst Outdated Show resolved Hide resolved
docs/interactions/context_menus.rst Outdated Show resolved Hide resolved
docs/interactions/context_menus.rst Outdated Show resolved Hide resolved
docs/interactions/context_menus.rst Outdated Show resolved Hide resolved
docs/interactions/context_menus.rst Outdated Show resolved Hide resolved
@Soheab
Copy link
Contributor

Soheab commented Sep 11, 2023

This is missing the integration "checks" (default_permissions, nsfw, guild_only, etc). did this as a comment for some reason lol but they have been added.

docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
Copy link

@No767 No767 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably the last of suggestions i'll do for this pr. once all of the suggestions and edits have been made, you can probably request the final review for danny and that should be it

docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
docs/guide/interactions/context_menus.rst Show resolved Hide resolved
docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@IAmTomahawkx IAmTomahawkx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@No767 No767 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well

Copy link
Contributor

@Gobot1234 Gobot1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure about owner_only things being for guild owners only but aside from that, some weird line wrapping and my wording nits looks good

docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
docs/guide/interactions/checks.rst Outdated Show resolved Hide resolved
docs/guide/interactions/context_menus.rst Outdated Show resolved Hide resolved

- Context menus can be triggered from two possible sources: by right clicking on a user or server member, or by right clicking on a message.
- The ``name`` argument of the :func:`@context_menu <.app_commands.context_menu>` decorator defines the command name that appears in the context menu.
- The second argument can be of type :class:`.User`, :class:`.Member`, or :class:`.User` | :class:`.Member` for user context menus.
Copy link
Contributor

@Gobot1234 Gobot1234 Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not obvious to me reading this what the distinction between User, Member or User | Member is, should this not just be User or Member and drop the union at the end?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to specify this one honestly.

To my knowledge, when used in a Guild context, the arg will be a Member, and when used in a DM context, it will be a User. However, you can also get a User object for both Guild and DMs, or use the union to get either one respective to what environment you invoke the command/menu in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, makes a bit more sense now, not sure if there's a better way to put this, I'll leave that to someone else

docs/guide/interactions/context_menus.rst Outdated Show resolved Hide resolved
@app_commands.context_menu(name='User Context')
@app_commands.default_permissions(manage_messages=True, manage_guild=True)
async def default_permissions_slash_command(interaction: discord.Interaction, user: discord.User) -> None:
await interaction.response.send_message('You may or may not have those permissions!'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await interaction.response.send_message('You may or may not have those permissions!'
await interaction.response.send_message('You may or may not have those permissions!')

@No767 No767 mentioned this pull request Sep 29, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guide This relates to the discord.py guide
Projects
Status: Ready for final review
Development

Successfully merging this pull request may close these issues.

10 participants