mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 21:53:07 -04:00
- make tts use subcommands
- add moonbase
This commit is contained in:
parent
5c4a02f08f
commit
cc37d5f50b
9 changed files with 87 additions and 32 deletions
11
commands/interaction/slash/tts.js
Normal file
11
commands/interaction/slash/tts.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
module.exports = {
|
||||||
|
description: 'Text to Speech commands',
|
||||||
|
name: 'tts',
|
||||||
|
options: [
|
||||||
|
require('../subcommands/tts/tiktok'),
|
||||||
|
require('../subcommands/tts/microsoft'),
|
||||||
|
require('../subcommands/tts/moonbase'),
|
||||||
|
require('../subcommands/tts/playht'),
|
||||||
|
require('../subcommands/tts/imtranslator')
|
||||||
|
]
|
||||||
|
};
|
|
@ -1,15 +1,16 @@
|
||||||
const { Constants } = require('detritus-client');
|
const { Constants } = require('detritus-client');
|
||||||
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
||||||
|
|
||||||
const { imtranslator } = require('../../../labscore/api');
|
const { imtranslator } = require('../../../../labscore/api');
|
||||||
const { IMTRANSLATOR_VOICES } = require('../../../labscore/constants');
|
const { IMTRANSLATOR_VOICES } = require('../../../../labscore/constants');
|
||||||
|
|
||||||
const { createEmbed } = require('../../../labscore/utils/embed');
|
const { createEmbed } = require('../../../../labscore/utils/embed');
|
||||||
const { icon, highlight } = require('../../../labscore/utils/markdown');
|
const { icon, highlight } = require('../../../../labscore/utils/markdown');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
description: 'Text to Speech',
|
description: 'Text to Speech with imtranslator voices',
|
||||||
name: 'texttospeech',
|
name: 'imtranslator',
|
||||||
|
type: ApplicationCommandOptionTypes.SUB_COMMAND,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'voice',
|
name: 'voice',
|
|
@ -1,15 +1,16 @@
|
||||||
const { Constants } = require('detritus-client');
|
const { Constants } = require('detritus-client');
|
||||||
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
||||||
|
|
||||||
const { sapi4 } = require('../../../labscore/api');
|
const { sapi4 } = require('../../../../labscore/api');
|
||||||
const { MICROSOFT_VOICES, MICROSOFT_VOICE_CONFIG } = require('../../../labscore/constants');
|
const { MICROSOFT_VOICES, MICROSOFT_VOICE_CONFIG } = require('../../../../labscore/constants');
|
||||||
|
|
||||||
const { createEmbed } = require('../../../labscore/utils/embed');
|
const { createEmbed } = require('../../../../labscore/utils/embed');
|
||||||
const { icon, highlight } = require('../../../labscore/utils/markdown');
|
const { icon, highlight } = require('../../../../labscore/utils/markdown');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
description: 'Microsoft Sam Text to Speech',
|
description: 'Text to Speech with microsoft voices',
|
||||||
name: 'mstts',
|
name: 'microsoft',
|
||||||
|
type: ApplicationCommandOptionTypes.SUB_COMMAND,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'voice',
|
name: 'voice',
|
40
commands/interaction/subcommands/tts/moonbase.js
Normal file
40
commands/interaction/subcommands/tts/moonbase.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
const { Constants } = require('detritus-client');
|
||||||
|
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
||||||
|
|
||||||
|
const { moonbase } = require('../../../../labscore/api');
|
||||||
|
|
||||||
|
const { createEmbed } = require('../../../../labscore/utils/embed');
|
||||||
|
const { icon, highlight } = require('../../../../labscore/utils/markdown');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
description: 'Moonbase Alpha text to speech voices',
|
||||||
|
name: 'moonbase',
|
||||||
|
type: ApplicationCommandOptionTypes.SUB_COMMAND,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'text',
|
||||||
|
description: 'Text',
|
||||||
|
type: ApplicationCommandOptionTypes.STRING,
|
||||||
|
required: true,
|
||||||
|
maxLength: 1024
|
||||||
|
}
|
||||||
|
],
|
||||||
|
run: async (context, args) => {
|
||||||
|
try {
|
||||||
|
await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE })
|
||||||
|
|
||||||
|
let audio = await moonbase(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: "moonbase.wav" }
|
||||||
|
})
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
await context.editOrRespond({
|
||||||
|
embeds: [createEmbed("error", context, "Unable to generate audio file.")]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,15 +1,16 @@
|
||||||
const { Constants } = require('detritus-client');
|
const { Constants } = require('detritus-client');
|
||||||
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
||||||
|
|
||||||
const { playht } = require('../../../labscore/api');
|
const { playht } = require('../../../../labscore/api');
|
||||||
const { PLAYHT_VOICES } = require('../../../labscore/constants');
|
const { PLAYHT_VOICES } = require('../../../../labscore/constants');
|
||||||
|
|
||||||
const { createEmbed } = require('../../../labscore/utils/embed');
|
const { createEmbed } = require('../../../../labscore/utils/embed');
|
||||||
const { icon, highlight } = require('../../../labscore/utils/markdown');
|
const { icon, highlight } = require('../../../../labscore/utils/markdown');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
description: 'Text to Speech with different voices',
|
description: 'Text to Speech with playht voices',
|
||||||
name: 'tts2',
|
name: 'playht',
|
||||||
|
type: ApplicationCommandOptionTypes.SUB_COMMAND,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'voice',
|
name: 'voice',
|
|
@ -1,15 +1,16 @@
|
||||||
const { Constants } = require('detritus-client');
|
const { Constants } = require('detritus-client');
|
||||||
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants;
|
||||||
|
|
||||||
const { tiktok } = require('../../../labscore/api');
|
const { tiktok } = require('../../../../labscore/api');
|
||||||
const { TIKTOK_VOICES } = require('../../../labscore/constants');
|
const { TIKTOK_VOICES } = require('../../../../labscore/constants');
|
||||||
|
|
||||||
const { createEmbed } = require('../../../labscore/utils/embed');
|
const { createEmbed } = require('../../../../labscore/utils/embed');
|
||||||
const { icon, highlight } = require('../../../labscore/utils/markdown');
|
const { icon, highlight } = require('../../../../labscore/utils/markdown');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
description: 'TikTok text to speech voices',
|
description: 'TikTok text to speech voices',
|
||||||
name: 'tiktok',
|
name: 'tiktok',
|
||||||
|
type: ApplicationCommandOptionTypes.SUB_COMMAND,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'voice',
|
name: 'voice',
|
|
@ -44,11 +44,11 @@ const Api = Object.freeze({
|
||||||
SEARCH_YOUTUBE: '/search/youtube',
|
SEARCH_YOUTUBE: '/search/youtube',
|
||||||
|
|
||||||
TTS_IMTRANSLATOR: '/tts/imtranslator',
|
TTS_IMTRANSLATOR: '/tts/imtranslator',
|
||||||
|
TTS_MOONBASE: '/tts/moonbase',
|
||||||
TTS_PLAYHT: '/tts/playht',
|
TTS_PLAYHT: '/tts/playht',
|
||||||
TTS_POLLY: '/tts/polly',
|
TTS_POLLY: '/tts/polly',
|
||||||
TTS_SAPI4: '/tts/sapi4',
|
TTS_SAPI4: '/tts/sapi4',
|
||||||
TTS_TIKTOK: '/tts/tiktok',
|
TTS_TIKTOK: '/tts/tiktok'
|
||||||
TTS_VOICEFORGE: '/tts/voiceforge',
|
|
||||||
|
|
||||||
UTILS_EMOJIPEDIA: '/utils/emojipedia',
|
UTILS_EMOJIPEDIA: '/utils/emojipedia',
|
||||||
UTILS_INFERKIT: '/utils/inferkit',
|
UTILS_INFERKIT: '/utils/inferkit',
|
||||||
|
|
|
@ -254,6 +254,12 @@ module.exports.imtranslator = async function(context, text, voice){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.moonbase = async function(context, text){
|
||||||
|
return await request(Api.TTS_MOONBASE, "GET", {}, {
|
||||||
|
text
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
module.exports.playht = async function(context, text, voice){
|
module.exports.playht = async function(context, text, voice){
|
||||||
return await request(Api.TTS_PLAYHT, "GET", {}, {
|
return await request(Api.TTS_PLAYHT, "GET", {}, {
|
||||||
text: text,
|
text: text,
|
||||||
|
@ -284,13 +290,6 @@ module.exports.tiktok = async function(context, text, voice){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.voiceforge = async function(context, text, voice){
|
|
||||||
return await request(Api.TTS_VOICEFORGE, "GET", {}, {
|
|
||||||
text: text,
|
|
||||||
voice: voice
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports.emojipedia = async function(context, emoji){
|
module.exports.emojipedia = async function(context, emoji){
|
||||||
return await request(Api.UTILS_EMOJIPEDIA, "GET", {}, {
|
return await request(Api.UTILS_EMOJIPEDIA, "GET", {}, {
|
||||||
emoji: emoji
|
emoji: emoji
|
||||||
|
|
|
@ -97,6 +97,7 @@ commandClient.on('commandRunError', async ({context, error}) => {
|
||||||
await commandClient.addMultipleIn('../commands/message/');
|
await commandClient.addMultipleIn('../commands/message/');
|
||||||
await commandClient.run()
|
await commandClient.run()
|
||||||
|
|
||||||
await interactionClient.addMultipleIn('../commands/interaction/');
|
await interactionClient.addMultipleIn('../commands/interaction/context');
|
||||||
|
await interactionClient.addMultipleIn('../commands/interaction/slash');
|
||||||
await interactionClient.run();
|
await interactionClient.run();
|
||||||
})();
|
})();
|
Loading…
Add table
Add a link
Reference in a new issue