Closed Shmuppel closed 3 years ago
I'll look into it ASAP !
To clarify on what's happening, here is the problem:
# Member / Client with username
mention = '<@!...>'
discord.util.get(guild.members, mention=mention) # returns the user
# Member / Client without username
mention = '<@!...>'
discord.util.get(guild.members, mention=mention) # does not return the user, expects <@...>
This goes visa versa for clients with usernames being mentioned by <@..>
the get comparison expects <@!..>
I've now changed it so it retrieves the user id after the member_mention pattern is matched, after which I use discord.util.get(guild.members, id=...) instead.
Makes sense. It may also be possible to make the member_mention pattern better, if that's the one we're defining
Yeah the mention pattern allows <@! and <@ which makes sense.
e.g. using <@! the discord client and discord.py mention the user when sending a message whether they have a nickname or not, its just that discord.util.get specifically compares the mention pattern
Not sure how to improve this pattern though! The current pattern r"<@!?[0-9]{17,21}>"
seems fine to me when you're considering how people will be using <@! and <@ interchangeably
@CraftSpider is it okay to merge ?
Yeah, this looks okay to me
Bot clients are not being added as a member to the guilds, because of this when you mention the bot user discord.util.get returns null
Reproduction:
Will cascade into:
Which will return
[None]
.This PR contains a simple fix that adds the bot client to any guilds that are initialised with runner.configure