WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
Showing only changes of commit 9faf1b027c - Show all commits

View file

@ -73,14 +73,14 @@ class Kick(Type):
if silent is False:
try:
embed = await message_factory(
bot,
await bot.get_embed_color(ctx.channel),
ctx.guild,
reason,
cls(),
ctx.author,
None,
response_message
bot=bot,
color=await bot.get_embed_color(ctx.channel),
guild=ctx.guild,
reason=reason,
moderation_type=cls(),
moderator=ctx.author,
duration=None,
response=response_message
)
await target.send(embed=embed, file=get_icon(bot))
except HTTPException:
@ -88,15 +88,15 @@ class Kick(Type):
await target.kick(reason=f"{str.title(cls.verb)} by {ctx.author.id} for: {reason}")
moderation = await Moderation.log(
bot,
ctx.guild.id,
ctx.author.id,
cls(),
'user',
target.id,
None,
None,
reason
bot=bot,
guild_id=ctx.guild.id,
moderator_id=ctx.author.id,
moderation_type=cls(),
target_type='user',
target_id=target.id,
role_id=None,
duration=None,
reason=reason
)
await response_message.edit(content=f"{target.mention} has been {cls.verb}! (Case {inline(f'#{moderation.id}')})\n{bold('Reason:')} {inline(reason)}")
await log(ctx, moderation.id)
@ -128,14 +128,14 @@ class Ban(Type):
if silent is False:
try:
embed = await message_factory(
bot,
await bot.get_embed_color(ctx.channel),
ctx.guild,
reason,
cls(),
ctx.author,
None,
response_message
bot=bot,
color=await bot.get_embed_color(ctx.channel),
guild=ctx.guild,
reason=reason,
moderation_type=cls(),
moderator=ctx.author,
duration=None,
response=response_message
)
await target.send(embed=embed, file=get_icon(bot))
except HTTPException:
@ -143,15 +143,15 @@ class Ban(Type):
await ctx.guild.ban(target, reason=f"{str.title(cls.verb)} by {ctx.author.id} for: {reason}", delete_message_seconds=delete_messages_seconds)
moderation = await Moderation.log(
bot,
ctx.guild.id,
ctx.author.id,
cls(),
'user',
target.id,
None,
None,
reason
bot=bot,
guild_id=ctx.guild.id,
moderator_id=ctx.author.id,
moderation_type=cls(),
target_type='user',
target_id=target.id,
role_id=None,
duration=None,
reason=reason
)
await response_message.edit(content=f"{target.mention} has been {cls.verb}! (Case {inline(f'#{moderation.id}')})\n{bold('Reason:')} {inline(reason)}")
await log(ctx, moderation.id)
@ -168,14 +168,14 @@ class Ban(Type):
try:
embed = await message_factory(
bot,
await bot.get_embed_color(guild.channels[0]),
guild,
reason,
'unban',
None,
None,
None
bot=bot,
color=await bot.get_embed_color(guild.channels[0]),
guild=guild,
reason=reason,
moderation_type=Unban(),
moderator=None,
duration=None,
response=None
)
await target.send(embed=embed, file=get_icon(bot))
except HTTPException:
@ -215,14 +215,14 @@ class Tempban(Ban):
if silent is False:
try:
embed = await message_factory(
bot,
await bot.get_embed_color(ctx.channel),
ctx.guild,
reason,
cls(),
ctx.author,
parsed_time,
response_message
bot=bot,
color=await bot.get_embed_color(ctx.channel),
guild=ctx.guild,
reason=reason,
moderation_type=cls(),
moderator=ctx.author,
duration=parsed_time,
response=response_message
)
await target.send(embed=embed, file=get_icon(bot))
except HTTPException:
@ -230,15 +230,15 @@ class Tempban(Ban):
await ctx.guild.ban(target, reason=f"{str.title(cls.verb)} by {ctx.author.id} for: {reason} (Duration: {parsed_time})", delete_message_seconds=delete_messages_seconds)
moderation = await Moderation.log(
bot,
ctx.guild.id,
ctx.author.id,
cls(),
'user',
target.id,
None,
parsed_time,
reason
bot=bot,
guild_id=ctx.guild.id,
moderator_id=ctx.author.id,
moderation_type=cls(),
target_type='user',
target_id=target.id,
role_id=None,
duration=parsed_time,
reason=reason
)
await response_message.edit(content=f"{target.mention} has been {cls.verb} for {humanize_timedelta(parsed_time)}! (Case {inline(f'#{moderation.id}')})\n{bold('Reason:')} {inline(reason)}")
await log(ctx, moderation.id)
@ -271,14 +271,14 @@ class Softban(Type):
if silent is False:
try:
embed = await message_factory(
bot,
await bot.get_embed_color(ctx.channel),
ctx.guild,
reason,
cls(),
ctx.author,
None,
response_message
bot=bot,
color=await bot.get_embed_color(ctx.channel),
guild=ctx.guild,
reason=reason,
moderation_type=cls(),
moderator=ctx.author,
duration=None,
response=response_message
)
await target.send(embed=embed, file=get_icon(bot))
except HTTPException:
@ -287,15 +287,15 @@ class Softban(Type):
await ctx.guild.ban(target, reason=f"{str.title(cls.verb)} by {ctx.author.id} for: {reason}", delete_message_seconds=delete_messages_seconds)
await ctx.guild.unban(target, reason=f"{str.title(cls.verb)} by {ctx.author.id} for: {reason}")
moderation = await Moderation.log(
bot,
ctx.guild.id,
ctx.author.id,
cls(),
'user',
target.id,
None,
None,
reason
bot=bot,
guild_id=ctx.guild.id,
moderator_id=ctx.author.id,
moderation_type=cls(),
target_type='user',
target_id=target.id,
role_id=None,
duration=None,
reason=reason
)
await response_message.edit(content=f"{target.mention} has been {cls.verb}! (Case {inline(f'#{moderation.id}')})\n{bold('Reason:')} {inline(reason)}")
await log(ctx, moderation.id)
@ -323,14 +323,14 @@ class Unban(Type):
if silent is False:
try:
embed = await message_factory(
bot,
await bot.get_embed_color(ctx.channel),
ctx.guild,
reason,
cls(),
ctx.author,
None,
response_message
bot=bot,
color=await bot.get_embed_color(ctx.channel),
guild=ctx.guild,
reason=reason,
moderation_type=cls(),
moderator=ctx.author,
duration=None,
response=response_message
)
await target.send(embed=embed, file=get_icon(bot))
except HTTPException:
@ -338,15 +338,15 @@ class Unban(Type):
await ctx.guild.unban(target, reason=f"{str.title(cls.verb)} by {ctx.author.id} for: {reason}")
moderation = await Moderation.log(
bot,
ctx.guild.id,
ctx.author.id,
cls(),
'user',
target.id,
None,
None,
reason
bot=bot,
guild_id=ctx.guild.id,
moderator_id=ctx.author.id,
moderation_type=cls(),
target_type='user',
target_id=target.id,
role_id=None,
duration=None,
reason=reason
)
await response_message.edit(content=f"{target.mention} has been {cls.verb}! (Case {inline(f'#{moderation.id}')})\n{bold('Reason:')} {inline(reason)}")
await log(ctx, moderation.id)
@ -379,15 +379,15 @@ class Slowmode(Type):
if isinstance(target, TextChannel):
await target.edit(slowmode_delay=ceil(parsed_time.total_seconds()))
moderation = await Moderation.log(
bot,
ctx.guild.id,
ctx.author.id,
cls(),
'channel',
target.id,
None,
parsed_time,
None
bot=bot,
guild_id=ctx.guild.id,
moderator_id=ctx.author.id,
moderation_type=cls(),
target_type='channel',
target_id=target.id,
role_id=None,
duration=parsed_time,
reason=None
)
await ctx.send(f"{ctx.author.mention} has {cls.verb} {target.mention} to {humanize_timedelta(parsed_time)}!\n{bold('Reason:')} {inline(reason)}")
await log(ctx, moderation.id)