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:
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)
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:
await self.discord_apply_unban(ctx, discord_ban_info.user, reason)
else:
@ -273,9 +274,7 @@ class BanCog(CacheCog):
admin=ctx.author.id,
reason=reason,
).save()
await ctx.send(
"Unable to find user in Discord, " + "but removed entry from database."
)
await ctx.send("Unable to find user in Discord, but removed entry from database.")
@slash_command(
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)],
)
@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)
exists = self.check_cache(ctx, type=type, active=active)
exists = self.check_cache(ctx, btype=btype, active=active)
if exists:
await ctx.defer(ephemeral=True)
await ctx.send(
@ -314,8 +313,8 @@ class BanCog(CacheCog):
search = {"guild": ctx.guild.id}
if active:
search["active"] = True
if type > 0:
search["type"] = types[type]
if btype > 0:
search["type"] = types[btype]
bans = Ban.objects(**search).order_by("-created_at")
db_bans = []
fields = []
@ -355,9 +354,9 @@ class BanCog(CacheCog):
pages = []
title = "Active " if active else "Inactive "
if type > 0:
title += types[type]
if type == 1:
if btype > 0:
title += types[btype]
if btype == 1:
title += "a"
title += "bans"
if len(fields) == 0:
@ -381,7 +380,7 @@ class BanCog(CacheCog):
"user": ctx.author.id,
"timeout": datetime.utcnow() + timedelta(minutes=5),
"command": ctx.subcommand_name,
"type": type,
"btype": btype,
"active": active,
"paginator": paginator,
}

View file

@ -33,6 +33,7 @@ class KickCog(Scale):
if len(reason) > 100:
await ctx.send("Reason must be < 100 characters", ephemeral=True)
return
guild_name = ctx.guild.name
embed = build_embed(
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_footer(text=f"{user.username}#{user.discriminator} | {user.id}")
await ctx.send(embed=embed)
_ = Kick(
user=user.id,
reason=reason,
admin=ctx.author.id,
guild=ctx.guild.id,
).save()
await ctx.send(embed=embed)