Creating an Editable Command

Asked Sep 30, 2025·6 replies·Last activity 10 months ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hi, I’m trying to create a command that will allow me to change the daily “Coffee Concoction” without editing the command in nightbot every stream. I was thinking I could have it connect to a pastebin, but I’m not quite sure how to do that, and also not sure on how to make it cycle between streams. Is this possible?

6 replies

Hello, I think it is possible to do what you are looking for but before that I would like to know how that “*Daily coffee preparation*” would work, if you want it randomly from a list of options or if you have, for example: Monday Coffee; Tuesday Cappuccino; Wednesday Tea; etc

Thanks for helping! I would want it to be specific options for specific days. I would probably be going into the paste bin and editing the options for the week, but I would rather not have to edit the command for each day of stream if I don’t have to, because I fear I might forget before stream.

Hi,

You can get the day using Nightbot’s variable Time, and then get the data from pastebin using json and query the day.

In a very basic way could be like:

javascript
$(eval day=`$(time YOURTIMEZONE "dddd")`; data=$(urlfetch json YOUR_RAW_PASTEBIN_URL); `${day}'s special coffee is: `+data[day])

The Pastebin formatted as:

json
{
"Monday": "Mocaccino",
"Tuesday": "Latte",
"Wednesday": "Americano",
"Thursday": "Cappuccino",
"Friday": "Espresso",
"Saturday": "Machiato",
"Sunday": "Affogato"
}

Command can be more elaborated to validate the query is not null/empty.

But overall in this way you don’t need to modify your command every day.

Hope this help. :upside_down_face:

I attempted to make this work, but am getting an error when testing. Here is my command (the forum wouldn’t allow me to post the whole pastebin link together so there are spaces here that are not in the command)

$(eval day=$(time US/Central "dddd"); data=$(urlfetch json https:// pastebin .com/XbFF9Gvi); \`🔮 The Cauldron bubbles… tonight’s special is:’ +data\[day\])

and here is the error I keep getting

Unexpected token ‘<’ \[:1:22\]

I’ve played around with the command a bit but have been unable to make it work 😕

Hi,

I checked your file, end each line of key and values in the pastebin with a comma instead of semicolon, the last entry should not have a comma.

For the command make sure the string start and end with the same symbol, and use the raw link of the pastebin, otherwise will give you an error.

javascript
$(eval day=`$(time US/Central "dddd")`; data=$(urlfetch json https://pastebin.com/raw/XbFF9Gvi); `🔮 The Cauldron bubbles… tonight's special is: `+data[day])

Thank you so much! ❤️ That fixed it.

Didn't find your answer? The community is on Discord.

Ask on Discord