Add random last say command
This commit is contained in:
		| @@ -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); | ||||
|     }); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user