问题
Using discord.py, how would i check how much messages a user has sent in a specific channel, and then for example every week, the bot will send a message for how much messages a user has sent for example, if i sent 30 messages in "#test" in a week, when the week ends it will send "@User has sent: 30 messages in #test".
I'm not sure what to try.
All I have setup is my bot with:
@client.event
async def on_message(message):
no errors
回答1:
Look at the discord.py documentation.
You can use:
counter = 0
async for message in channel.history():
if message.author == client.user:
counter += 1
or something similar. More details are in the documentation.
来源:https://stackoverflow.com/questions/57540536/using-discord-py-how-would-i-check-how-much-messages-a-user-has-sent-in-a-speci