Add random last say command
parent
82d5cbc758
commit
c33d35689b
|
@ -1,4 +1,6 @@
|
|||
const printf=require('printf');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (bot, api) => {
|
||||
bot.on('message', async (message) => {
|
||||
|
@ -37,4 +39,11 @@ module.exports = async (bot, api) => {
|
|||
api.respond(message, printf(api.strings.INVALID_ENGINE, args[1]));
|
||||
}
|
||||
});
|
||||
api.registerCommand('random', async (args, message) => {
|
||||
const files = fs.readdirSync(process.env["VOICE_TMP_PATH"]);
|
||||
const rnd = files[Math.floor(Math.random()*files.length)];
|
||||
console.log(rnd);
|
||||
api.queue.add(__dirname + "/sysmsg.wav");
|
||||
api.queue.add(process.env["VOICE_TMP_PATH"] + "/" + rnd);
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue