Use new send to admins method in infractions
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
bf7d4ba23f
commit
7a70bd37e7
|
@ -22,11 +22,12 @@ from database import (
|
|||
GuildSettings,
|
||||
Infractions as InfractionsModel,
|
||||
)
|
||||
from heimdallr.Heimdallr import HeimdallrClient
|
||||
|
||||
|
||||
class Infractions(Extension):
|
||||
def __init__(self, client):
|
||||
self.client: Client = client
|
||||
self.client: HeimdallrClient = client
|
||||
|
||||
@slash_command(
|
||||
name="infractions", description="View your infractions", dm_permission=False
|
||||
|
@ -218,31 +219,31 @@ class Infractions(Extension):
|
|||
except Exception: # pylint: disable=broad-except
|
||||
warning_msg = None
|
||||
|
||||
failed_to_dm_user = not silent and warning_msg is None
|
||||
|
||||
if failed_to_dm_user:
|
||||
await ctx.send(
|
||||
f"{user.mention} has received an infraction, but I couldn't DM them.",
|
||||
ephemeral=True,
|
||||
)
|
||||
else:
|
||||
await ctx.send(
|
||||
f'Warned {user.display_name} ({user.username}#{user.discriminator}, {user.id}) for "{reason}" with severity {weight}', # pylint: disable=line-too-long
|
||||
ephemeral=True,
|
||||
)
|
||||
|
||||
|
||||
guild_settings: Optional[GuildSettings] = GuildSettings.get_or_none(GuildSettings.guild_id == int(ctx.guild_id))
|
||||
if guild_settings is not None:
|
||||
if guild_settings.admin_channel is not None:
|
||||
admin_channel = await self.client.fetch_channel(int(guild_settings.admin_channel))
|
||||
if admin_channel is not None:
|
||||
await admin_channel.send(embed=Embed(
|
||||
await self.client.send_message_to_admins(
|
||||
guild=ctx.guild,
|
||||
embed=Embed(
|
||||
title=f"Warned {user.display_name} ({user.username}#{user.discriminator}, {user.id})",
|
||||
description=f"{reason}",
|
||||
color=infraction_colour(0x0000FF),
|
||||
fields=[
|
||||
EmbedField("**Warned by**",
|
||||
f"{ctx.author.display_name} ({ctx.author.username}#{ctx.author.discriminator})")
|
||||
f"{ctx.author.display_name} ({ctx.author.username}#{ctx.author.discriminator})"
|
||||
)
|
||||
],
|
||||
))
|
||||
|
||||
if not silent and warning_msg is None:
|
||||
await ctx.send(
|
||||
f"{user.mention} has been warned, but I couldn't DM them.",
|
||||
ephemeral=True,
|
||||
)
|
||||
)
|
||||
|
||||
@slash_command(
|
||||
|
|
Loading…
Reference in New Issue