mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-18 10:57:05 -04:00
interaction command client interaction command client interaction command client interaction command client interaction command client interaction command client interaction command client interaction command client interaction command client interaction command client
This commit is contained in:
parent
7395d7d096
commit
0196471203
4 changed files with 148 additions and 3 deletions
43
commands/interaction/tts/tiktok.js
Normal file
43
commands/interaction/tts/tiktok.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
const { Constants } = require('detritus-client');
|
||||
const { tiktok } = require('../../../labscore/api');
|
||||
const { TIKTOK_VOICES } = require('../../../labscore/constants');
|
||||
const { createEmbed } = require('../../../labscore/utils/embed');
|
||||
const { icon } = require('../../../labscore/utils/markdown');
|
||||
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
||||
|
||||
module.exports = {
|
||||
description: 'tiktok audio',
|
||||
name: 'tiktok',
|
||||
options: [
|
||||
{
|
||||
name: 'voice',
|
||||
description: 'TTS Voice to use',
|
||||
choices: TIKTOK_VOICES,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'text',
|
||||
description: '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 tiktok(context, args.text, args.voice)
|
||||
|
||||
await context.editOrRespond({
|
||||
embeds: [createEmbed("default", context, { description: `${icon("audio")} Audio Generated in ${audio.timings}` })],
|
||||
file: { value: audio.response.body, filename: "tiktok.mp3" }
|
||||
})
|
||||
|
||||
} catch (e) {
|
||||
await context.editOrRespond({
|
||||
embeds: [createEmbed("error", context, "Unable to generate audio file.")]
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue