moonstar-x / discord-tts-bot Goto Github PK
View Code? Open in Web Editor NEWA Text-to-Speech bot for Discord.
Home Page: https://docs.moonstar-x.dev/discord-tts-bot
License: MIT License
A Text-to-Speech bot for Discord.
Home Page: https://docs.moonstar-x.dev/discord-tts-bot
License: MIT License
Hello there, I have been using this bot for quite a long while and it was running smoothly for me and my friend who is unable to speak.
But recently the bot is having the problem of get key failed from google which I try to look up for solution but all I can find is tell me to npm update
I tried it a few times but it also happen quite often, so I would like to ask if there is any method to fix this issue other than npm update.
Slash commands for the bot are not appearing
Followed procedure (Updated from V3 to v4.0.2)
Expected slash commands to work
The normal junk when starting the bot. Nothing about the user sending a command
Paste a screenshot of the bug (if applicable).
16.13.2
Bot crashes when trying to send a log message out for leaving due to inactivity
- Turn bot on, and say a message
- Do not send any other message for the duration of your inactivity timer
- The bot will crash.
Expected bot to leave without crashing.
C:\PathName\discord-tts-bot\src\classes\tts\TTSPlayer.js:44
logger.warn(`Left ${channel.name} from ${this.guild.name} due to inactivity.`);
^
TypeError: Cannot read properties of null (reading 'name')
at Scheduler.fn (D:\My Files\Desktop\Software Stuff\Software\Github\discord-tts-bot\src\classes\tts\TTSPlayer.js:44:35)
at Timeout.<anonymous> (D:\My Files\Desktop\Software Stuff\Software\Github\discord-tts-bot\src\classes\Scheduler.js:21:12)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
[process exited with code 1] (Ignore this, it's a windows terminal thing.)
v16.13.2
You cannot have both a custom speed and a custom language at the same time. This also applies to every other provider with more than two settings, none of which currently exist.
- /google_set_my language fr
- /my_settings, see language french, speed normal
- /google_set_my speed slow
- /my_settings, see language english, speed slow
Language French, speed slow.
Voice dispatch ends too soon, some tts messages are cut right at the end
For some reason the bot doesn't remember when the bot is inside a channel, the stop
command doesn't work and everytime the say
command is done, the bot always responds with joined channel
message response.
Whenever I try to start the Bot, the following error message appears:
`> [email protected] start /home/ubuntu/TTSBot/discord-tts-bot
node ./src/app.js
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '@discordjs/form-data'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/home/ubuntu/TTSBot/discord-tts-bot/node_modules/discord.js/src/rest/APIRequest.js:4:18)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node ./src/app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2020-06-07T17_40_59_743Z-debug.log
ubuntu@ubuntu:~/TTSBot/discord-tts-bot/config$ npm start
[email protected] start /home/ubuntu/TTSBot/discord-tts-bot
node ./src/app.js
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '@discordjs/form-data'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/home/ubuntu/TTSBot/discord-tts-bot/node_modules/discord.js/src/rest/APIRequest.js:4:18)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node ./src/app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2020-06-07T17_44_34_382Z-debug.log
`
Originally posted by thenewgessiko June 16, 2022
Hi, but in the discors tts bot, it is possible to have written who uses the commands / say / amazon_say etc ... and what was written?
Hi. I noticed that whenever someone pings another user, it plays their User ID instead of just saying their name? Is there any way to prevent this?
No other additional information.
Sometimes it is hard to write prefix and say then the text .
just add alliances for say like ( $s [text] )
The site https://ttstool.com/ exposes a public API to use with some voices from Microsoft and Amazon engines. I think maybe the Amazon ones would be duplicate as specified in #71, however this tool supports SSML and some options for volume, pitch, and rate.
To request this API, send a POST to:
https://support.readaloud.app/ttstool/createParts
With a body shaped like this:
[{
"voiceId": "Amazon Polish (Ewa)",
"ssml": "<speak version=\"1.0\" xml:lang=\"pl-PL\"><prosody volume='x-loud' rate='x-fast' pitch='x-high'>yeah</prosody></speak>"
}]
This returns a an JSON array with the IDs of the voices. You can technically pass in multiple items to the previous array to get multiple TTS streams in the same request. The response looks like this:
[
"efh7l3ll"
]
You can then use this ID in a GET request like this:
https://support.readaloud.app/ttstool/getParts?q=efh7l3ll
This returns an audio/mpeg
stream.
Refactor so it can work on multiple servers.
I believe Ivona is a precursor to Amazon Polly.
Their site contains a demo functionality that exposes a public API to generate mp3 stream links.
A recopilation of the available languages and voices needs to be done, however, one can consume the API by making a request to:
https://nextup.com/ivona/php/nextup-polly/CreateSpeech/CreateSpeechGet3.php
And pass in the appropriate voice
, language
and text
query parameters. This returns an HTML body with the URL of the generated mp3 stream.
2020-07-10T18:25:39.375924+00:00 app[web.1]: ๏ฟฝ[36m(6:25:39 PM) - [INFO] - Joined General in Bot Test Server.๏ฟฝ[0m
2020-07-10T18:25:39.481341+00:00 app[web.1]: ๏ฟฝ[36m(6:25:39 PM) - [INFO] - (TTS): Received googleTTS for hi with language 'en' and speed 1 in guild Bot Test Server.๏ฟฝ[0m
2020-07-10T18:25:39.505467+00:00 app[web.1]: ๏ฟฝ[31m(6:25:39 PM) - [ERROR] - Error: FFmpeg/avconv not found!
2020-07-10T18:25:39.505469+00:00 app[web.1]: at Function.getInfo (/app/node_modules/prism-media/src/core/FFmpeg.js:130:11)
2020-07-10T18:25:39.505469+00:00 app[web.1]: at Function.create (/app/node_modules/prism-media/src/core/FFmpeg.js:143:38)
2020-07-10T18:25:39.505470+00:00 app[web.1]: at new FFmpeg (/app/node_modules/prism-media/src/core/FFmpeg.js:44:27)
2020-07-10T18:25:39.505471+00:00 app[web.1]: at AudioPlayer.playUnknown (/app/node_modules/discord.js/src/client/voice/player/BasePlayer.js:47:20)
2020-07-10T18:25:39.505471+00:00 app[web.1]: at VoiceConnection.play (/app/node_modules/discord.js/src/client/voice/util/PlayInterface.js:71:28)
2020-07-10T18:25:39.505472+00:00 app[web.1]: at /app/src/classes/TTSPlayer.js:80:45
2020-07-10T18:25:39.505472+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:93:5)๏ฟฝ[0m
i copy paste the bot token in the settings.json and gives this error
/discord-tts-bot/node_modules/discord.js/src/client/Client.js:237
if (!token || typeof token !== 'string') throw new Error('TOKEN_INVALID');
^
Error [TOKEN_INVALID]: An invalid token was provided.
at TTSClient.login (/discord-tts-bot/node_modules/discord.js/src/client/Client.js:237:52)
at Object. (/discord-tts-bot/src/app.js:168:8)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
[Symbol(code)]: 'TOKEN_INVALID'
}
The bot should leave the channel it is in if it hasn't been used for a while.
I think prefix will be the contingency plans. Because I think some server is not agree to use the slash command.
You can develop you bot with new feature is can play music from youtube or can kick, ban, mute members. I think it's will be a perfect bot.
Add more tts engines, ones that do not limit to 200 characters, (add the option to add character limit as well), if possible add the moonbase alpha tts engine.
Add a setting option that enables the bot to read out "user said: ", this should be optional,
๐ Describe the Bug
Keep getting Key not found in database error randomly after running the bot
โ๏ธ Steps to Reproduce
๐ Expected Behavior
Expected bot to run without error
๐ Log
/www/wwwroot/discordbot/NetaTTS/node_modules/levelup/lib/levelup.js:188
err = new NotFoundError('Key not found in database [' + key + ']', err)
^
Error [NotFoundError]: Key not found in database [829958692857970688:935454436199907358:tts_settings]
at /www/wwwroot/discordbot/NetaTTS/node_modules/levelup/lib/levelup.js:188:15
at /www/wwwroot/discordbot/NetaTTS/node_modules/encoding-down/index.js:75:21 {
[cause]: [Error: NotFound: ]
}
โ Other Information
Node Version: v17.4.0
Bot version: 4.0.4
Using stickers or sending an image in TTS channel will crash the bot
/www/wwwroot/discordbot/NetaTTS/node_modules/google-tts-api/dist/assertInputTypes.js:5
throw new TypeError('text should be a string');
^
TypeError: text should be a string
at Object.assertInputTypes [as default] (/www/wwwroot/discordbot/NetaTTS/node_modules/google-tts-api/dist/assertInputTypes.js:5:15)
at Object.getAllAudioUrls (/www/wwwroot/discordbot/NetaTTS/node_modules/google-tts-api/dist/getAudioUrl.js:61:31)
at /www/wwwroot/discordbot/NetaTTS/src/classes/tts/providers/GoogleProvider.js:12:32
at new Promise (<anonymous>)
at GoogleProvider.createPayload (/www/wwwroot/discordbot/NetaTTS/src/classes/tts/providers/GoogleProvider.js:10:12)
at TTSPlayer.say (/www/wwwroot/discordbot/NetaTTS/src/classes/tts/TTSPlayer.js:63:36)
at TTSChannelHandler.handleSay (/www/wwwroot/discordbot/NetaTTS/src/classes/tts/TTSChannelHandler.js:55:24)
at TTSChannelHandler.handleMessage (/www/wwwroot/discordbot/NetaTTS/src/classes/tts/TTSChannelHandler.js:26:17)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Node.js v17.4.0
Im having issues with installing discord.js on my discord bot, does anyone know how to resolve this issue?
it keeps giving this error:
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=16.6.0","npm":">=7.0.0"} (current: {"node":"14.17.6","npm":"6.14.15"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for @discordjs/[email protected]: wanted: {"node":">=14.0.0","npm":">=7.0.0"} (current: {"node":"14.17.6","npm":"6.14.15"})
npm WARN notsup Not compatible with your version of node/npm: @discordjs/[email protected]
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
Any help would be appreciated
code is not working and your official bot too ;-;
Hello there
I am a new user to github, where I have clone the bot and use it on my server
altho it works successfully for Chinese language, but everytime when a user use the command say with Chinese words together, the cmd logger seems to be failed on displaying the Chinese character
I have tried to change default CodePage of the cmd prompt to 65001 (unicode)
but it still fails to show it
Are there any way to fix this issue?
(node:3600) UnhandledPromiseRejectionWarning: Error: FFmpeg/avconv not found!
at Function.getInfo (/home/runner/discord-tts-bot/node_modules/prism-media/src/core/FFmpeg.js:143:11)
at Function.create (/home/runner/discord-tts-bot/node_modules/prism-media/src/core/FFmpeg.js:156:38)
at new FFmpeg (/home/runner/discord-tts-bot/node_modules/prism-media/src/core/FFmpeg.js:45:27)
at AudioPlayer.playUnknown (/home/runner/discord-tts-bot/node_modules/discord.js/src/client/voice/player/BasePlayer.js:47:20)
at VoiceConnection.play (/home/runner/discord-tts-bot/node_modules/discord.js/src/client/voice/util/PlayInterface.js:71:28)
at TTSPlayer.play (/home/runner/discord-tts-bot/src/classes/tts/TTSPlayer.js:61:41)
at TTSPlayer.say (/home/runner/discord-tts-bot/src/classes/tts/TTSPlayer.js:45:12)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3600) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3600) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
multiple voices, created either by accessing different engines or changing up generated voice lines somehow or whatever would be easiest to do so a larger number of people can talk in a conversation using tts without sounding like the same person
different prefixes or modifiers or whatever (i.e $say1, $say2, $say3, etc) that would make the voice sound different. maybe it could recognize the requests of different users and automatically assign them voices for consistency and ease of use but that would probably be way way harder
my friendgroup has been using say and aeiou for this purpose but it stops working almost immediately once more than two people start using it and aeiou isn't very good for talking anyway because it's much quieter than say
A TTS message for instance, will not complete if another user inputs a command before the previous one has completed.
It seems it is more intuitive that way.
Use embedded messages instead. Langs should display all language options instead of linking to a site.
Using any say command with an emoji from another server (nitro feature) will crash the bot.
/home/runner/discord-tts-bot-1/src/utils/mentions.js:18
return message.replace(CUSTOM_EMOJI_PATTERN, (_, id) => emojis.get(id).name);
^
TypeError: Cannot read property 'name' of undefined
at /home/runner/discord-tts-bot-1/src/utils/mentions.js<:18:800772399988736070>73
at String.replace (<anonymous>)
at cleanEmojis (/home/runner/discord-tts-bot-1/src/utils/mentions.js<:18:800772399988736070>18)
at cleanMessage (/home/runner/discord-tts-bot-1/src/utils/mentions.js:27:11)
at TTSChannelHandler.handleSay (/home/runner/discord-tts-bot-1/src/classes/tts/TTSChannelHandler.js:39:23)
at TTSChannelHandler.handleMessage (/home/runner/discord-tts-bot-1/src/classes/tts/TTSChannelHandler.js:26:17)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ./src/app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-01-29T19_24_43_985Z-debug.log
exit status 1
Add support for IBM Cloud TTS. More info here: https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-voices
Separate commands should be created.
There's a chance there will be a need to reorganize the current commands for different TTS engines.
Since IBM Cloud TTS also has multi language support, making a langs
command would be necessary. Obviously, there's the issue that this command already exists for Google TTS.
Maybe add some sort of command prefix to change TTS engine settings?
Discord with its new Bot policy won't allow bots, that are already in over 100 servers (This one being in 145 servers).
If you need it, here's the verification link https://disgd/bot-verification
When the portuguese xommand example shows up, it shows as ${config.prefix} instead of putting the actual prefix.
Add an option to the config to specify a channel to use without a prefix. Any messages sent in that channel will be read out loud. Maybe a list of channels and their respective voices/TTS engines, so we can have a
#john-madden
for all our aeiou needs, and a#no-mic-chat
channel that reads aloud people's messages?
The RangeError notification message should include the phrase length so the user can tell by how many characters they need to remove so the TTS will work. Also, this notification should be placed outside of the error catch which will remove the need of using a message argument on the playTTS() function.
Currently, the disconnect scheduler is being passed an old instance of the voice channel. If the bot is moved to another channel, the scheduler calls .leave() on the old channel.
Add an aeiou command to use the Moonbase Alpha TTS engine.
If the bot is not in a channel prior and aeiou command is used, the bot join but will not send any TTS, even if say command is used. Once this happens, the console log displays a 400 request error.
The bot only works if spawned using the say command. Any aeiou command will only work if the bot was already in a channel.
- The bot is not connected to voice.
- Run aeiou command
- Bot joins but is stuck in an unexpected state
The bot should be able to send TTS even if spawned using aeiou.
Mar 12 20:42:41 moonstar-server npm[29941]: (8:42:41 PM) - [INFO] - User yoo who did dis ๐๐ issued command aeiou in Greencoast Gaming.
Mar 12 20:42:42 moonstar-server npm[29941]: (8:42:42 PM) - [INFO] - Joined ๐ฆ LA BATICUEVA ๐ฆ in Greencoast Gaming.
Mar 12 20:42:42 moonstar-server npm[29941]: (8:42:42 PM) - [ERROR] - Request failed with status code 400
14.9.0
The Bot can connect to the voice channel but it doesn't say anything, I pretty sure that the bot has no error on my cmd
Add reconnecting/disconnected log messages to identify when the bot cannot connect to the discord api.
New version (v13) of discord.js has been released. Discord recently announced to use slash commands only, message will be a privilege intent soon. Please upgrade this.
If possible add support for external database such as MongoDB
discord.js v13 removed inbuilt support for voice, you have to use @discord.js/voice
for voice support
The Dockerfile
overwrites the environment variables. If any variable is omitted when creating the container, the variable will not take the expected default value.
deploying the slash command with the settings configured as in the readme gives me a bunch of errors that look like this:
TypeError: false in config for key OWNER_REPORTING does not conform to type string.
out of curiosity i tried converting it to a string with quotation marks, and it wanted a bunch of other stuff turned to strings too, so i did that, and eventually the command ran fine, but then gave me this error when i ran npm start:
TypeError: false in config for key OWNER_REPORTING does not conform to type boolean.
which makes sense, because i messed with the config, but the way it was working before didn't work either. i put it back to the way it was, and it opened and ran, but it won't recognize any slash commands, possibly because i had to change the config around to get the slash commands deployed and then put them back for the actual bot.
npm run deploy (after installing dependencies but not dev dependencies, if that matters?) in discord-tts-bot
bot lets me deploy slash commands and run it with the same config settings
uhhh i dont know, is this anything?
$ npm run deploy
[email protected] deploy
node ./src/command-deployer.js
C:\Users\Mabel\discord-tts-bot\node_modules@greencoast\discord.js-extended\dist\classes\config\ConfigValidator.js:62
throw new TypeError(${value} in config for key ${key} does not conform to type ${type}.
);
^
TypeError: false in config for key OWNER_REPORTING does not conform to type string.
at C:\Users\Mabel\discord-tts-bot\node_modules@greencoast\discord.js-extended\dist\classes\config\ConfigValidator.js:62:23
at Array.forEach ()
at ConfigValidator.validate (C:\Users\Mabel\discord-tts-bot\node_modules@greencoast\discord.js-extended\dist\classes\config\ConfigValidator.js:45:29)
at new ConfigProvider (C:\Users\Mabel\discord-tts-bot\node_modules@greencoast\discord.js-extended\dist\classes\config\ConfigProvider.js:81:24)
at Object. (C:\Users\Mabel\discord-tts-bot\src\command-deployer.js:5:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
Paste a screenshot of the bug (if applicable).
thank you for developing this bot and sorry if this is just me being clueless and not actually a bug
Add a custom disconnect timeout per guild.
This implies a database to store the guild settings, which could include additionally the language for the tts.
Changing the timeout would be its own command.
can u please update the help command that i can change the text?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.