Skip to content

Commit 23f1c4e

Browse files
committed
Fix logs command
1 parent 91511b0 commit 23f1c4e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

cogs/modmail.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ async def _close(self, ctx):
164164
@commands.command()
165165
async def nsfw(self, ctx):
166166
"""Flags a modmail thread as nsfw."""
167-
thread = self.bot.threads.find(channel=ctx.channel)
167+
thread = await self.bot.threads.find(channel=ctx.channel)
168168
if thread is None:
169169
return
170170
await ctx.channel.edit(nsfw=True)
@@ -196,7 +196,9 @@ async def logs(self, ctx, *, member: discord.Member=None):
196196

197197
fmt = ''
198198

199-
for index, entry in enumerate(logs):
199+
open_logs = [l for l in logs if not l['open']]
200+
201+
for index, entry in enumerate(open_logs):
200202
if len(embeds[-1].fields) == 3:
201203
em = discord.Embed(color=discord.Color.green())
202204
em.set_author(name='Previous Logs', icon_url=user.avatar_url)
@@ -209,12 +211,11 @@ async def logs(self, ctx, *, member: discord.Member=None):
209211
user_id = entry['user_id']
210212
log_url = f"https://logs.modmail.tk/{user_id}/{key}"
211213

212-
if not entry['open']: # only list closed threads
213-
fmt += f"[`{key}`]({log_url})\n"
214+
fmt += f"[`{key}`]({log_url})\n"
214215

215-
if current_day != new_day or index == len(logs) - 2:
216-
embeds[-1].add_field(name=current_day, value=fmt)
217-
current_day = new_day
216+
if current_day != new_day or index == len(logs) - 1:
217+
embeds[-1].add_field(name=current_day, value=fmt)
218+
current_day = new_day
218219
fmt = ''
219220

220221
session = PaginatorSession(ctx, *embeds)

0 commit comments

Comments
 (0)