Fix bug with warnings if no warnings exist
This commit is contained in:
parent
ec43caeb1e
commit
2a41eda129
2 changed files with 5 additions and 14 deletions
|
@ -36,7 +36,7 @@ jarvis = commands.Bot(
|
||||||
)
|
)
|
||||||
slash = SlashCommand(jarvis, sync_commands=True, sync_on_cog_reload=True)
|
slash = SlashCommand(jarvis, sync_commands=True, sync_on_cog_reload=True)
|
||||||
jarvis_self = Process()
|
jarvis_self = Process()
|
||||||
__version__ = "1.2.0"
|
__version__ = "1.2.1"
|
||||||
|
|
||||||
|
|
||||||
db = DBManager(get_config().mongo).mongo
|
db = DBManager(get_config().mongo).mongo
|
||||||
|
|
|
@ -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
|
||||||
|
@ -832,7 +823,7 @@ class AdminCog(commands.Cog):
|
||||||
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
|
if len(warnings) > 0
|
||||||
else ["None"]
|
else ["None"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -841,7 +832,7 @@ class AdminCog(commands.Cog):
|
||||||
active = active[:10]
|
active = active[:10]
|
||||||
active.append("\n>10 active, results truncated")
|
active.append("\n>10 active, results truncated")
|
||||||
|
|
||||||
total = len(warnings) if warnings else 0
|
total = len(warnings)
|
||||||
fields = [
|
fields = [
|
||||||
Field(f"{n_active} Active", "\n".join(active)),
|
Field(f"{n_active} Active", "\n".join(active)),
|
||||||
Field("Total", total),
|
Field("Total", total),
|
||||||
|
|
Loading…
Add table
Reference in a new issue