Browse Source

tts: nicer gifts, ignore URLs

master
vampirefrog 1 year ago
parent
commit
8b578c4b85
  1. 26
      static/tts.js

26
static/tts.js

@ -340,6 +340,21 @@ function handleMessage(data) { @@ -340,6 +340,21 @@ function handleMessage(data) {
});
}
} else {
var content = [];
content.push('gifted ' + data.amount + '×' + data.giftType);
if(data.icon) {
content.push({
type: 'image',
src: data.icon,
alt: data.giftType,
size: 'small',
class: 'emote'
});
}
if(data.message) {
content.push({ type: 'br' });
content.push(data.message);
}
appendChat({
id: data.id,
avatar: data.avatar,
@ -350,11 +365,7 @@ function handleMessage(data) { @@ -350,11 +365,7 @@ function handleMessage(data) {
sound: config.sounds.default,
speak: data.message,
image: images,
content: [
'gifted ' + data.amount + '×' + data.giftType,
{ type: 'br' },
data.message
]
content: content
});
}
break;
@ -481,6 +492,9 @@ function handleMessage(data) { @@ -481,6 +492,9 @@ function handleMessage(data) {
]
});
break;
case 'url':
// ignore URLs for TTS
break;
default:
console.log(data);
break;
@ -513,7 +527,7 @@ function initWebsocket() { @@ -513,7 +527,7 @@ function initWebsocket() {
console.error('Could not parse JSON', ev.data, e);
}
if(data)
if(data && data.type != 'url')
handleMessage(data);
};
}

Loading…
Cancel
Save