Spongebob Text converter

As a minimally experienced C#'er without much nuanced javascript knowledge beyond slamming shit together till it works, I think this might be slightly beyond my fruitless smacking attempts.

I’m trying to make a command that takes the $(query) and alternates capitalizing to do some light mocking. BaSiCaLlY jUsT tHiS MeMe BuT WiTh WhAtEvEr SoMeOnE eLsE sAiD.

This is where I’m at, problem might be something silly formatted, or something just isn’t doable by nightbot. At any rate if there’s any thoughts or enlightening knowledge that can be bestowed I would be very grateful.

Currently receiving an “Unexpected Identifier” error

$(eval message=` `;
newMessage=` `;
for (int i = 0; i < input.length; i++)
if ((i%2)==0){message+= input.charAt(i).toUpperCase();}
else{message+= input.charAt(i).toLowerCase();}

Hey @siralmao!

Luckily for you, I already have such command around, here’s the code I use:

let q=decodeURIComponent(`$(querystring)`).toLowerCase().split(``);
`:clap: ${q.join(``).replace(/ /g,` :clap: `)} :clap:`;

Ready to copy/paste for Nightbot:

$(eval q=decodeURIComponent(`$(querystring)`).toLowerCase().split(``);for(i=0;i<q.length;i++){q[i]=(i+1)%2==0?q[i].toUpperCase():q[i];}`:clap: ${q.join(``).replace(/ /g,` :clap: `)} :clap:`;)

In the command I replace spaces with a :clap:, if you want to remove it, simply change the last line of code from `:clap: ${q.join(``).replace(/ /g,` :clap: `)} :clap:`; to q.join(``).

oh terrific, works like a charm! I added some things, and now Nightbot will successfully occasionally sass people who make “I” statements.

    $(eval q=decodeURIComponent(`I $(querystring)`).toLowerCase().split(``);
     for(i=0;i<q.length;i++) {q[i]=(i+1)%2==0?q[i].toUpperCase():q[i];}
    `$(query)`.includes(``) ? responses = [q.join(``),` `,` `,` `,` `,` `,` `,` `] : responses = [` `] ;
 responses[Math.floor(Math.random() * responses.length)];)
1 Like

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