Change message on warnings

This commit is contained in:
Zeva Rose 2021-07-22 10:00:21 -06:00
parent 9111fd2406
commit ffb045b197

View file

@ -11,17 +11,8 @@ from discord_slash.utils.manage_commands import create_choice, create_option
import jarvis
from jarvis.db import DBManager
from jarvis.db.types import (
Autopurge,
Ban,
Kick,
Lock,
Mute,
Purge,
Setting,
Unban,
Warning,
)
from jarvis.db.types import (Autopurge, Ban, Kick, Lock, Mute, Purge, Setting,
Unban, Warning)
from jarvis.utils import build_embed
from jarvis.utils.field import Field
from jarvis.utils.permissions import admin_or_permissions
@ -827,21 +818,17 @@ class AdminCog(commands.Cog):
async def _warnings(self, ctx: SlashContext, user: User):
await ctx.defer()
warnings = Warning.get_many(user=user.id, guild=ctx.guild.id)
active = (
[
active = [
f'`{y.created_at.strftime("%Y-%m-%d %H:%M:%S")}` - {y.reason}'
for y in list(filter(lambda x: x.active, warnings))
]
if warnings
else ["None"]
)
n_active = len(active)
if len(active) > 10:
active = active[:10]
active.append("\n>10 active, results truncated")
elif len(active) == 0:
active = ["None"]
active = ["No active warnings"]
total = len(warnings)
fields = [