Learn Japanese (or another language) On Stream? Command

Hey guys,

I’m looking to make a command that I could set to a timer that would pull a random Japanese Kanji character, with Romanji pronunciation and meaning for all the weebs on the platform.

Hypothetically this could by done by pulling from a Japanese API that returns a Json response to Nightbot. However, I’m both having problems finding an API that would do this, and also the exact implementation on this.

Anyone with more knowledge have any insight?

Hey @NotZelda!

I’m not aware of any API that could provide that service, however, what you can do is fill a paste on Pastebin: create an account so you can edit the paste in the future, and make sure to set the expiration date to never.

The paste should be filled like this:

JAPANESE_KANJI_CHARACTER_1|
JAPANESE_KANJI_CHARACTER_2|
JAPANESE_KANJI_CHARACTER_3|
...
LAST_JAPANESE_KANJI_CHARACTER

Notice how every line ends with a | (vertical bar), except for the last one that doesn’t need it, replace JAPANESE_KANJI_CHARACTER with your text, but make sure each character presentation doesn’t go above 500 characters, and that you don’t use the | (vertical bar) in the text anywhere else than at the end of the presentation.

Then use the following code in the Timer:

$(eval c=`$(urlfetch json https://pastebin.com/raw/XXXXXXXX)`.split(`|`); c[Math.floor(Math.random()*c.length)])

Replace XXXXXXXX in the command by your paste ID.

Note: if you need to use the | (vertical bar) in your characters descriptions, then replace the one at the end of every description with another character you won’t use, and replace it inside the .split(`|`) as well.

This is perfect! I had no idea that you could utilize a service like this so easily!

This opens up so many possibilities for unique responses. Just off the top of my head, a !compliment command that allows people to compliment others with premade compliments or better yet a !roast command with just a list different premade roasts for nightbot to call from.

You have drastically improved my chatbot with teaching me this. Thank you!

1 Like

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