From 1927c4a6e8b3f69697aa0a436c2bdb8a755c0915 Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Sun, 26 Nov 2023 22:03:27 +0100 Subject: [PATCH] improved tiktok command --- .../interaction/subcommands/tts/tiktok.js | 60 +++------ .../subcommands/tts/tiktok/character.js | 56 ++++++++ .../subcommands/tts/tiktok/french.js | 56 ++++++++ .../subcommands/tts/tiktok/german.js | 56 ++++++++ .../subcommands/tts/tiktok/indonesian.js | 56 ++++++++ .../subcommands/tts/tiktok/italian.js | 56 ++++++++ .../subcommands/tts/tiktok/japanese.js | 56 ++++++++ .../subcommands/tts/tiktok/korean.js | 56 ++++++++ .../subcommands/tts/tiktok/pop-culture.js | 56 ++++++++ .../subcommands/tts/tiktok/portugese.js | 56 ++++++++ .../subcommands/tts/tiktok/song.js | 56 ++++++++ .../subcommands/tts/tiktok/spanish.js | 56 ++++++++ labscore/constants.js | 123 ++++++++++++++++++ 13 files changed, 754 insertions(+), 45 deletions(-) create mode 100644 commands/interaction/subcommands/tts/tiktok/character.js create mode 100644 commands/interaction/subcommands/tts/tiktok/french.js create mode 100644 commands/interaction/subcommands/tts/tiktok/german.js create mode 100644 commands/interaction/subcommands/tts/tiktok/indonesian.js create mode 100644 commands/interaction/subcommands/tts/tiktok/italian.js create mode 100644 commands/interaction/subcommands/tts/tiktok/japanese.js create mode 100644 commands/interaction/subcommands/tts/tiktok/korean.js create mode 100644 commands/interaction/subcommands/tts/tiktok/pop-culture.js create mode 100644 commands/interaction/subcommands/tts/tiktok/portugese.js create mode 100644 commands/interaction/subcommands/tts/tiktok/song.js create mode 100644 commands/interaction/subcommands/tts/tiktok/spanish.js diff --git a/commands/interaction/subcommands/tts/tiktok.js b/commands/interaction/subcommands/tts/tiktok.js index 0ab5a1c..9336dd8 100644 --- a/commands/interaction/subcommands/tts/tiktok.js +++ b/commands/interaction/subcommands/tts/tiktok.js @@ -1,50 +1,20 @@ -const { Constants } = require('detritus-client'); -const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; - -const { tiktok } = require('../../../../labscore/api'); -const { TIKTOK_VOICES } = require('../../../../labscore/constants'); - -const { createEmbed } = require('../../../../labscore/utils/embed'); -const { icon, highlight } = require('../../../../labscore/utils/markdown'); +const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); module.exports = { - description: 'TikTok text to speech voices', + description: 'TikTok Voices', name: 'tiktok', - type: ApplicationCommandOptionTypes.SUB_COMMAND, + type: ApplicationCommandOptionTypes.SUB_COMMAND_GROUP, options: [ - { - name: 'voice', - description: 'TTS Voice to use', - choices: TIKTOK_VOICES, - required: true, - }, - { - name: 'text', - description: 'Text', - type: ApplicationCommandOptionTypes.STRING, - required: true - } - ], - run: async (context, args) => { - try { - await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) - - if(args.text.length >= 101) return await context.editOrRespond({ - embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] - }) - - let audio = await tiktok(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: "tiktok.mp3" } - }) - - } catch (e) { - console.log(e) - await context.editOrRespond({ - embeds: [createEmbed("error", context, "Unable to generate audio file.")] - }) - } - }, + require('./tiktok/character'), + require('./tiktok/pop-culture'), + require('./tiktok/song'), + require('./tiktok/french'), + require('./tiktok/japanese'), + require('./tiktok/german'), + require('./tiktok/spanish'), + require('./tiktok/italian'), + require('./tiktok/korean'), + require('./tiktok/portugese'), + require('./tiktok/indonesian') + ] }; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/character.js b/commands/interaction/subcommands/tts/tiktok/character.js new file mode 100644 index 0000000..ff0fe7b --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/character.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_CHARACTERS } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_CHARACTERS)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_CHARACTERS[k] +}) + +module.exports = { + description: 'Voices of TikTok Characters.', + name: 'character', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/french.js b/commands/interaction/subcommands/tts/tiktok/french.js new file mode 100644 index 0000000..b962e76 --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/french.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_FRENCH } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_FRENCH)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_FRENCH[k] +}) + +module.exports = { + description: 'Voices from French TikTok Characters.', + name: 'french', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/german.js b/commands/interaction/subcommands/tts/tiktok/german.js new file mode 100644 index 0000000..d1652ff --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/german.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_GERMAN } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_GERMAN)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_GERMAN[k] +}) + +module.exports = { + description: 'Voices from German TikTok Characters.', + name: 'german', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/indonesian.js b/commands/interaction/subcommands/tts/tiktok/indonesian.js new file mode 100644 index 0000000..16af237 --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/indonesian.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_INDONESIAN } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_INDONESIAN)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_INDONESIAN[k] +}) + +module.exports = { + description: 'Voices of Indonesian TikTok Characters.', + name: 'indonesian', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/italian.js b/commands/interaction/subcommands/tts/tiktok/italian.js new file mode 100644 index 0000000..72f76ea --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/italian.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_ITALIAN } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_ITALIAN)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_ITALIAN[k] +}) + +module.exports = { + description: 'Voices of Italian TikTok Characters.', + name: 'italian', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/japanese.js b/commands/interaction/subcommands/tts/tiktok/japanese.js new file mode 100644 index 0000000..28d53d6 --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/japanese.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_JAPANESE } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_JAPANESE)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_JAPANESE[k] +}) + +module.exports = { + description: 'Voices from Japanese TikTok Characters.', + name: 'japanese', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/korean.js b/commands/interaction/subcommands/tts/tiktok/korean.js new file mode 100644 index 0000000..d4ecafb --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/korean.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_KOREAN } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_KOREAN)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_KOREAN[k] +}) + +module.exports = { + description: 'Voices of Korean TikTok Characters.', + name: 'korean', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/pop-culture.js b/commands/interaction/subcommands/tts/tiktok/pop-culture.js new file mode 100644 index 0000000..0b87e82 --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/pop-culture.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_POP_CULTURE } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_POP_CULTURE)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_POP_CULTURE[k] +}) + +module.exports = { + description: 'Voices of Pop Culture Characters.', + name: 'pop-culture', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true, + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/portugese.js b/commands/interaction/subcommands/tts/tiktok/portugese.js new file mode 100644 index 0000000..80195d8 --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/portugese.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_PORTUGESE } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_PORTUGESE)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_PORTUGESE[k] +}) + +module.exports = { + description: 'Voices of Portugese TikTok Characters.', + name: 'portugese', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/song.js b/commands/interaction/subcommands/tts/tiktok/song.js new file mode 100644 index 0000000..82bb2ce --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/song.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_SONG } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_SONG)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_SONG[k] +}) + +module.exports = { + description: 'Voices that sing songs.', + name: 'song', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true, + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/commands/interaction/subcommands/tts/tiktok/spanish.js b/commands/interaction/subcommands/tts/tiktok/spanish.js new file mode 100644 index 0000000..26c65a2 --- /dev/null +++ b/commands/interaction/subcommands/tts/tiktok/spanish.js @@ -0,0 +1,56 @@ +const { Constants } = require('detritus-client'); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; + +const { tiktok } = require('../../../../../labscore/api'); + +const { createEmbed } = require('../../../../../labscore/utils/embed'); +const { icon, highlight } = require('../../../../../labscore/utils/markdown'); +const { TIKTOK_VOICES_SPANISH } = require('../../../../../labscore/constants'); + +let voices = [] +for(const k of Object.keys(TIKTOK_VOICES_SPANISH)) voices.unshift({ + value: k, + name: TIKTOK_VOICES_SPANISH[k] +}) + +module.exports = { + description: 'Voices of Spanish TikTok Characters.', + name: 'spanish', + type: ApplicationCommandOptionTypes.SUB_COMMAND, + options: [ + { + name: 'text', + description: 'Text', + type: ApplicationCommandOptionTypes.STRING, + required: true + }, + { + name: 'voice', + description: 'Voice to use', + choices: voices, + required: true + } + ], + run: async (context, args) => { + try { + await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE }) + + if(args.text.length >= 101) return await context.editOrRespond({ + embeds: [createEmbed("warning", context, "Text too long (must be 100 or shorter).")] + }) + + let audio = await tiktok(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: "tiktok.mp3" } + }) + + } catch (e) { + console.log(e) + await context.editOrRespond({ + embeds: [createEmbed("error", context, "Unable to generate audio file.")] + }) + } + }, +}; \ No newline at end of file diff --git a/labscore/constants.js b/labscore/constants.js index 00c91c8..9836339 100644 --- a/labscore/constants.js +++ b/labscore/constants.js @@ -308,6 +308,129 @@ module.exports.GUILD_FEATURES = Object.freeze({ "TICKETING_ENABLED": { icon: GUILD_FEATURE_ICONS.TICKET } }) +module.exports.TIKTOK_VOICES_FRENCH = { + "fr_001": "French Male 1", + "fr_002": "French Male 2" +} + +module.exports.TIKTOK_VOICES_GERMAN = { + "de_001": "German Female", + "de_002": "German Male" +} + +module.exports.TIKTOK_VOICES_INDONESIAN = { + "id_male_darma": "Darma", + "id_female_icha": "Icha", + "id_female_noor": "Noor", + "id_male_putra": "Putra" +} + +module.exports.TIKTOK_VOICES_ITALIAN = { + "it_male_m18": "Italian Male" +} + +module.exports.TIKTOK_VOICES_JAPANESE = { + "jp_001": "Miho (美穂)", + "jp_003": "Keiko (恵子)", + "jp_005": "Sakura (さくら)", + "jp_006": "Naoki (直樹)", + "jp_male_osada": "モリスケ (Morisuke)", + "jp_male_matsuo": "モジャオ (Matsuo)", + "jp_female_machikoriiita": "まちこりーた (Machikoriiita)", + "jp_male_matsudake": " マツダ家の日常 (Matsudake)", + "jp_male_shuichiro": "修一朗 (Shuichiro)", + "jp_female_rei": "丸山礼 (Maruyama Rei)", + "jp_male_hikakin": "ヒカキン (Hikakin)", + "jp_female_yagishaki": "八木沙季 (Yagi Saki)", +} + +module.exports.TIKTOK_VOICES_KOREAN = { + "kr_002": "Korean Male 1", + "kr_004": "Korean Male 2", + "kr_003": "Korean Female" +} + +module.exports.TIKTOK_VOICES_PORTUGESE = { + "br_003": "Júlia", + "br_004": "Ana", + "br_005": "Lucas", + "pt_female_lhays": "Lhays Macedo", + "pt_female_laizza": "Laizza", +} + +module.exports.TIKTOK_VOICES_SPANISH = { + "es_002": "Spanish Male", + "es_male_m3": "Julio", + "es_female_f6": "Alejandra", + "es_female_pb1": "Mariana", + "es_mx_002": "Álex (Warm)", + "es_mx_female_supermom": "Super Mamá", +} + +module.exports.TIKTOK_VOICES_SONG = { + "en_male_m2_xhxs_m03_silly": "Song: Quirky Time", + "en_female_f08_twinkle": "Song: Pop Lullaby", + "en_male_m03_sunshine_soon": "Song: Toon Beat (Sunshine Soon)", + "en_male_sing_funny_thanksgiving": "Song: Thanksgiving", + "en_female_ht_f08_newyear": "Song: NYE 2023", + "en_female_ht_f08_wonderful_world": "Song: Melodrama (Wonderful World)", + "en_male_m03_lobby": "Song: Jingle (Lobby)", + "en_male_sing_funny_it_goes_up": "Song: Hypetrain (It Goes Up)", + "en_female_ht_f08_glorious": "Song: Euphoric (Glorious)", + "en_female_ht_f08_halloween": "Song: Opera (Halloween)", + "en_female_f08_warmy_breeze": "Song: Open Mic (Warmy Breeze)", + "en_male_m2_xhxs_m03_christmas": "Song: Cozy", + "en_female_f08_salut_damour": "Song: Cottagecore (Salut d'Amour)", + "en_male_m03_classical": "Song: Classic Electric", + "en_male_sing_deep_jingle": "Song: Caroler", +} + +module.exports.TIKTOK_VOICES_POP_CULTURE = { + "en_female_madam_leota": "Madame Leota (Haunted Mansion)", + "en_us_rocket": "Rocket (Guardians of the Galaxy)", + "en_us_stitch": "Stitch (Lilo & Stitch)", + "en_us_stormtrooper": "Stormtrooper (Star Wars)", + "en_us_c3po": "C-3PO (Star Wars)", + "en_us_chewbacca": "Chewbacca (Star Wars)", + "en_us_ghostface": "Ghostface (Scream)", + "en_male_grinch": "Trickster (Grinch)", + "en_male_ghosthost": "Ghost Host", + "en_male_ukbutler": "Mr. Meticulous", + "en_male_deadpool": "Mr. GoodGuy (Deadpool)", +//"en_male_petercullen": "Optimus Prime", +} + +module.exports.TIKTOK_VOICES_CHARACTERS = { + "en_female_pansino": "Varsity", +//"en_male_santa_effect": "Santa (w/ effect)", + "en_male_santa": "Santa", + "en_male_pirate": "Pirate", + "en_male_trevor": "Marty", + "en_male_wizard": "Magician", + "en_male_ukneighbor": "Lord Cringe", + "en_female_grandma": "Grandma", + "en_female_shenna": "Debutante", + "en_male_cupid": "Cupid", +//"en_female_richgirl": "Bestie", + "en_female_makeup": "Beauty Guru", + "en_female_betty": "Bae", +//"en_male_santa_narration": "Author", + "en_male_jarvis": "Alfred", + "en_male_funny": "Wacky", + "en_male_narration": "Story Teller", + "en_male_cody": "Serious", + "en_female_samc": "Empathetic", + "en_us_010": "Confidence", + "en_us_009": "Scientist", + "en_us_007": "Professor", + "en_us_006": "Joey", + "en_us_002": "Jessie", + "en_au_002": "Smooth (Alex)", + "en_au_001": "Metro (Eddie)", + "en_female_emotional": "Peaceful", + "en_uk_001": "Narrator (Chris)", +} + module.exports.TIKTOK_VOICES = [ { name: "English Singing - Tenor", value: "en_male_m03_lobby" }, { name: "English Singing - Alto", value: "en_female_f08_salut_damour" },