#Add utils like `GuildMember.bannableBy(member)`
35 messages · Page 1 of 1 (latest)
deprecation notice can be added in minor releases but by semver, it can only be removed in a major version (v15)
Ok. Tbh I don't strictly follow semver but do whatever feels like the best approach. But yeah they can do that in this version and remove it going into the next one.
Yeah we can add a deprecation warning and remove it in v15. I am currently on holiday, if no one opens a pr before, I can do it as soon as i get back
<GuildMember>.bannableBy() sounds worse than <GuildMember>.bannable when it comes to if they can be banned by the bot. bannableBy should always have a parameter, else the name of the method would be wrong. You have to tell by whom if it is named -By
So you suggest keeping the getter?
yeah i think it should be kept
The getter can internally just call bannableBy(guild.members.me) though to not write redundant code
Yeah that's the idea
yeah this sounds like a good thing
Working on this rn. Do you think the method should throw an error if the member is not cached or just return false?
oh nvm, I see that similar methods just return a falsy value so I guess I'll do the same
would that be really correct 

orientate yourself on the other methods
Mmh yeah but I'm seeing that some of them throws an "uncached me" error while others just return a falsy value. I'll search more and see whether keeping one or the other
I would throw instead
If your client is uncached in a guild and you're checking a permission that returns a falsey value that you are definitely sure is true, that could trip you up
That's my thoughts on the matter
So, we have getters such as GuildMember#bannable, GuildChannel#manageable etc... that check if the client can ban a member, manage a channel and so on. I think it would be fantastic to have something like GuildMember#bannableBy(member) that check if a member is bannable by another one, check if a member can manage a channel, etc... It could replace the getters and have the member option that defaults to the client or they could be just added alongside them.
From what i know, the library is shifting away from such utility methods unfortunately and rather recommends the user to make those themselves as top level functions
Yeah but since utils like .bannable are already present, having something like bannableBy() wouldn't require so much...
Something like bannableBy is probably reasonable since there's a lot of checks there. I don't see one being created for "member can manage a channel" - since that would be a single channel.permissionsFor(user).has("MANAGE_CHANNELS")
that makes sense
Mmh yeah I see
Btw, do you think it should be created apart from the present getter or, as I said in the description, with the member parameter optional that defaults to the client?
Yeah, I meant to keep the getter or not
I guess the getter could essentially just re-use that new function
.bannable could be replaced by bannableBy() without any params. So if no member param is specified, it would return if the member is bannable by the client.