Change message on warnings
This commit is contained in:
parent
9111fd2406
commit
ffb045b197
1 changed files with 7 additions and 20 deletions
|
@ -11,17 +11,8 @@ from discord_slash.utils.manage_commands import create_choice, create_option
|
||||||
|
|
||||||
import jarvis
|
import jarvis
|
||||||
from jarvis.db import DBManager
|
from jarvis.db import DBManager
|
||||||
from jarvis.db.types import (
|
from jarvis.db.types import (Autopurge, Ban, Kick, Lock, Mute, Purge, Setting,
|
||||||
Autopurge,
|
Unban, Warning)
|
||||||
Ban,
|
|
||||||
Kick,
|
|
||||||
Lock,
|
|
||||||
Mute,
|
|
||||||
Purge,
|
|
||||||
Setting,
|
|
||||||
Unban,
|
|
||||||
Warning,
|
|
||||||
)
|
|
||||||
from jarvis.utils import build_embed
|
from jarvis.utils import build_embed
|
||||||
from jarvis.utils.field import Field
|
from jarvis.utils.field import Field
|
||||||
from jarvis.utils.permissions import admin_or_permissions
|
from jarvis.utils.permissions import admin_or_permissions
|
||||||
|
@ -827,21 +818,17 @@ class AdminCog(commands.Cog):
|
||||||
async def _warnings(self, ctx: SlashContext, user: User):
|
async def _warnings(self, ctx: SlashContext, user: User):
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
warnings = Warning.get_many(user=user.id, guild=ctx.guild.id)
|
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}'
|
||||||
f'`{y.created_at.strftime("%Y-%m-%d %H:%M:%S")}` - {y.reason}'
|
for y in list(filter(lambda x: x.active, warnings))
|
||||||
for y in list(filter(lambda x: x.active, warnings))
|
]
|
||||||
]
|
|
||||||
if warnings
|
|
||||||
else ["None"]
|
|
||||||
)
|
|
||||||
|
|
||||||
n_active = len(active)
|
n_active = len(active)
|
||||||
if len(active) > 10:
|
if len(active) > 10:
|
||||||
active = active[:10]
|
active = active[:10]
|
||||||
active.append("\n>10 active, results truncated")
|
active.append("\n>10 active, results truncated")
|
||||||
elif len(active) == 0:
|
elif len(active) == 0:
|
||||||
active = ["None"]
|
active = ["No active warnings"]
|
||||||
|
|
||||||
total = len(warnings)
|
total = len(warnings)
|
||||||
fields = [
|
fields = [
|
||||||
|
|
Loading…
Add table
Reference in a new issue