Skip to content
Discussion options

You must be logged in to vote

Your second code is closer to what you want to do, however the check function is wrong. There is no such thing as discord.mentions and taking the str out of it makes little sense.

Messages have a Message.mentions attribute that allow you to get the members being mentioned in the message. So a simple way of doing it is just checking if they mentioned one person like so:

def check(message):
    return message.author == ctx.author and len(message.mentions) == 1 and message.mentions[0] != ctx.author

This check predicate checks whether there was a mention and also makes sure that the person mentioned isn't the person using the command.

There is another issue in your second code and that's the …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Martyn0324
Comment options

@Rapptz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants