def add_author_footer(embed: discord.Embed, author: Union[discord.User, discord.Member], set_timestamp=True, additional_text: Union[Iterable[str], None] = None): if set_timestamp: embed.timestamp = datetime.now(tz=timezone.utc) if additional_text is not None: embed.set_footer(icon_url=author.display_avatar.url, text=' | '.join((str(author), *additional_text))) else: embed.set_footer(icon_url=author.display_avatar.url, text=str(author)) return embed
def add_author_footer(embed: disnake.Embed, author: disnake.User, set_timestamp=True, additional_text: Iterable[str] = []): """ Adds footer to the embed with author name and icon from ctx. :param author: author info :param embed: disnake.Embed object :param set_timestamp: bool, should the embed's timestamp be set :param additional_text: Iterable of strings that will be joined with author name by pipe symbol, eg.: "john#2121 | text1 | text2". """ if set_timestamp: embed.timestamp = datetime.now(tz=timezone.utc) embed.set_footer(icon_url=author.display_avatar.url, text=' | '.join((str(author), *additional_text)))