Formatting changes

This commit is contained in:
Zeva Rose 2022-02-05 13:23:56 -07:00
parent db5a60a88f
commit 5917f252e1
2 changed files with 14 additions and 14 deletions

View file

@ -256,10 +256,11 @@ class BanCog(CacheCog):
if not discord_ban_info and not database_ban_info: if not discord_ban_info and not database_ban_info:
await ctx.send(f"Unable to find user {orig_user}", ephemeral=True) await ctx.send(f"Unable to find user {orig_user}", ephemeral=True)
elif discord_ban_info: elif discord_ban_info and not database_ban_info:
await self.discord_apply_unban(ctx, discord_ban_info.user, reason) await self.discord_apply_unban(ctx, discord_ban_info.user, reason)
else: else:
discord_ban_info = find(lambda x: x.user.id == database_ban_info["id"], bans) discord_ban_info = find(lambda x: x.user.id == database_ban_info.id, bans)
if discord_ban_info: if discord_ban_info:
await self.discord_apply_unban(ctx, discord_ban_info.user, reason) await self.discord_apply_unban(ctx, discord_ban_info.user, reason)
else: else:
@ -273,9 +274,7 @@ class BanCog(CacheCog):
admin=ctx.author.id, admin=ctx.author.id,
reason=reason, reason=reason,
).save() ).save()
await ctx.send( await ctx.send("Unable to find user in Discord, but removed entry from database.")
"Unable to find user in Discord, " + "but removed entry from database."
)
@slash_command( @slash_command(
name="bans", description="User bans", sub_cmd_name="list", sub_cmd_description="List bans" name="bans", description="User bans", sub_cmd_name="list", sub_cmd_description="List bans"
@ -300,9 +299,9 @@ class BanCog(CacheCog):
choices=[SlashCommandChoice(name="Yes", value=1), SlashCommandChoice(name="No", value=0)], choices=[SlashCommandChoice(name="Yes", value=1), SlashCommandChoice(name="No", value=0)],
) )
@check(admin_or_permissions(Permissions.BAN_MEMBERS)) @check(admin_or_permissions(Permissions.BAN_MEMBERS))
async def _bans_list(self, ctx: InteractionContext, type: int = 0, active: int = 1) -> None: async def _bans_list(self, ctx: InteractionContext, btype: int = 0, active: int = 1) -> None:
active = bool(active) active = bool(active)
exists = self.check_cache(ctx, type=type, active=active) exists = self.check_cache(ctx, btype=btype, active=active)
if exists: if exists:
await ctx.defer(ephemeral=True) await ctx.defer(ephemeral=True)
await ctx.send( await ctx.send(
@ -314,8 +313,8 @@ class BanCog(CacheCog):
search = {"guild": ctx.guild.id} search = {"guild": ctx.guild.id}
if active: if active:
search["active"] = True search["active"] = True
if type > 0: if btype > 0:
search["type"] = types[type] search["type"] = types[btype]
bans = Ban.objects(**search).order_by("-created_at") bans = Ban.objects(**search).order_by("-created_at")
db_bans = [] db_bans = []
fields = [] fields = []
@ -355,9 +354,9 @@ class BanCog(CacheCog):
pages = [] pages = []
title = "Active " if active else "Inactive " title = "Active " if active else "Inactive "
if type > 0: if btype > 0:
title += types[type] title += types[btype]
if type == 1: if btype == 1:
title += "a" title += "a"
title += "bans" title += "bans"
if len(fields) == 0: if len(fields) == 0:
@ -381,7 +380,7 @@ class BanCog(CacheCog):
"user": ctx.author.id, "user": ctx.author.id,
"timeout": datetime.utcnow() + timedelta(minutes=5), "timeout": datetime.utcnow() + timedelta(minutes=5),
"command": ctx.subcommand_name, "command": ctx.subcommand_name,
"type": type, "btype": btype,
"active": active, "active": active,
"paginator": paginator, "paginator": paginator,
} }

View file

@ -33,6 +33,7 @@ class KickCog(Scale):
if len(reason) > 100: if len(reason) > 100:
await ctx.send("Reason must be < 100 characters", ephemeral=True) await ctx.send("Reason must be < 100 characters", ephemeral=True)
return return
guild_name = ctx.guild.name guild_name = ctx.guild.name
embed = build_embed( embed = build_embed(
title=f"You have been kicked from {guild_name}", title=f"You have been kicked from {guild_name}",
@ -64,10 +65,10 @@ class KickCog(Scale):
embed.set_thumbnail(url=user.display_avatar.url) embed.set_thumbnail(url=user.display_avatar.url)
embed.set_footer(text=f"{user.username}#{user.discriminator} | {user.id}") embed.set_footer(text=f"{user.username}#{user.discriminator} | {user.id}")
await ctx.send(embed=embed)
_ = Kick( _ = Kick(
user=user.id, user=user.id,
reason=reason, reason=reason,
admin=ctx.author.id, admin=ctx.author.id,
guild=ctx.guild.id, guild=ctx.guild.id,
).save() ).save()
await ctx.send(embed=embed)