Twitch bot that plays sounds

Hello!

I followed this tutorial on how to make a Twitch bot: Glitch.
I got it working just fine, but I would like to expand on it by enabling it to play sounds according to text commands.

What I tried was adding the sound file to the assets folder, and then I put a variable in the .js file pointing to its link:
const soundEffect = ‘https://cdn.glitch.com/therestofthelink’;

I also tried to make a function that plays the sound effect:
function playSound () {
const audio = new Audio(soundEffect);
audio.play();
};

However, I get an error saying that Audio is not defined. To me this sounds like I’m missing a library to play sound effects, but more accurately it just shows a fundamental lack of undestanding in coding for web. I only have experience in programming offline applications. Could anyone give me some pointers on how to approach this?

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