receiving dynamic arguments

im attempting to create a command that has a messageRun implementation. the command should be able to take multiple members and then a duration to timeout the members for. for example, something like @bot timeout @member @member @member 12d this would result in the bot timing out every member for 12 days. but what if i wanted to do something more dynamic like having a custom duration for some members? for example, something like @bot timeout @member 12d @member 1h @member @member @member 2d would result in the bot timing out the first member for 12 days, the second for 1 hour and the other 3 for 2 days. is this possible within sapphire? if so, how can I implement something like this?
9 Replies
Favna
Favna2mo ago
I.. dont think so
beetle
beetleOP2mo ago
would something like that ever become a possibility? and would there not be a way to do what im saying through some kind of custom argument either?
Favna
Favna2mo ago
Gosh uhm I don't think natively but come to think of it I think it might be possible through pick and catch / pickResult and handle errors and then for every argument check if it's a member or a time. just not with rest / restResult
beetle
beetleOP2mo ago
ill mess around with that then, thanks
spac3crawler
spac3crawler2mo ago
theoretically you could make an argument that consists of a (loose) GuildMember, and a string seperated by a space and then use .rest with that "argument" (technically 2 different arguments combined) i honestly have no clue if its even possible though, but theres probably someone who would know how to do something like this
beetle
beetleOP2mo ago
potentially I could make some kind of "PartialActionArgument" that takes in a string (that really consists of a member, duration and then reason), but i have no idea how i would parse that, since member is loose as you mentioned and reason can have spaces inside it which messes up the seperation concept. maybe id need to have an actual seperator and then use some kind of lexer on the "string" parameter of the argument
Favna
Favna2mo ago
if your string param can have spaces the way the user enters it as 1 param is "between quotes"
beetle
beetleOP2mo ago
you mean like the partial would be member duration "reason"? that way i can encapsulate a reason with spaces inside it?
Favna
Favna2mo ago
yes !command "param one" paramtwo 'param three with many words'

Did you find this page helpful?