How would I create a list of admins, and then create a command that would list all admins and link their twitches?
Like, if I have Admin1 Admin2 Admin3, I need to have a command that links to twitches of Admins1,2 and 3. But if I wanted to add an Admin4, I’d like a list that !admins would draw from so I could add to the list.
Is it 4 admins? or were you planning on adding more? I’m thinking that response from Nightbot is gonna get pretty long, bordering on not being able to get it out.
Also I think in order for your !editcom command to work you would have to copy all that came before the new addition.
I’m not 100% sure but I think the best bet would be to recycle the Quote system.
So I’m not sure if this would help you, and it’s probably messy as hell as I’m just getting used to things but: !addcom !admin $(eval var wrong = ["Wrong! $(querystring)"]; var correct = ["twitch.com/$(querystring)"]; '$(querystring)'.trim() == 'Billy' ? (correct) : '$(querystring)'.trim() == 'Bob' ? (correct) : (wrong);)
When you type !admin something, the command will compare your query (something) to “Billy” and “Bob”. If you didn’t type Billy or Bob, it will return “Wrong! query” – But if you do type “Billy” or “Bob” it will return “twitch.tv/query”.
You could change the “correct” output to maybe a Twitch URL, and the “admin” person’s name would get filled out thanks to the “query”.
TL;DR:
If you type !admin Dave, but Dave is not an admin, the command will spit out "Wrong!"
If you type !admin Billy or Bob, it will spit out a twitch.tv/Billy or Bob
It would save you on number of commands, and by having the twitch.tv/ portion of the URL be a variable’s output you save yourself on having to type down the URL for each entry. Although having to do the .trim portion per “Admin” is just as bad lol. Maybe someone can make it tidier?
Edit with the final finished example: !addcom !admin $(eval var w = ["Admin not found."]; var c = ["$(twitch $(query))"]; '$(query)' == 'billy' || '$(query)' == 'bob' ? (c) : (w);)
That’s quite the elegant solution. I can’t think of a better phrasing! Perhaps there’s a way to create an !addadmin such that the trim string gains an additional slot with new admins?
I think doing it just by using commands and no external help, you would have to use !editcom to edit the contents of the command, and so it wouldn’t be just a matter of adding one more .trim string, it would be a matter of having to add the entire code all over + the extra bits.
Again you may wanna wait and hear from someone with more experience than me, hell wouldn’t take much to know more than me lol… And the whole problem with editing and adding to the command is that eventually the command would get too big to even function, unless we found a way to make my example tidier; you’d still eventually reach a limit but it would at least give you far more room for more names.
I managed to make the command a little tidier using OR instead of blatantly copy pasting an entire thing over (though I’m sure there must be a way to make it even shorter), and using query instead of querystring, because there’s no spaces in Twitch names anyway! so that’s quite a few characters saved that could go towards an extra user lol:
!addcom !admin $(eval var wrong = ["Admin not found."]; var correct = [$(twitch $(query))]; '$(query)'.trim() == 'Billy' || '$(query)'.trim() == 'Bob' ? (correct) : (wrong);)
I don’t personally use Twitch so not 100% sure if that $(twitch) bit has the correct formatting, but that should result in: !adminanyone but Billy or Bob: Admin not found. !adminBillyorBob: http://www.twitch.tv/Billy or Bob
Edit with the final finished example: !addcom !admin $(eval var w = ["Admin not found."]; var c = ["$(twitch $(query))"]; '$(query)' == 'billy' || '$(query)' == 'bob' ? (c) : (w);)
That looks neater mate! This’ll be a great start. I don’t know how many of us have individual twitches, but I can always make !admins1 and !admins2 if there are too many of us! Thank you so much, it really is greatly appreciated!
You’re very welcome Always glad to be able to help when I’ve gotten a ton of help from people around here!
As an added note, if you want to save up on even more characters, you could always shorten the variables (wrong / correct) to something like w and c (everywhere you see wrong you replace it with w, then the same with correct).
Lastly, as I understand it Javascript is case sensitive, so if you define an “admin” in that command like Billy or Bob, that’s exactly how users will have to type it out as well, with the first letter also in capitals. So it may be a good idea to make the names fully lowercase? Up to you really!
Edit: And testing the command on Discord right now… I’m not even sure you need the .trim bit lol…
Example with all 3 changes applied: !addcom !admin $(eval var w = ["Admin not found."]; var c = ["$(twitch $(query))"]; '$(query)' == 'billy' || '$(query)' == 'bob' ? (c) : (w);)
Woops! Now it works!
I edited the last example. It was missing the quotation marks around $(twitch $(query)).
Good news is the formatting is okay You may be able to make Nightbot’s response to the “Correct” output shorter by further formatting that $(twitch) variable, but that’s only going to consume extra precious characters so I wouldn’t bother
I wish I could like that more than once bud! I may have to edit it for Twitch usage, but that’ll only cost maybe 5 characters at the most, and this way I can get this thing working far far easier than I would’ve thought! You’ve really helped out, thank you so much