Add author_permissions to the Context object as a shortcut to return the permissions of the author in the channel where the message was originally sent.
This commit is contained in:
parent
6bcc717e63
commit
266d207c3a
@ -32,6 +32,7 @@ import discord.abc
|
|||||||
import discord.utils
|
import discord.utils
|
||||||
|
|
||||||
from discord.message import Message
|
from discord.message import Message
|
||||||
|
from discord import Permissions
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
@ -314,6 +315,13 @@ class Context(discord.abc.Messageable, Generic[BotT]):
|
|||||||
g = self.guild
|
g = self.guild
|
||||||
return g.voice_client if g else None
|
return g.voice_client if g else None
|
||||||
|
|
||||||
|
def author_permissions(self) -> Permissions:
|
||||||
|
"""Returns the author permissions in the given channel.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
"""
|
||||||
|
return self.channel.permissions_for(self.author)
|
||||||
|
|
||||||
async def send_help(self, *args: Any) -> Any:
|
async def send_help(self, *args: Any) -> Any:
|
||||||
"""send_help(entity=<bot>)
|
"""send_help(entity=<bot>)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user