fix: misc checks / changes
This commit is contained in:
@@ -9,6 +9,8 @@ import { DataTypes } from 'sequelize';
|
||||
import { config } from '../../utils/config';
|
||||
import { DatabaseManager } from '../../modules/db';
|
||||
|
||||
import * as fs from 'fs';
|
||||
|
||||
const URL_REGEX = /(?:https?|ftp):\/\/[\n\S]+/g;
|
||||
const DISCORD_REGEX = /<(?::\w+:|@!*&*|#)[0-9]+>/g; // from: https://www.reddit.com/r/discordapp/comments/iibxms/if_anyone_needs_regex_to_match_an_emote_mention/
|
||||
|
||||
@@ -74,13 +76,24 @@ class TTSListener implements Command {
|
||||
if (msgFiltered.length === 0) return;
|
||||
|
||||
const audio = await ttsModule.generate(voiceName, msgFiltered);
|
||||
if (!audio) {
|
||||
this.log.error("TTS generation didn't return anything");
|
||||
return;
|
||||
}
|
||||
|
||||
if (audio?.data) {
|
||||
if (audio.data) {
|
||||
const stream =
|
||||
AudioStreamManager.get.getOrCreateStream(voiceConnection);
|
||||
const queue = stream.getQueue('TTS');
|
||||
queue.enqueue(Readable.from(audio.data));
|
||||
}
|
||||
|
||||
if (audio.error) {
|
||||
this.log.error(
|
||||
'Error occurred while generating message: (%s)',
|
||||
audio.error
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
this.log.error('Error occurred while processing TTS message (%s)', err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user