Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Commit 5cebc68

Browse files
committed
Fixed avatar_url and icon_url
1 parent 2c1acfa commit 5cebc68

File tree

11 files changed

+24
-25
lines changed

11 files changed

+24
-25
lines changed

general/news/cog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ async def news_send(
143143

144144
content = ""
145145
send_embed = Embed(title=t.news, description=message, colour=Colors.News)
146-
send_embed.set_footer(text=t.sent_by(ctx.author, ctx.author.id), icon_url=ctx.author.avatar_url)
146+
send_embed.set_footer(text=t.sent_by(ctx.author, ctx.author.id), icon_url=ctx.author.display_avatar.url)
147147

148148
if authorization.notification_role_id is not None:
149149
role: Optional[Role] = ctx.guild.get_role(authorization.notification_role_id)

general/polls/cog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ async def send_poll(
5454
raise CommandError(t.option_too_long(EmbedLimits.FIELD_VALUE))
5555

5656
embed = Embed(title=title, description=question, color=Colors.Polls, timestamp=utcnow())
57-
embed.set_author(name=str(ctx.author), icon_url=ctx.author.avatar_url)
57+
embed.set_author(name=str(ctx.author), icon_url=ctx.author.display_avatar.url)
5858
if allow_delete:
59-
embed.set_footer(text=t.created_by(ctx.author, ctx.author.id), icon_url=ctx.author.avatar_url)
59+
embed.set_footer(text=t.created_by(ctx.author, ctx.author.id), icon_url=ctx.author.display_avatar.url)
6060

6161
if len(set(map(lambda x: x.emoji, options))) < len(options):
6262
raise CommandError(t.option_duplicated)
@@ -217,7 +217,7 @@ async def team_yesno(self, ctx: Context, *, text: str):
217217
"""
218218

219219
embed = Embed(title=t.team_poll, description=text, color=Colors.Polls, timestamp=utcnow())
220-
embed.set_author(name=str(ctx.author), icon_url=ctx.author.avatar_url)
220+
embed.set_author(name=str(ctx.author), icon_url=ctx.author.display_avatar.url)
221221

222222
embed.add_field(name=tg.status, value=await self.get_reacted_teamlers(), inline=False)
223223

general/utils/cog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async def encode(self, ctx: Context, *, user: UserMemberConverter):
7474
user: Union[User, Member]
7575

7676
embed = Embed(color=Colors.Utils)
77-
embed.set_author(name=str(user), icon_url=user.avatar_url)
77+
embed.set_author(name=str(user), icon_url=user.display_avatar.url)
7878
embed.add_field(name=t.username, value=str(user.name.encode())[2:-1], inline=False)
7979
if isinstance(user, Member) and user.nick:
8080
embed.add_field(name=t.nickname, value=str(user.nick.encode())[2:-1], inline=False)

information/server_info/cog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ async def server(self, ctx: Context):
3535

3636
guild: Guild = ctx.guild
3737
embed = Embed(title=guild.name, description=t.info_description, color=Colors.ServerInformation)
38-
embed.set_thumbnail(url=guild.icon_url)
38+
if guild.icon:
39+
embed.set_thumbnail(url=guild.icon.url)
3940
created = guild.created_at.date()
4041
embed.add_field(name=t.creation_date, value=f"{created.day}.{created.month}.{created.year}")
4142
online_count = sum([m.status != Status.offline for m in guild.members])

information/user_info/cog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ async def userinfo(self, ctx: Context, user: Optional[Union[User, int]] = None):
219219
if isinstance(user, int):
220220
embed.set_author(name=str(user))
221221
else:
222-
embed.set_author(name=f"{user} ({user_id})", icon_url=user.avatar_url)
222+
embed.set_author(name=f"{user} ({user_id})", icon_url=user.display_avatar.url)
223223

224224
for response in await get_user_info_entries(user_id):
225225
for name, value in response:
@@ -294,7 +294,7 @@ async def userlogs(self, ctx: Context, user: Optional[Union[User, int]] = None):
294294
if isinstance(user, int):
295295
embed.set_author(name=str(user))
296296
else:
297-
embed.set_author(name=f"{user} ({user_id})", icon_url=user.avatar_url)
297+
embed.set_author(name=f"{user} ({user_id})", icon_url=user.display_avatar.url)
298298
for row in out:
299299
name = row[0].strftime("%d.%m.%Y %H:%M:%S")
300300
value = row[1]

integrations/adventofcode/cog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ async def aoc_user(self, ctx: Context, *, user: Optional[Union[Member, str]]):
336336
progress = f"{completed}/{unlocked} ({full}{completed / unlocked * 100:.1f}%{full})"
337337

338338
embed = Embed(title=f"Advent of Code {AOCConfig.YEAR}", colour=Colors.AdventOfCode)
339-
icon_url = member.avatar_url if member else "https://adventofcode.com/favicon.png"
339+
icon_url = member.display_avatar.url if member else "https://adventofcode.com/favicon.png"
340340
embed.set_author(name=name, icon_url=icon_url)
341341

342342
linked = f"<@{member.id}>" + " (unverified)" * (not link) if member else "Not Linked"

integrations/discordpy_documentation/cog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ async def do_rtfm(ctx: Context, key: str, obj: Optional[str]):
216216

217217
e = discord.Embed(colour=Colors.DiscordPy, title=t.documentation(key.capitalize()))
218218
e.description = "\n".join(f"[`{key}`]({url})" for key, url in matches)
219-
e.set_footer(text=tg.requested_by(ctx.author, ctx.author.id), icon_url=ctx.author.avatar_url)
219+
e.set_footer(text=tg.requested_by(ctx.author, ctx.author.id), icon_url=ctx.author.display_avatar.url)
220220
await reply(ctx, embed=e)
221221

222222

integrations/run_code/cog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ async def run(self, ctx, *, args: str):
7878
if api_result["stderr"] and not api_result["stdout"]:
7979
embed.colour = MaterialColors.error
8080

81-
embed.set_footer(text=tg.requested_by(ctx.author, ctx.author.id), icon_url=ctx.author.avatar_url)
81+
embed.set_footer(text=tg.requested_by(ctx.author, ctx.author.id), icon_url=ctx.author.display_avatar.url)
8282

8383
await send_long_embed(ctx, embed)

moderation/invites/cog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ async def invites_show(self, ctx: Context, *, invite: AllowedServerConverter):
230230
invite_guild = await self.check_invite(invite.code)
231231
if invite_guild is not None:
232232
invite_title = t.invite_link
233-
embed.set_thumbnail(url=invite_guild.guild.icon_url)
233+
if invite_guild.guild.icon:
234+
embed.set_thumbnail(url=invite_guild.guild.icon.url)
234235
else:
235236
invite_title = t.invite_link_expired
236237

moderation/mod/cog.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ async def send_to_changelog_mod(
7575
else:
7676
member_id: int = member.id
7777
member_name: str = str(member)
78-
embed.set_author(name=member_name, icon_url=member.avatar_url)
78+
embed.set_author(name=member_name, icon_url=member.display_avatar.url)
7979

8080
embed.add_field(name=t.log_field.member, value=f"<@{member_id}>", inline=True)
8181
embed.add_field(name=t.log_field.member_id, value=str(member_id), inline=True)
8282

8383
if message:
84-
embed.set_footer(text=str(message.author), icon_url=message.author.avatar_url)
84+
embed.set_footer(text=str(message.author), icon_url=message.author.display_avatar.url)
8585
embed.add_field(
8686
name=t.log_field.channel,
8787
value=t.jump_url(message.channel.mention, message.jump_url),
@@ -307,7 +307,7 @@ async def report(self, ctx: Context, user: UserMemberConverter, *, reason: str):
307307

308308
await Report.create(user.id, str(user), ctx.author.id, reason)
309309
server_embed = Embed(title=t.report, description=t.reported_response, colour=Colors.ModTools)
310-
server_embed.set_author(name=str(user), icon_url=user.avatar_url)
310+
server_embed.set_author(name=str(user), icon_url=user.display_avatar.url)
311311
await reply(ctx, embed=server_embed)
312312
await send_to_changelog_mod(ctx.guild, ctx.message, Colors.report, t.log_reported, user, reason)
313313

@@ -333,7 +333,7 @@ async def warn(self, ctx: Context, user: UserMemberConverter, *, reason: str):
333333
colour=Colors.ModTools,
334334
)
335335
server_embed = Embed(title=t.warn, description=t.warned_response, colour=Colors.ModTools)
336-
server_embed.set_author(name=str(user), icon_url=user.avatar_url)
336+
server_embed.set_author(name=str(user), icon_url=user.display_avatar.url)
337337
try:
338338
await user.send(embed=user_embed)
339339
except (Forbidden, HTTPException):
@@ -383,7 +383,7 @@ async def mute(self, ctx: Context, user: UserMemberConverter, days: DurationConv
383383

384384
user_embed = Embed(title=t.mute, colour=Colors.ModTools)
385385
server_embed = Embed(title=t.mute, description=t.muted_response, colour=Colors.ModTools)
386-
server_embed.set_author(name=str(user), icon_url=user.avatar_url)
386+
server_embed.set_author(name=str(user), icon_url=user.display_avatar.url)
387387

388388
if days is not None:
389389
await Mute.create(user.id, str(user), ctx.author.id, days, reason, bool(active_mutes))
@@ -446,7 +446,7 @@ async def unmute(self, ctx: Context, user: UserMemberConverter, *, reason: str):
446446
raise UserCommandError(user, t.not_muted)
447447

448448
server_embed = Embed(title=t.unmute, description=t.unmuted_response, colour=Colors.ModTools)
449-
server_embed.set_author(name=str(user), icon_url=user.avatar_url)
449+
server_embed.set_author(name=str(user), icon_url=user.display_avatar.url)
450450
await reply(ctx, embed=server_embed)
451451
await send_to_changelog_mod(ctx.guild, ctx.message, Colors.unmute, t.log_unmuted, user, reason)
452452

@@ -479,10 +479,7 @@ async def kick(self, ctx: Context, member: Member, *, reason: str):
479479
colour=Colors.ModTools,
480480
)
481481
server_embed = Embed(title=t.kick, description=t.kicked_response, colour=Colors.ModTools)
482-
server_embed.set_author(
483-
name=str(member),
484-
icon_url=member.avatar_url_as(format=("gif" if member.is_avatar_animated() else "png")),
485-
)
482+
server_embed.set_author(name=str(member), icon_url=member.display_avatar.url)
486483

487484
try:
488485
await member.send(embed=user_embed)
@@ -544,7 +541,7 @@ async def ban(
544541

545542
user_embed = Embed(title=t.ban, colour=Colors.ModTools)
546543
server_embed = Embed(title=t.ban, description=t.banned_response, colour=Colors.ModTools)
547-
server_embed.set_author(name=str(user), icon_url=user.avatar_url)
544+
server_embed.set_author(name=str(user), icon_url=user.display_avatar.url)
548545

549546
if ban_days is not None:
550547
await Ban.create(user.id, str(user), ctx.author.id, ban_days, reason, bool(active_bans))
@@ -611,6 +608,6 @@ async def unban(self, ctx: Context, user: UserMemberConverter, *, reason: str):
611608
raise UserCommandError(user, t.not_banned)
612609

613610
server_embed = Embed(title=t.unban, description=t.unbanned_response, colour=Colors.ModTools)
614-
server_embed.set_author(name=str(user), icon_url=user.avatar_url)
611+
server_embed.set_author(name=str(user), icon_url=user.display_avatar.url)
615612
await reply(ctx, embed=server_embed)
616613
await send_to_changelog_mod(ctx.guild, ctx.message, Colors.unban, t.log_unbanned, user, reason)

0 commit comments

Comments
 (0)