aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2019-12-03 21:36:37 -0800
committerGravatar MarkKoz <[email protected]>2019-12-03 21:36:37 -0800
commit56c1e01e3059a7163e01df5282265c1053b419c3 (patch)
treebd3787c64cc81da7b1b33f4460a84733101eb199
parentAntiSpam: correct a function annotation (diff)
ModLog: fix 0 message logs uploaded when no attachments given
-rw-r--r--bot/cogs/moderation/modlog.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/bot/cogs/moderation/modlog.py b/bot/cogs/moderation/modlog.py
index 6fffa7170..801582a6b 100644
--- a/bot/cogs/moderation/modlog.py
+++ b/bot/cogs/moderation/modlog.py
@@ -2,6 +2,7 @@ import asyncio
import logging
import typing as t
from datetime import datetime
+from itertools import zip_longest
import discord
from dateutil.relativedelta import relativedelta
@@ -40,13 +41,7 @@ class ModLog(Cog, name="ModLog"):
actor_id: int,
attachments: t.Iterable[t.List[str]] = None
) -> str:
- """
- Uploads the log data to the database via an API endpoint for uploading logs.
-
- Used in several mod log embeds.
-
- Returns a URL that can be used to view the log.
- """
+ """Upload message logs to the database and return a URL to a page for viewing the logs."""
if attachments is None:
attachments = []
@@ -64,7 +59,7 @@ class ModLog(Cog, name="ModLog"):
'embeds': [embed.to_dict() for embed in message.embeds],
'attachments': attachment,
}
- for message, attachment in zip(messages, attachments)
+ for message, attachment in zip_longest(messages, attachments)
]
}
)