Skip to content

Commit aa3ec7f

Browse files
authored
Merge pull request #315 from Dorukyum/actx.me
Add ApplicationContext.me & improve docstr
2 parents 1ea385a + 0ab81ab commit aa3ec7f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

discord/commands/context.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
)
4444

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

88+
@cached_property
89+
def me(self) -> Union[Member, User]:
90+
return self.guild.me if self.guild is not None else self.bot.user
91+
8892
@cached_property
8993
def message(self) -> Optional[Message]:
9094
return self.interaction.message

0 commit comments

Comments
 (0)