add tts command
parent
d8c28f06e1
commit
343c554109
|
@ -34,6 +34,7 @@ export { default as score } from './score';
|
||||||
export { default as stats } from './stats';
|
export { default as stats } from './stats';
|
||||||
export { default as storemessages } from './storemessages';
|
export { default as storemessages } from './storemessages';
|
||||||
export { default as train } from './train';
|
export { default as train } from './train';
|
||||||
|
export { default as tts } from './tts';
|
||||||
export { default as unban } from './unban';
|
export { default as unban } from './unban';
|
||||||
export { default as unmute } from './unmute';
|
export { default as unmute } from './unmute';
|
||||||
export { default as whois } from './whois';
|
export { default as whois } from './whois';
|
||||||
|
|
|
@ -19,7 +19,7 @@ export default class Page extends Command {
|
||||||
this.local = {
|
this.local = {
|
||||||
emergencyNumbers: ['#0', '#1', '#2', '#3'],
|
emergencyNumbers: ['#0', '#1', '#2', '#3'],
|
||||||
departmentNumbers: ['00', '01', '10', '20', '21', '22'],
|
departmentNumbers: ['00', '01', '10', '20', '21', '22'],
|
||||||
validPagerCodes: ['911', '811', '210', '265', '411', '419', '555', '556'],
|
validPagerCodes: ['911', '811', '210', '265', '411', '419', '555', '556', '557'],
|
||||||
codeDict: new Map(),
|
codeDict: new Map(),
|
||||||
};
|
};
|
||||||
this.init();
|
this.init();
|
||||||
|
@ -34,6 +34,8 @@ export default class Page extends Command {
|
||||||
this.local.codeDict.set('419', 'Sender didn\'t recognize your request.');
|
this.local.codeDict.set('419', 'Sender didn\'t recognize your request.');
|
||||||
this.local.codeDict.set('555', 'Sender is requesting that you contact them.');
|
this.local.codeDict.set('555', 'Sender is requesting that you contact them.');
|
||||||
this.local.codeDict.set('556', 'Sender is requesting that you contact them via DMs.');
|
this.local.codeDict.set('556', 'Sender is requesting that you contact them via DMs.');
|
||||||
|
this.local.codeDict.set('557', 'Sender is requesting that you contact them via PBX/their extension.');
|
||||||
|
this.local.codeDict.set('558', 'Sender is requesting if they are able to call you via PBX. If so, please send the sender back a 210 page.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public async run(message: Message, args: string[]) {
|
public async run(message: Message, args: string[]) {
|
||||||
|
@ -44,7 +46,7 @@ export default class Page extends Command {
|
||||||
embed.setTitle('Special Emergency/Department Numbers & Pager Codes');
|
embed.setTitle('Special Emergency/Department Numbers & Pager Codes');
|
||||||
embed.addField('Special Emergency Numbers', '`#0` | Broadcast - all Staff/Associates\n`#1` | Authoritative Broadcast - all Directors, Supervisors, Technicians, and Moderators\n`#2` | Systems Administrators/Technicians Broadcast - Matthew, Bsian, NightRaven, and all Technicians\n`#3` | Community/Moderation Team Broadcast - all Directors, Supervisors, Moderators, and Core Team');
|
embed.addField('Special Emergency Numbers', '`#0` | Broadcast - all Staff/Associates\n`#1` | Authoritative Broadcast - all Directors, Supervisors, Technicians, and Moderators\n`#2` | Systems Administrators/Technicians Broadcast - Matthew, Bsian, NightRaven, and all Technicians\n`#3` | Community/Moderation Team Broadcast - all Directors, Supervisors, Moderators, and Core Team');
|
||||||
embed.addField('Department Numbers', '`00` | Board of Directors\n`01` | Supervisors\n`10` | Technicians\n`20` | Moderators\n`21` | Core Team\n`22` | Associates');
|
embed.addField('Department Numbers', '`00` | Board of Directors\n`01` | Supervisors\n`10` | Technicians\n`20` | Moderators\n`21` | Core Team\n`22` | Associates');
|
||||||
embed.addField('Pager Codes', '"Pager" term in this field refers to the Staff member that initially paged. This is a list of valid codes you can send via a page.\n\n`911` - Pager is requesting EMERGENCY assistance\n`811` - Pager is requesting immediate/ASAP assistance\n`210` - Pager is informing you they acknowledged your request, usually sent in response to OK the initial page.\n`265` - Pager is requesting that you check your email\n`411` - Pager is requesting information/counsel from you\n`419` - Pager didn\'t recognize your request\n`555` - Pager is requesting that you contact them\n`556` - Pager is requesting that you contact them via DMs');
|
embed.addField('Pager Codes', '"Pager" term in this field refers to the Staff member that initially paged. This is a list of valid codes you can send via a page.\n\n`911` - Pager is requesting EMERGENCY assistance\n`811` - Pager is requesting immediate/ASAP assistance\n`210` - Pager is informing you they acknowledged your request, usually sent in response to OK the initial page.\n`265` - Pager is requesting that you check your email\n`411` - Pager is requesting information/counsel from you\n`419` - Pager didn\'t recognize your request\n`555` - Pager is requesting that you contact them\n`556` - Pager is requesting that you contact them via DMs\n`557` - Pager is requesting that you contact them via PBX/their extension.\n`558` - Pager is requesting if they are able to call you via PBX. If so, please send the pager back a 210 page.');
|
||||||
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||||
embed.setTimestamp();
|
embed.setTimestamp();
|
||||||
return message.channel.createMessage({ embed });
|
return message.channel.createMessage({ embed });
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
import { v4 as uuid } from 'uuid';
|
||||||
|
import { Message } from 'eris';
|
||||||
|
import { Client, Command } from '../class';
|
||||||
|
|
||||||
|
export default class TTS extends Command {
|
||||||
|
constructor(client: Client) {
|
||||||
|
super(client);
|
||||||
|
this.name = 'tts';
|
||||||
|
this.description = 'Uses Google Text to Speech engines to synthesize input to a MP3 file. Only supports English at this time.';
|
||||||
|
this.usage = `${this.client.config.prefix}tts <text>`;
|
||||||
|
this.permissions = 0;
|
||||||
|
this.guildOnly = true;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async run(message: Message, args: string[]) {
|
||||||
|
try {
|
||||||
|
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
||||||
|
const msg = await this.loading(message.channel, 'Synthesizing...');
|
||||||
|
const d = await axios({
|
||||||
|
method: 'GET',
|
||||||
|
url: `https://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=${args.join(' ')}&tl=en`,
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0',
|
||||||
|
},
|
||||||
|
responseType: 'arraybuffer',
|
||||||
|
});
|
||||||
|
msg.delete();
|
||||||
|
return message.channel.createMessage(undefined, { name: `${uuid()}.mp3`, file: d.data });
|
||||||
|
} catch (err) {
|
||||||
|
return this.client.util.handleError(err, message, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue