NightDev Community Forums

I would like to make a command that adds an item onto a list of items

I am trying to write a command that adds an item onto a list of items. I have tried multiple methods of varying complexity and have always hit some sort of snag with the command structure, is there an easy way to do this or at least does someone have a way that has made it work? I am trying to avoid just copy pasting the current list into an editcom every time.

Hey @paintinmyeye!

You can use ehsankia’s quote system for this.

That is a very good system, however I would like to be able to play the list in chat instead of it going out to another website, what I want is less of a behind the scenes list to pull from, and more of a command that displays the total list, and a command that can add on to the list without overwriting it every time. If this is possible through that quote system and I misunderstood I’m sorry I’m pretty new to nightbot commands.

This is definitely possible through the qoute system. If you urlfetch the qoute list with no_id=1 I will just display the total list. If you need help with writing the command feel free to say so. But I’ll need to know if you want it all in one command or multiple.

1 Like

I would like to have one command that only moderators can use to add to the list, and one anybody can use to display the whole list. Thank you very much

Yeah, so here’s how it’d work:
Moderators’ command:
Add it from the dashboard, make sure to set the userlevel as Moderator. Don’t use the chat as anyone could monitor it and copy the PRIVATE_TOKEN, they could then edit your data.


Everyone’s command:

!addcom !list $(eval u=`$(urlfetch json`.split(`,`);u.pop();`List of items: ${u.join(`, `)}. Consult the full list here:`})

Or if you get too many items that it reaches more than 400 characters, I can recommend picking items at random from the list, in this example you’ll get 10 items, 9 at random, the 10th being the last entered item. If you want more items, feel free to replace the 9 in the for loop with another number:

!addcom !list $(eval u=`$(urlfetch json`.split(`,`);u.pop();t=u.length;s=[];l=u.pop();for(i=0;i<9;i++){s.push(u.splice(Math.floor(Math.random()*u.length),1));}`Here's a small selection of the items in the list: ${s.join(`, `)}, and ${l}. Total: ${t} items. Consult the full list here:`})

You’ll get your TOKENS by clicking on the second link in the quote system API post, in the Manual Installation section, use these in the commands I wrote. To know where to look for your PUBLIC_TOKEN and PRIVATE_TOKEN, look at the field bellow:


Keep your PRIVATE_TOKEN secret, don’t share it anywhere. Add the following commands from the dashboard. Don’t use the chat as anyone could monitor it and copy the token, they could then edit your data.


Wow, thanks very much, this will be very helpful.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.