Merge pull request #468 from miaowware/embed-avatar

Embed factory/pycord fixes
This commit is contained in:
0x5c 2023-01-28 23:41:01 -05:00 committed by GitHub
commit 44a6905f7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] ## [Unreleased]
### Fixed
- Issue where embeds would not work for users without avatars (#467).
- Issue where embeds would show the wrong timezone.
## [2.9.0] - 2023-01-13 ## [2.9.0] - 2023-01-13

View File

@ -12,7 +12,7 @@ import enum
import json import json
import re import re
import traceback import traceback
from datetime import datetime from datetime import datetime, timezone
from pathlib import Path from pathlib import Path
from types import SimpleNamespace from types import SimpleNamespace
from typing import Union from typing import Union
@ -165,9 +165,9 @@ class GlobalChannelConverter(commands.IDConverter):
def embed_factory(ctx: commands.Context) -> discord.Embed: def embed_factory(ctx: commands.Context) -> discord.Embed:
"""Creates an embed with neutral colour and standard footer.""" """Creates an embed with neutral colour and standard footer."""
embed = discord.Embed(timestamp=datetime.utcnow(), colour=colours.neutral) embed = discord.Embed(timestamp=datetime.now(timezone.utc), colour=colours.neutral)
if ctx.author: if ctx.author:
embed.set_footer(text=str(ctx.author), icon_url=str(ctx.author.avatar.url)) embed.set_footer(text=str(ctx.author), icon_url=str(ctx.author.display_avatar))
return embed return embed