mirror of
https://github.com/Xevion/unbelievaselfbot.git
synced 2025-12-06 05:16:57 -06:00
helper method for matching bot embeds to users, improve helper method docs/formatting
This commit is contained in:
@@ -54,7 +54,7 @@ class UnbelievaClient(discord.Client):
|
||||
|
||||
if message.author.id == self.bot_id and len(message.embeds) > 0:
|
||||
embed = message.embeds[0]
|
||||
is_self = embed.author.name == f'{self.user.name}#{self.user.discriminator}'
|
||||
is_self = helpers.embed_author_matches(embed, self.user)
|
||||
|
||||
if is_self:
|
||||
if parsers.TaskCooldownMessage.check_valid(message):
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
from pprint import pprint
|
||||
from typing import Union
|
||||
|
||||
import discord
|
||||
|
||||
|
||||
def print_embed(embed: discord.Embed) -> None:
|
||||
pprint((
|
||||
embed.title,
|
||||
embed.description,
|
||||
embed.footer,
|
||||
embed.color,
|
||||
embed.fields,
|
||||
embed.author,
|
||||
embed.timestamp
|
||||
))
|
||||
"""Helper method for printing out a complex Embed's entire set of possible attributes."""
|
||||
pprint((embed.title, embed.description, embed.footer, embed.color, embed.fields, embed.author, embed.timestamp))
|
||||
|
||||
|
||||
def embed_author_matches(embed: discord.Embed, user: Union[discord.User, discord.ClientUser]):
|
||||
"""Returns if the Unbelievabot Embed relates to the given user."""
|
||||
return embed.author != discord.embeds.EmptyEmbed and embed.author.name == f'{user.name}#{user.discriminator}'
|
||||
|
||||
Reference in New Issue
Block a user