0
votes

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 detect if an Embed contains 'selfbot', which would cause the message to get deleted and for the user to be banned.

I have already begun making my bot. However, I am not sure how to read the content of an Embed.

if 'selfbot' in message.content:
    # do some stuff here

So, basically, the only problem I am having at the moment would be reading the embed title or description content.

1
I believe what you are looking for is to see if a user sent an embed. Only bots are able to send embeds unless you are using some type of hacked/modified client (Which is still against discord's TOS). So if a user has sent an embed, they would get banned. You also need to check and make sure the user isn't a bot (An actual bot not a selfbot) Or else you might end up banning your trusty dank memer. - Frederick Reynolds
Just to clarify, how will finding "selfbot" in someone's message verify that they are selfbotting? Are you trying to find out if a user account sent an embed? - Axiumin_
I don't think anyone would put "selfbot" in their embed when they are selfbotting - stijndcl

1 Answers

1
votes

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))
         )