Discord.py Detect Message In Embed Title Or Description
I am currently trying to make an 'Anti Selfbot' Bot. I would like to do something good for the Discord Community. Therefore, I have tried to make an on_message event that can detec
Solution 1:
The below checks the title, description, footer, and fields of the embeds in a message for some text
from discord import Embed
def message_contains(message, text):
return text in message.content or any(embed_contains(embed, text) for embed in message.embeds)
def embed_contains(embed, text):
return (text in embed.title
or text in embed.description
or (embed.footer.text and text in embed.footer.text)
or (any(text in field.name or text in field.value for field in embed.fields))
)
Post a Comment for "Discord.py Detect Message In Embed Title Or Description"