Need help learning to use Twitch API

Hi all. I'm trying to make my own twitch chatbot in the spirit of Linux DIY'ing and masochism; having my own bot's name is waaaaay cooler than a common bot with user-friendly UIs and their plethora of engaging and powerful features, apparently.

TL;DR: How do I min-max learning how to translate the Twitch API documentation for Node.JS? Exact questions at the bottom.

My progress so far on July 9, 2023:
I set up a bot successfully using this article but with tweaks: https://www.section.io/engineering-education/build-a-twitch-chatbot-in-nodejs/
Archive .org capture here: https://web.archive.org/web/20230000000000*/https://www.section.io/engineering-education/build-a-twitch-chatbot-in-nodejs/

Changes:

  • Skipped the streamyard stuff because, who cares, I have OBS
  • I added identity tags under the connection configurations because I kept getting errors in my terminal that my bot couldn't write to chat anonymously (I've never seen anonymous chatting, why the hell is this in the suggested code). Connection config section of the .js file now looks like this:

const client = new tmi.Client({
options: { debug: true, messagesLogLevel: "info" },
connection: {
reconnect: true,
secure: true
},
identity: {
username: ${process.env.TWITCH_USERNAME},
password: oauth:${process.env.TWITCH_OAUTH}
},
channels: [${process.env.TWITCH_CHANNEL}]
});`

  • Kind of nested (is that the right word?) in the switch section, I removed the entire "Upvote" and "Cheers" shenanigans because, for some reason with the suggested code in the article, it replied like "FireEmoji unknown_user unknown_user, you have been upvoted!" to every single line of chat, lmao. The bot would reply to "Watsup dorks" with something like "FiReEmOji @Watsup dorks, you have been upvoted!".
  • Also kind of nested in the switch section, I added the random number generator example given in other people's tutorials around the internet and formatted it similarly to the article's method of checking messages like so:

// When user enters "!rolldice" in chat, bot returns random number between 1 and 20.
case '!rolldice':
client.say(channel, ${tags.username} rolled a ${Math.floor(Math.random()*20)+1}!);
break;

If you would like me to revisit that article's suggested code as-is and be more specific with my errors encountered, I'd be happy to oblidge upon request.

Questions I hope to answer someday:
How do I get my bot to see if a message has a hyperlink, then delete that message?
How do I set up a whitelist database of usernames for my bot to reference so they could post whatever links?
How do I get my bot to timeout people who have entered trigger words in chat?
How do I get my bot to change other chatters' name colors in chat?
What is the next best source of internet community I can go to for advice on Twitch API use? (It's July 2023 at the moment, and giving Reddit traffic to learn to make moderator bots is, IMO, a bit ironic). How can I learn to translate the Twitch API commands to javascript like this? Is there a library that can tell me in close-to-plain-english that explains things like "client.say() means this, this is how you can use it, and X things must be specified in these brackets for client.say" etc.?