aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Matteo Bertucci <[email protected]>2021-10-05 12:37:36 +0000
committerGravatar GitHub <[email protected]>2021-10-05 12:37:36 +0000
commit86881fdde5cb12c3e013acb2aa0adf5c74b5cafe (patch)
treea918905a3f706dcd6e639ed108e76afe3cc306f1
parentModlog: change thread logging to past-tense (diff)
avatar.url -> display_avatar.url
avatar can apparently be none, which means traceback and a very sad akarys
-rw-r--r--bot/exts/filters/antispam.py2
-rw-r--r--bot/exts/filters/filtering.py4
-rw-r--r--bot/exts/filters/token_remover.py2
-rw-r--r--bot/exts/filters/webhook_remover.py2
-rw-r--r--bot/exts/fun/duck_pond.py4
-rw-r--r--bot/exts/info/information.py2
-rw-r--r--bot/exts/moderation/defcon.py2
-rw-r--r--bot/exts/moderation/incidents.py4
-rw-r--r--bot/exts/moderation/infraction/_scheduler.py6
-rw-r--r--bot/exts/moderation/infraction/management.py2
-rw-r--r--bot/exts/moderation/modlog.py12
-rw-r--r--bot/exts/moderation/watchchannels/_watchchannel.py6
-rw-r--r--bot/utils/messages.py2
-rw-r--r--tests/bot/exts/filters/test_token_remover.py4
-rw-r--r--tests/bot/exts/info/test_information.py2
15 files changed, 28 insertions, 28 deletions
diff --git a/bot/exts/filters/antispam.py b/bot/exts/filters/antispam.py
index 7c4e3e0f5..9d45f4620 100644
--- a/bot/exts/filters/antispam.py
+++ b/bot/exts/filters/antispam.py
@@ -103,7 +103,7 @@ class DeletionContext:
colour=Colour(Colours.soft_red),
title="Spam detected!",
text=mod_alert_message,
- thumbnail=last_message.author.avatar.url,
+ thumbnail=last_message.author.display_avatar.url,
channel_id=Channels.mod_alerts,
ping_everyone=AntiSpamConfig.ping_everyone
)
diff --git a/bot/exts/filters/filtering.py b/bot/exts/filters/filtering.py
index f29ba4694..cff349e2f 100644
--- a/bot/exts/filters/filtering.py
+++ b/bot/exts/filters/filtering.py
@@ -226,7 +226,7 @@ class Filtering(Cog):
title="Username filtering alert",
text=log_string,
channel_id=Channels.mod_alerts,
- thumbnail=member.avatar.url
+ thumbnail=member.display_avatar.url
)
# Update time when alert sent
@@ -386,7 +386,7 @@ class Filtering(Cog):
colour=Colour(Colours.soft_red),
title=f"{_filter['type'].title()} triggered!",
text=message,
- thumbnail=msg.author.avatar.url,
+ thumbnail=msg.author.display_avatar.url,
channel_id=Channels.mod_alerts,
ping_everyone=ping_everyone,
additional_embeds=stats.additional_embeds,
diff --git a/bot/exts/filters/token_remover.py b/bot/exts/filters/token_remover.py
index 3c66a70f4..1757a1175 100644
--- a/bot/exts/filters/token_remover.py
+++ b/bot/exts/filters/token_remover.py
@@ -108,7 +108,7 @@ class TokenRemover(Cog):
colour=Colour(Colours.soft_red),
title="Token removed!",
text=log_message + "\n" + userid_message,
- thumbnail=msg.author.avatar.url,
+ thumbnail=msg.author.display_avatar.url,
channel_id=Channels.mod_alerts,
ping_everyone=mention_everyone,
)
diff --git a/bot/exts/filters/webhook_remover.py b/bot/exts/filters/webhook_remover.py
index cc639b5fb..2ea1eb1c8 100644
--- a/bot/exts/filters/webhook_remover.py
+++ b/bot/exts/filters/webhook_remover.py
@@ -63,7 +63,7 @@ class WebhookRemover(Cog):
colour=Colour(Colours.soft_red),
title="Discord webhook URL removed!",
text=message,
- thumbnail=msg.author.avatar.url,
+ thumbnail=msg.author.display_avatar.url,
channel_id=Channels.mod_alerts
)
diff --git a/bot/exts/fun/duck_pond.py b/bot/exts/fun/duck_pond.py
index 2b32f7acc..aa8357ab0 100644
--- a/bot/exts/fun/duck_pond.py
+++ b/bot/exts/fun/duck_pond.py
@@ -93,7 +93,7 @@ class DuckPond(Cog):
webhook=self.webhook,
content=message.clean_content,
username=message.author.display_name,
- avatar_url=message.author.avatar.url
+ avatar_url=message.author.display_avatar.url
)
if message.attachments:
@@ -108,7 +108,7 @@ class DuckPond(Cog):
webhook=self.webhook,
embed=e,
username=message.author.display_name,
- avatar_url=message.author.avatar.url
+ avatar_url=message.author.display_avatar.url
)
except discord.HTTPException:
log.exception("Failed to send an attachment to the webhook")
diff --git a/bot/exts/info/information.py b/bot/exts/info/information.py
index aa7c72872..7361f3827 100644
--- a/bot/exts/info/information.py
+++ b/bot/exts/info/information.py
@@ -313,7 +313,7 @@ class Information(Cog):
for field_name, field_content in fields:
embed.add_field(name=field_name, value=field_content, inline=False)
- embed.set_thumbnail(url=user.avatar.url)
+ embed.set_thumbnail(url=user.display_avatar.url)
embed.colour = user.colour if user.colour != Colour.default() else Colour.blurple()
return embed
diff --git a/bot/exts/moderation/defcon.py b/bot/exts/moderation/defcon.py
index f2bb0aa14..ebd0ab499 100644
--- a/bot/exts/moderation/defcon.py
+++ b/bot/exts/moderation/defcon.py
@@ -137,7 +137,7 @@ class Defcon(Cog):
await self.mod_log.send_log_message(
Icons.defcon_denied, Colours.soft_red, "Entry denied",
- message, member.avatar.url
+ message, member.display_avatar.url
)
@group(name='defcon', aliases=('dc',), invoke_without_command=True)
diff --git a/bot/exts/moderation/incidents.py b/bot/exts/moderation/incidents.py
index fe7f234be..e2a90ae50 100644
--- a/bot/exts/moderation/incidents.py
+++ b/bot/exts/moderation/incidents.py
@@ -93,7 +93,7 @@ async def make_embed(incident: discord.Message, outcome: Signal, actioned_by: di
timestamp=datetime.utcnow(),
colour=colour,
)
- embed.set_footer(text=footer, icon_url=actioned_by.avatar.url)
+ embed.set_footer(text=footer, icon_url=actioned_by.display_avatar.url)
if incident.attachments:
attachment = incident.attachments[0] # User-sent messages can only contain one attachment
@@ -252,7 +252,7 @@ class Incidents(Cog):
await webhook.send(
embed=embed,
username=sub_clyde(incident.author.name),
- avatar_url=incident.author.avatar.url,
+ avatar_url=incident.author.display_avatar.url,
file=attachment_file,
)
except Exception:
diff --git a/bot/exts/moderation/infraction/_scheduler.py b/bot/exts/moderation/infraction/_scheduler.py
index 9f130f943..3f3c49852 100644
--- a/bot/exts/moderation/infraction/_scheduler.py
+++ b/bot/exts/moderation/infraction/_scheduler.py
@@ -239,7 +239,7 @@ class InfractionScheduler:
icon_url=icon,
colour=Colours.soft_red,
title=f"Infraction {log_title}: {' '.join(infr_type.split('_'))}",
- thumbnail=user.avatar.url,
+ thumbnail=user.display_avatar.url,
text=textwrap.dedent(f"""
Member: {messages.format_user(user)}
Actor: {ctx.author.mention}{dm_log_text}{expiry_log_text}
@@ -333,7 +333,7 @@ class InfractionScheduler:
icon_url=_utils.INFRACTION_ICONS[infr_type][1],
colour=Colours.soft_green,
title=f"Infraction {log_title}: {' '.join(infr_type.split('_'))}",
- thumbnail=user.avatar.url,
+ thumbnail=user.display_avatar.url,
text="\n".join(f"{k}: {v}" for k, v in log_text.items()),
footer=footer,
content=log_content,
@@ -450,7 +450,7 @@ class InfractionScheduler:
log_title = "expiration failed" if "Failure" in log_text else "expired"
user = self.bot.get_user(user_id)
- avatar = user.avatar.url if user else None
+ avatar = user.display_avatar.url if user else None
# Move reason to end so when reason is too long, this is not gonna cut out required items.
log_text["Reason"] = log_text.pop("Reason")
diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py
index 2f6aafa71..722ddfcce 100644
--- a/bot/exts/moderation/infraction/management.py
+++ b/bot/exts/moderation/infraction/management.py
@@ -197,7 +197,7 @@ class ModManagement(commands.Cog):
if user:
user_text = messages.format_user(user)
- thumbnail = user.avatar.url
+ thumbnail = user.display_avatar.url
else:
user_text = f"<@{user_id}>"
thumbnail = None
diff --git a/bot/exts/moderation/modlog.py b/bot/exts/moderation/modlog.py
index 5b8b7ef12..811bac135 100644
--- a/bot/exts/moderation/modlog.py
+++ b/bot/exts/moderation/modlog.py
@@ -394,7 +394,7 @@ class ModLog(Cog, name="ModLog"):
await self.send_log_message(
Icons.user_ban, Colours.soft_red,
"User banned", format_user(member),
- thumbnail=member.avatar.url,
+ thumbnail=member.display_avatar.url,
channel_id=Channels.user_log
)
@@ -415,7 +415,7 @@ class ModLog(Cog, name="ModLog"):
await self.send_log_message(
Icons.sign_in, Colours.soft_green,
"User joined", message,
- thumbnail=member.avatar.url,
+ thumbnail=member.display_avatar.url,
channel_id=Channels.user_log
)
@@ -432,7 +432,7 @@ class ModLog(Cog, name="ModLog"):
await self.send_log_message(
Icons.sign_out, Colours.soft_red,
"User left", format_user(member),
- thumbnail=member.avatar.url,
+ thumbnail=member.display_avatar.url,
channel_id=Channels.user_log
)
@@ -449,7 +449,7 @@ class ModLog(Cog, name="ModLog"):
await self.send_log_message(
Icons.user_unban, Colour.blurple(),
"User unbanned", format_user(member),
- thumbnail=member.avatar.url,
+ thumbnail=member.display_avatar.url,
channel_id=Channels.mod_log
)
@@ -515,7 +515,7 @@ class ModLog(Cog, name="ModLog"):
colour=Colour.blurple(),
title="Member updated",
text=message,
- thumbnail=after.avatar.url,
+ thumbnail=after.display_avatar.url,
channel_id=Channels.user_log
)
@@ -886,7 +886,7 @@ class ModLog(Cog, name="ModLog"):
colour=colour,
title="Voice state updated",
text=message,
- thumbnail=member.avatar.url,
+ thumbnail=member.display_avatar.url,
channel_id=Channels.voice_log
)
diff --git a/bot/exts/moderation/watchchannels/_watchchannel.py b/bot/exts/moderation/watchchannels/_watchchannel.py
index 38a82e8a2..c9d3984ee 100644
--- a/bot/exts/moderation/watchchannels/_watchchannel.py
+++ b/bot/exts/moderation/watchchannels/_watchchannel.py
@@ -246,7 +246,7 @@ class WatchChannel(metaclass=CogABCMeta):
await self.webhook_send(
cleaned_content,
username=msg.author.display_name,
- avatar_url=msg.author.avatar.url
+ avatar_url=msg.author.display_avatar.url
)
if msg.attachments:
@@ -260,7 +260,7 @@ class WatchChannel(metaclass=CogABCMeta):
await self.webhook_send(
embed=e,
username=msg.author.display_name,
- avatar_url=msg.author.avatar.url
+ avatar_url=msg.author.display_avatar.url
)
except discord.HTTPException as exc:
self.log.exception(
@@ -297,7 +297,7 @@ class WatchChannel(metaclass=CogABCMeta):
embed = Embed(description=f"{msg.author.mention} {message_jump}")
embed.set_footer(text=textwrap.shorten(footer, width=256, placeholder="..."))
- await self.webhook_send(embed=embed, username=msg.author.display_name, avatar_url=msg.author.avatar.url)
+ await self.webhook_send(embed=embed, username=msg.author.display_name, avatar_url=msg.author.display_avatar.url)
async def list_watched_users(
self, ctx: Context, oldest_first: bool = False, update_cache: bool = True
diff --git a/bot/utils/messages.py b/bot/utils/messages.py
index 913dd72d4..f4aef7eb3 100644
--- a/bot/utils/messages.py
+++ b/bot/utils/messages.py
@@ -121,7 +121,7 @@ async def send_attachments(
"""
webhook_send_kwargs = {
'username': message.author.display_name,
- 'avatar_url': message.author.avatar.url,
+ 'avatar_url': message.author.display_avatar.url,
}
webhook_send_kwargs.update(kwargs)
webhook_send_kwargs['username'] = sub_clyde(webhook_send_kwargs['username'])
diff --git a/tests/bot/exts/filters/test_token_remover.py b/tests/bot/exts/filters/test_token_remover.py
index 47aae97c4..ed6c77c4a 100644
--- a/tests/bot/exts/filters/test_token_remover.py
+++ b/tests/bot/exts/filters/test_token_remover.py
@@ -26,7 +26,7 @@ class TokenRemoverTests(unittest.IsolatedAsyncioTestCase):
self.msg.guild.get_member.return_value.bot = False
self.msg.guild.get_member.return_value.__str__.return_value = "Woody"
self.msg.author.__str__ = MagicMock(return_value=self.msg.author.name)
- self.msg.author.avatar.url = "picture-lemon.png"
+ self.msg.author.display_avatar.url = "picture-lemon.png"
def test_extract_user_id_valid(self):
"""Should consider user IDs valid if they decode into an integer ID."""
@@ -375,7 +375,7 @@ class TokenRemoverTests(unittest.IsolatedAsyncioTestCase):
colour=Colour(constants.Colours.soft_red),
title="Token removed!",
text=log_msg + "\n" + userid_log_message,
- thumbnail=self.msg.author.avatar.url,
+ thumbnail=self.msg.author.display_avatar.url,
channel_id=constants.Channels.mod_alerts,
ping_everyone=True,
)
diff --git a/tests/bot/exts/info/test_information.py b/tests/bot/exts/info/test_information.py
index 2e992c13b..4b50c3fd9 100644
--- a/tests/bot/exts/info/test_information.py
+++ b/tests/bot/exts/info/test_information.py
@@ -435,7 +435,7 @@ class UserEmbedTests(unittest.IsolatedAsyncioTestCase):
ctx = helpers.MockContext()
user = helpers.MockMember(id=217, colour=0)
- user.avatar.url = "avatar url"
+ user.display_avatar.url = "avatar url"
embed = await self.cog.create_user_embed(ctx, user)
self.assertEqual(embed.thumbnail.url, "avatar url")