vendredi 30 juin 2017

JavaScript if-Statement; when true it should play a sound

So im working on a twitch bot in JS, for now he connects with the chat and can recognize a command (like !twitter), but when someone writes !sound it should play a sound but I always see solutions with HTML and it should only work with JS and the Twitch Chat and run on my local PC. ( Sorry for bad english, its not my native language). Does someone has a solution or a advice for me?

var tmi = require('tmi.js');

var options = {
        options: {
                debug: true
        },
        connection: {
                cluster: "aws",
                reconnect: true
        },
        identity: {
                username: "",
                password: ""
        },
        channels: ["DiggnC"]
};
var client = new tmi.client(options);
client.connect();

// Connect Message in der Console
client.on('connected', function(adress, port){
console.log("Adresse: " + adress + " Port: " + port);
client.say("DiggnC", "Der Bot ist nun mit dem Stream verbunden!");
});

client.on('chat', function(channel, user, message, self) {
  if(message == "!twitter"){
    client.say("DiggnC", "Mein Twitter: https://twitter.com/thetruemitello")}
});

// Abfrage für Sound im Stream
client.on('chat', function(channel, user, message, self) {
  if(message =="!testsound"){
    client.say("DiggnC", "Dies ist eine Testausgabe zur Funktionalität der Audioausgabe");
    //Here it should play the sound on my local PC
  }
});

Aucun commentaire:

Enregistrer un commentaire