mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 22:53:06 -04:00
new tts funny gauzi voice
This commit is contained in:
parent
1b6597ed43
commit
6097695561
4 changed files with 59 additions and 0 deletions
44
commands/interaction/tts/texttospeech2.js
Normal file
44
commands/interaction/tts/texttospeech2.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
const { Constants } = require('detritus-client');
|
||||
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
||||
|
||||
const { playht } = require('../../../labscore/api');
|
||||
const { PLAYHT_VOICES } = require('../../../labscore/constants');
|
||||
|
||||
const { createEmbed } = require('../../../labscore/utils/embed');
|
||||
const { icon, highlight } = require('../../../labscore/utils/markdown');
|
||||
|
||||
module.exports = {
|
||||
description: 'more text to speech',
|
||||
name: 'tts2',
|
||||
options: [
|
||||
{
|
||||
name: 'voice',
|
||||
description: 'Voice to use',
|
||||
choices: PLAYHT_VOICES,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'text',
|
||||
description: 'Spoken Text',
|
||||
type: ApplicationCommandOptionTypes.STRING,
|
||||
required: true,
|
||||
maxLength: 256
|
||||
}
|
||||
],
|
||||
run: async (context, args) => {
|
||||
try{
|
||||
await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE})
|
||||
let audio = await playht(context, args.text, args.voice)
|
||||
|
||||
await context.editOrRespond({
|
||||
embeds: [createEmbed("defaultNoFooter", context, { description: `${icon("audio")} Audio Generated in ${highlight(audio.timings + "s")}.` })],
|
||||
file: { value: audio.response.body, filename: "tts.wav" }
|
||||
})
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
await context.editOrRespond({
|
||||
embeds: [createEmbed("error", context, "Unable to generate audio file.")]
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue