Reputation: 1
I want to know if there's any way in discord.py to check for every message sent by a user and get the bot to look for every occurrence of a specific word or list of words and return the number of occurrences.
Upvotes: 0
Views: 4679
Reputation: 15689
There is actually, using the channel.history
method, pass a check function that will check if the message is sent by the user, here's an example
def check(message):
return message.author.id == some_author_id
messages = await channel.history(limit=100, check=check).flatten()
# Now you have 100 messages sent by a user
# You can now iterate through every message and check whatever you want
Upvotes: 1