Arguments Issue
.
So looks like inside the
if the user is null because sapphire is taking it like the third argument I think, how can I fix this?13 Replies
Please share the full command code as well as the command message used
that's the full code, the things I didn't show are stuff like the command name, description, aliases, etc
wdym command message
It looks like you are picking the first argument as a user, then later picking the second argument as a member. My guess is you should pick a member first and then use
args.rest to get the reson. That sould give you a command stucture like prefix command targetedMember reason with spaceswdym pick a member first
Use
args.pick("member") right after your args.finished check and use the result of that for determining if they have manageMessages privileges in the perms checknow the
if(!user) will always get returned since im currently testing with a guildmember!command arg1 arg2 arg3 thing, what you sent in DiscordAre you trying to make it so you can ban someone who's not in the guild?
>b userid testing ban command
yes
this code should detect if the user that is getting banned is in the guild, if it is, it will check his permissionsah I didn't realize that. In that case, keep it as picking a user at the top and then in the perms check, instead of picking a member, you should fetch the member from the guild's members cache. Whenever you call
args.pick it advances to read the next argument. Since your calling it twice, its expecting you to have specified the same user twice, once as a user, and again as a member.yeah I think that worked, gonna test a little bit more
looks like it worked, ty
@_carlos123 FWIW I was under the impression there would be more code above the
args.finished because I didnt think that would be at the top
ergo my initial questionoh alright