From 950b3f577b079c7fa2dd9713626290aca492db34 Mon Sep 17 00:00:00 2001 From: Mary Date: Wed, 8 Mar 2023 08:29:56 +0100 Subject: [PATCH] Update move logic after rebase --- robocop_ng/cogs/mod.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/robocop_ng/cogs/mod.py b/robocop_ng/cogs/mod.py index 059fa81..a4eedc9 100644 --- a/robocop_ng/cogs/mod.py +++ b/robocop_ng/cogs/mod.py @@ -698,7 +698,10 @@ class Mod(Cog): !move {channel to move to} {number of messages}""" # get a list of the messages - fetchedMessages = await ctx.channel.history(limit=limit + 1).flatten() + fetchedMessages = [] + + async for message in ctx.channel.history(limit=limit + 1): + fetchedMessages.append(message) # delete all of those messages from the channel for i in fetchedMessages: @@ -718,9 +721,15 @@ class Mod(Cog): else: # Create embed message object and set content to original embedMessage = discord.Embed(description=messages.content) + + avatar_url = None + + if messages.author.avatar is not None: + avatar_url = messages.author.avatar.url + # set the embed message author to original author embedMessage.set_author( - name=messages.author, icon_url=messages.author.avatar_url + name=messages.author, icon_url=avatar_url ) # if message has attachments add them if messages.attachments: