diff --git a/modules/Canttalk/index.js b/modules/Canttalk/index.js index ef1801e..2c708bd 100644 --- a/modules/Canttalk/index.js +++ b/modules/Canttalk/index.js @@ -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); + }); } \ No newline at end of file