discord-jellyfin-bot/src/interactivemsghandler.js

34 lines
720 B
JavaScript
Raw Normal View History

2020-09-25 13:11:13 +02:00
const InterActivePlayMessage = require("./InterActivePlayMessage");
var iapm;
function init (message, title, artist, imageURL, itemURL, getProgress, onPrevious, onPausePlay, onStop, onNext, onRepeat) {
if (typeof iapm !== "undefined") {
destroy();
}
iapm = new InterActivePlayMessage(message, title, artist, imageURL, itemURL, getProgress, onPrevious, onPausePlay, onStop, onNext, onRepeat);
}
function destroy () {
if (typeof iapm !== "undefined") {
iapm.destroy();
iapm = undefined;
} else {
throw Error("No Interactive Message Found");
}
}
function hasMessage () {
if (typeof iapm === "undefined") {
return false;
} else {
return true;
}
}
module.exports = {
init,
destroy,
hasMessage
};