mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Reports] Use the bot's default colour for report output (#4800)
* [Reports] Use `ctx.embed_colour()` for report output * Add context Co-authored-by: kreusada <67752638+kreus7@users.noreply.github.com>
This commit is contained in:
parent
4ca2fe0872
commit
a9e572d55a
@ -192,7 +192,7 @@ class Reports(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
return guild
|
return guild
|
||||||
|
|
||||||
async def send_report(self, msg: discord.Message, guild: discord.Guild):
|
async def send_report(self, ctx: commands.Context, msg: discord.Message, guild: discord.Guild):
|
||||||
|
|
||||||
author = guild.get_member(msg.author.id)
|
author = guild.get_member(msg.author.id)
|
||||||
report = msg.clean_content
|
report = msg.clean_content
|
||||||
@ -208,7 +208,7 @@ class Reports(commands.Cog):
|
|||||||
await self.config.guild(guild).next_ticket.set(ticket_number + 1)
|
await self.config.guild(guild).next_ticket.set(ticket_number + 1)
|
||||||
|
|
||||||
if await self.bot.embed_requested(channel, author):
|
if await self.bot.embed_requested(channel, author):
|
||||||
em = discord.Embed(description=report)
|
em = discord.Embed(description=report, colour=await ctx.embed_colour())
|
||||||
em.set_author(
|
em.set_author(
|
||||||
name=_("Report from {author}{maybe_nick}").format(
|
name=_("Report from {author}{maybe_nick}").format(
|
||||||
author=author, maybe_nick=(f" ({author.nick})" if author.nick else "")
|
author=author, maybe_nick=(f" ({author.nick})" if author.nick else "")
|
||||||
@ -279,7 +279,7 @@ class Reports(commands.Cog):
|
|||||||
_m = copy(ctx.message)
|
_m = copy(ctx.message)
|
||||||
_m.content = _report
|
_m.content = _report
|
||||||
_m.content = _m.clean_content
|
_m.content = _m.clean_content
|
||||||
val = await self.send_report(_m, guild)
|
val = await self.send_report(ctx, _m, guild)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
await author.send(
|
await author.send(
|
||||||
@ -300,7 +300,7 @@ class Reports(commands.Cog):
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
return await author.send(_("You took too long. Try again later."))
|
return await author.send(_("You took too long. Try again later."))
|
||||||
else:
|
else:
|
||||||
val = await self.send_report(message, guild)
|
val = await self.send_report(ctx, message, guild)
|
||||||
|
|
||||||
with contextlib.suppress(discord.Forbidden, discord.HTTPException):
|
with contextlib.suppress(discord.Forbidden, discord.HTTPException):
|
||||||
if val is None:
|
if val is None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user