Hayo, Roketto here. Welcome to my domain.


I wrote up a couple of fun scripts here that you can use in Nightbot commands. There will be more scripts posted here as I relearn PHP (and CSS; this home page looks like garbage). For now, though, my scripts are nothing too complex, like saying "Hello" to the command user, determining the length of a given phrase, and calculating the determinant of a 3x3 matrix. Very simple stuff... hold up.


Hello.php - Says "Hello" (among other possible greetings) to the command user. A tad useless since this can be achieved via the Nightbot $(user) variable, but this was a good way to practice using URL parameters and Nightbot request headers. By the way, because the script gets the command user from Nightbot's request header, it won't work if you try running the script in your browser. I mean, I can't actually stop you from trying that, but you'll see what happens...

$(urlfetch https://rokbot.xyz/hello.php)


Length.php - Determines the length of a given phrase. You can, of course, do the same thing quite easily with the JS string.length property in Nightbot's $(eval) variable, but I bet that one thing my script has that 50% of the other schmucks don't have in their scripts is error handling. Take that.

$(urlfetch https://rokbot.xyz/length.php?query=$(querystring))


Det.php - Calculates the determinant of a 3x3 matrix. You might know what a matrix is, but as for the determinant, it's too much of a mathy concept to explain what it means here; you're better off just Googling it. Anyways, here's the script.

$(urlfetch https://rokbot.xyz/det.php?query=$(querystring))


SMM.php - Make Nightbot send multiple messages to your Twitch or Discord chat! The i parameter is the delay in seconds and the d parameter is whether to delay the second message or not.

$(urlfetch https://rokbot.xyz/smm.php?msg=MESSAGE_1`MESSAGE_2`MESSAGE_3`MESSAGE_4`MESSAGE_5`MESSAGE_6&i=INTERVAL&d=0_OR_1)


DiscordMsg.php - Send a message to your Discord server as a bot! WEBHOOK_URL is your Discord webhook, MESSAGE is your message to send, USERNAME is the bot username, PICTURE_URL is the picture you want for the bot avatar, enter true or false for tts, and SUCCESS_MESSAGE is the message for Nightbot to post when it successfully sends a message.

$(urlfetch https://rokbot.xyz/discordMsg.php?url=WEBHOOK_URL&content=MESSAGE&username=USERNAME&avatar_url=PICTURE_URL&tts=TRUE_OR_FALSE&success_msg=SUCCESS_MESSAGE)


YTSubs.php - Get a YouTube channel's subscriber count. CHANNEL_ID is the channel's ID, not its username.

$(urlfetch https://rokbot.xyz/ytsubs.php?id=CHANNEL_ID)