Hey,
Briefly, I wanna create a command callled ‘!bowling’ and i want nightbot to respond two messages in a row. First respond is ‘message1’ and second respond to activate another command (!bowling2). I don’t have that much knowledge about alias and i wanted to ask here.
Here is full explanation and you guys can get my intention:
viewer: !bowling
nightbot(message1): $(user) →
nightbot(message2): !bowling2
!bowling2 is:
$(eval var simgeler = [“”, “”]; var sonuc = “”; for (var i = 0; i < 5; i++) { sonuc += simgeler[Math.floor(Math.random() * simgeler.length)] + " "; } sonuc)
this image explains what nightbot should respond with 2 messages.
An alias isn’t what you’re looking for, because with an alias, the output of the first command (if any) is sent to the second command to be processed (if needed), the second command’s output overrides the first command’s output, the first command’s output is not sent to chat; instead what you have to use is the API @tiwosslave provided, and to answer their question, yes, you can use $(eval) with it, like this:
$(urlfetch https://vxrl.xyz/smm/$(eval '%F0%9F%8E%B3'.repeat(5))/$(eval const icons = ['%F0%9F%92%A5', '%F0%9F%8E%B3']; let output = ''; for (let i = 0; i < 5; i++) { output += icons[Math.floor(Math.random() * icons.length)]; } output)?i=5000&d=1)
The key to make it work is to encode the emojis into their URL code, otherwise the API sends an error:
%F0%9F%8E%B3
%F0%9F%92%A5
We could also have used an alias here, by computing the output first, and then sending it to the API:
$(eval const icons = ['🎳', '💥']; let output = `${icons[0].repeat(5)}/`; for (let i = 0; i < 5; i++) { output += icons[Math.floor(Math.random() * icons.length)]; } encodeURI(output))
$(urlfetch https://vxrl.xyz/smm/$(query)?i=5000&d=1)