Skip to content

Commit

Permalink
Merge pull request Pycord-Development#315 from Dorukyum/actx.me
Browse files Browse the repository at this point in the history
Add ApplicationContext.me & improve docstr
  • Loading branch information
BobDotCom authored Oct 25, 2021
2 parents 1ea385a + 0ab81ab commit aa3ec7f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion discord/commands/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
)

class ApplicationContext(discord.abc.Messageable):
"""Represents a Discord interaction context.
"""Represents a Discord application command interaction context.
This class is not created manually and is instead passed to application
commands as the first parameter.
Expand Down Expand Up @@ -85,6 +85,10 @@ def guild(self) -> Optional[Guild]:
def guild_id(self) -> Optional[int]:
return self.interaction.guild_id

@cached_property
def me(self) -> Union[Member, User]:
return self.guild.me if self.guild is not None else self.bot.user

@cached_property
def message(self) -> Optional[Message]:
return self.interaction.message
Expand Down

0 comments on commit aa3ec7f

Please sign in to comment.