mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 09:22:31 -05:00
* Add `check_permissions` kwarg to `bot.embed_requested()`
* Make embeds in help consistent regardless of why it's being sent
(cherry picked from commit ff7c146b62)
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -1220,12 +1220,14 @@ class RedBase(
|
||||
channel: Union[discord.abc.GuildChannel, discord.abc.PrivateChannel],
|
||||
user: discord.abc.User,
|
||||
command: Optional[commands.Command] = None,
|
||||
*,
|
||||
check_permissions: bool = False,
|
||||
) -> bool:
|
||||
"""
|
||||
Determine if an embed is requested for a response.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
Arguments
|
||||
---------
|
||||
channel : `discord.abc.GuildChannel` or `discord.abc.PrivateChannel`
|
||||
The channel to check embed settings for.
|
||||
user : `discord.abc.User`
|
||||
@@ -1233,6 +1235,13 @@ class RedBase(
|
||||
command : `redbot.core.commands.Command`, optional
|
||||
The command ran.
|
||||
|
||||
Keyword Arguments
|
||||
-----------------
|
||||
check_permissions : `bool`
|
||||
If ``True``, this method will also check whether the bot can send embeds
|
||||
in the given channel and if it can't, it will return ``False`` regardless of
|
||||
the bot's embed settings.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
@@ -1249,6 +1258,9 @@ class RedBase(
|
||||
if (user_setting := await self._config.user(user).embeds()) is not None:
|
||||
return user_setting
|
||||
else:
|
||||
if not channel.permissions_for(channel.guild.me).embed_links:
|
||||
return False
|
||||
|
||||
if (channel_setting := await self._config.channel(channel).embeds()) is not None:
|
||||
return channel_setting
|
||||
|
||||
|
||||
Reference in New Issue
Block a user