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

feat: Slash Command Mentions #1523

Merged
merged 1 commit into from
Jul 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion discord/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ class SlashCommand(ApplicationCommand):
parent: Optional[:class:`SlashCommandGroup`]
The parent group that this command belongs to. ``None`` if there
isn't one.
mention: :class:`str`
Returns a string that allows you to mention the slash command.
guild_only: :class:`bool`
Whether the command should only be usable inside a guild.
default_member_permissions: :class:`~discord.Permissions`
Expand Down Expand Up @@ -757,7 +759,11 @@ def _is_typing_optional(self, annotation):
@property
def is_subcommand(self) -> bool:
return self.parent is not None


@property
def mention(self) -> str:
return f"</{self.qualified_name}:{self.id}>"

def to_dict(self) -> Dict:
as_dict = {
"name": self.name,
Expand Down