Hi, I am trying to build a command and I am having problems with pastebin giving error, what am I doing wrong?
the command is $(eval var pregunta="$(query)"·.toLowerCase(); $(urlfetch json [https://pastebin.com/raw/Ag7eBp2j]))
I don’t have time to teach you Javascript so I’ll just fix it for you, but please learn the proper syntax:
$(eval var pregunta = "$(query)".toLowerCase(); $(urlfetch json https://pastebin.com/raw/Ag7eBp2j))
and for the content of your Pastebin:
if (pregunta.includes("méxico")) {
"4pm y 7pm México 🇲🇽";
} else if (pregunta.includes("españa")) {
"11pm y 2am España 🇪🇸";
} else if (pregunta.includes("argentina")) {
"7pm y 10pm Argentina 🇦🇷";
} else if(pregunta.includes("bolivia")) {
"6pm y 9pm Bolivia 🇧🇴";
} else if (pregunta.includes("chile")) {
"7pm y 10pm Chile 🇨🇱";
} else if (pregunta.includes("uruguay")) {
"7pm y 10pm Uruguay 🇺🇾";
} else if (pregunta.includes("ecuadro")) {
"5pm y 8pm Ecuador 🇪🇨";
} else if (pregunta.includes("peru")) {
"5pm y 8pm Perú 🇵🇪";
} else if (pregunta.includes("paraguay")) {
"pm y 10pm Paraguay 🇵🇾";
} else if (pregunta.includes("venezuela")) {
"6pm y 9pm Venezuela 🇻🇪";
} else if (pregunta.includes("usa")) {
"5pm y 8pm USA (New York) 🇺🇸";
} else if (pregunta.includes("panamá")) {
"5pm y 8pm Panamá 🇵🇦";
} else if (pregunta.includes("salvador")) {
"4pm y 7pm El Salvador 🇸🇻";
} else if (pregunta.includes(" ")) {
"escribe tu país/ciudad luego del comando";
} else {
"«";
}
or if you want something cleaner and more efficient you can use a switch:
switch (pregunta) {
case 'méxico':
"4pm y 7pm México 🇲🇽";
break;
case 'españa':
"11pm y 2am España 🇪🇸";
break;
case 'argentina':
"7pm y 10pm Argentina 🇦🇷";
break;
case 'bolivia':
"6pm y 9pm Bolivia 🇧🇴";
break;
case 'chile':
"7pm y 10pm Chile 🇨🇱";
break;
case 'uruguay':
"7pm y 10pm Uruguay 🇺🇾";
break;
case 'ecuadro':
"5pm y 8pm Ecuador 🇪🇨";
break;
case 'peru':
"5pm y 8pm Perú 🇵🇪";
break;
case 'paraguay':
"pm y 10pm Paraguay 🇵🇾";
break;
case 'venezuela':
"6pm y 9pm Venezuela 🇻🇪";
break;
case 'usa':
"5pm y 8pm USA (New York) 🇺🇸";
break;
case 'panamá':
"5pm y 8pm Panamá 🇵🇦";
break;
case 'salvador':
"4pm y 7pm El Salvador 🇸🇻";
break;
case '':
"escribe tu país/ciudad luego del comando";
break;
default:
"«";
}
However, I want to congratulate you, because I seem to remember you were asking us to create a command for you, and you tried by yourself!
Hi @Emily! thank you very much for your time and taking the trouble to fix the command. I really appreciate it. It worked perfectly! I’m trying to learn how to create the commands, it’s a bit complicated but I’m going to get it.