So basically in discord.py I wanted to try to prank one of my friends by deleting every message they send. I thought the code would of been simple enough to make but apparently not.
if message.author.id == ("198562028556648448"):
await message.delete()
CodePudding user response:
According to the Discord API Reference, the message author ID is of type int.
It's likely this is the issue, because you can easily demonstrate the non-equivalence of an integer with its string representation in the Python shell:
>>> 198562028556648448 == "198562028556648448"
False
You should therefore perform your test as follows:
if message.author.id == 198562028556648448:
Happy pranking.
