mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-22 01:02:34 -05:00
[V3 Core] add support for setting a color for embeds (#1707)
* [V3 Core] add support for setting a color for embeds * Add a guild toggle for whether to use the bot color * Add a function for getting embed color in Context * Coroutines need to be awaited lol
This commit is contained in:
@@ -556,6 +556,42 @@ class Core:
|
||||
await ctx.bot.db.guild(ctx.guild).mod_role.set(role.id)
|
||||
await ctx.send(_("The mod role for this guild has been set."))
|
||||
|
||||
@_set.command(aliases=["usebotcolor"])
|
||||
@checks.guildowner()
|
||||
@commands.guild_only()
|
||||
async def usebotcolour(self, ctx):
|
||||
"""
|
||||
Toggle whether to use the bot owner-configured colour for embeds.
|
||||
|
||||
Default is to not use the bot's configured colour, in which case the
|
||||
colour used will be the colour of the bot's top role.
|
||||
"""
|
||||
current_setting = await ctx.bot.db.guild(ctx.guild).use_bot_color()
|
||||
await ctx.bot.db.guild(ctx.guild).use_bot_color.set(not current_setting)
|
||||
await ctx.send(
|
||||
_("The bot {} use its configured color for embeds.").format(
|
||||
_("will not") if current_setting else _("will")
|
||||
)
|
||||
)
|
||||
|
||||
@_set.command(aliases=["color"])
|
||||
@checks.is_owner()
|
||||
async def colour(self, ctx, *, colour: discord.Colour = None):
|
||||
"""
|
||||
Sets a default colour to be used for the bot's embeds.
|
||||
|
||||
Acceptable values cor the colour parameter can be found at:
|
||||
|
||||
http://discordpy.readthedocs.io/en/rewrite/ext/commands/api.html#discord.ext.commands.ColourConverter
|
||||
"""
|
||||
if colour is None:
|
||||
ctx.bot.color = discord.Color.red()
|
||||
await ctx.bot.db.color.set(discord.Color.red().value)
|
||||
return await ctx.send(_("The color has been reset."))
|
||||
ctx.bot.color = colour
|
||||
await ctx.bot.db.color.set(colour.value)
|
||||
await ctx.send(_("The color has been set."))
|
||||
|
||||
@_set.command()
|
||||
@checks.is_owner()
|
||||
async def avatar(self, ctx, url: str):
|
||||
|
||||
Reference in New Issue
Block a user