mirror of
https://github.com/Xevion/unbelievaselfbot.git
synced 2025-12-09 06:08:58 -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:
|
if message.author.id == self.bot_id and len(message.embeds) > 0:
|
||||||
embed = 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 is_self:
|
||||||
if parsers.TaskCooldownMessage.check_valid(message):
|
if parsers.TaskCooldownMessage.check_valid(message):
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
|
|
||||||
def print_embed(embed: discord.Embed) -> None:
|
def print_embed(embed: discord.Embed) -> None:
|
||||||
pprint((
|
"""Helper method for printing out a complex Embed's entire set of possible attributes."""
|
||||||
embed.title,
|
pprint((embed.title, embed.description, embed.footer, embed.color, embed.fields, embed.author, embed.timestamp))
|
||||||
embed.description,
|
|
||||||
embed.footer,
|
|
||||||
embed.color,
|
def embed_author_matches(embed: discord.Embed, user: Union[discord.User, discord.ClientUser]):
|
||||||
embed.fields,
|
"""Returns if the Unbelievabot Embed relates to the given user."""
|
||||||
embed.author,
|
return embed.author != discord.embeds.EmptyEmbed and embed.author.name == f'{user.name}#{user.discriminator}'
|
||||||
embed.timestamp
|
|
||||||
))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user