DECTalk is back again!

This commit is contained in:
Dragon Fire
2020-05-04 22:12:15 -04:00
parent a83909543f
commit 9a708f5303
3 changed files with 82 additions and 3 deletions
+7 -1
View File
@@ -132,7 +132,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 409
Total: 410
### Utility:
@@ -513,6 +513,7 @@ Total: 409
* **clap:** Sends 👏 text 👏 like 👏 this.
* **cow-say:** Makes a cow say your text.
* **cursive:** Converts text to cursive.
* **dec-talk:** The world's best Text-to-Speech.
* **dvorak:** Converts text to Dvorak encoding.
* **embed:** Sends text in an embed.
* **emojify:** Converts text to emoji form.
@@ -688,6 +689,8 @@ here.
* bulbapedia ([API](https://bulbapedia.bulbagarden.net/w/api.php))
- [Bulletin of the Atomic Scientists](https://thebulletin.org/)
* doomsday-clock ([Doomsday Clock Data](https://thebulletin.org/doomsday-clock/current-time/))
- [calzoneman](https://github.com/calzoneman)
* dec-talk ([API](https://github.com/calzoneman/aeiou))
- [Capcom](http://www.capcom.com/us/)
* ace-attorney ([Images, Original "Ace Attorney" Game](http://www.ace-attorney.com/))
* zero-dialogue ([Image, Original "Megaman Zero" Game](http://megaman.capcom.com/))
@@ -728,6 +731,8 @@ here.
* deviantart ([API](https://www.deviantart.com/developers/))
- [devsnek](https://github.com/devsnek)
* owo (Code)
- [Digital Equipment Corporation](http://gordonbell.azurewebsites.net/digital/timeline/tmlnhome.htm)
* dec-talk (Original DECTalk Software)
- [Discord Status Button](https://discord.c99.nl/)
* status-button (API)
- [Disney](https://www.disney.com/)
@@ -973,6 +978,7 @@ here.
* doors (Concept)
- [NASA](https://www.nasa.gov/)
* apod ([APOD API](https://api.nasa.gov/))
* dec-talk ([Original "Moonbase Alpha" Game](https://store.steampowered.com/app/39000/Moonbase_Alpha/))
* gravity ([Planet Gravity Data](https://nssdc.gsfc.nasa.gov/planetary/factsheet/planet_table_ratio.html))
* nasa ([NASA Image and Video Library API](https://api.nasa.gov/))
- [National Suicide Prevention Lifeline](https://suicidepreventionlifeline.org/)
+72
View File
@@ -0,0 +1,72 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class DECTalkCommand extends Command {
constructor(client) {
super(client, {
name: 'dec-talk',
aliases: ['text-to-speech', 'tts'],
group: 'edit-text',
memberName: 'dec-talk',
description: 'The world\'s best Text-to-Speech.',
guildOnly: true,
throttling: {
usages: 1,
duration: 10
},
userPermissions: ['CONNECT', 'SPEAK'],
clientPermissions: ['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'],
credit: [
{
name: 'calzoneman',
url: 'https://github.com/calzoneman',
reason: 'API',
reasonURL: 'https://github.com/calzoneman/aeiou'
},
{
name: 'Digital Equipment Corporation',
url: 'http://gordonbell.azurewebsites.net/digital/timeline/tmlnhome.htm',
reason: 'Original DECTalk Software'
},
{
name: 'NASA',
url: 'https://www.nasa.gov/',
reason: 'Original "Moonbase Alpha" Game',
reasonURL: 'https://store.steampowered.com/app/39000/Moonbase_Alpha/'
}
],
args: [
{
key: 'text',
prompt: 'What text do you want to say?',
type: 'string',
max: 1024
}
]
});
}
async run(msg, { text }) {
const voiceChannel = msg.member.voice.channel;
if (!voiceChannel) return msg.say('Please enter a voice channel first.');
if (!voiceChannel.permissionsFor(this.client.user).has(['CONNECT', 'SPEAK'])) {
return msg.say('Missing the "Connect" or "Speak" permission for the voice channel.');
}
if (!voiceChannel.joinable) return msg.say('Your voice channel is not joinable.');
if (this.client.voiceConnections.has(voiceChannel.guild.id)) return msg.say('I am already playing a sound.');
try {
const connection = await voiceChannel.join();
const { url } = await request
.get('http://tts.cyzon.us/tts')
.query({ text });
const dispatcher = connection.play(url);
await msg.react('🔉');
dispatcher.once('finish', () => voiceChannel.leave());
dispatcher.once('error', () => voiceChannel.leave());
return null;
} catch (err) {
voiceChannel.leave();
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+3 -2
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "114.2.1",
"version": "114.3.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
@@ -32,6 +32,7 @@
},
"dependencies": {
"@discordjs/collection": "^0.1.5",
"@discordjs/opus": "^0.3.2",
"@vitalets/google-translate-api": "^3.0.0",
"canvas": "^2.6.1",
"cheerio": "^1.0.0-rc.3",
@@ -43,7 +44,7 @@
"discord.js-commando": "github:discordjs/Commando",
"dotenv": "^8.2.0",
"gifencoder": "^2.0.1",
"mathjs": "^6.6.4",
"mathjs": "^6.6.5",
"moment": "^2.25.3",
"moment-duration-format": "^2.3.2",
"moment-timezone": "^0.5.28",