Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var fs = require('fs')
- var path = require('path')
- module.exports = {
- run: function (clients,message,args,logger){
- logger.info('!help summoned')
- var thecommands = ""
- if(args.length==0){
- thecommands = "Command list:\n"
- fs.readdir('./commands',function(err,files){
- files.forEach(file => {
- if(file.endsWith('.js')&&(file !== 'help.js')){
- console.log(file.slice(0,file.indexOf('.')))
- thecommands = [thecommands,file.slice(0,path.basename(file))].join('\n')
- }
- })
- })
- }
- else{
- for(var i=0;i<args.length;i++){
- try{
- var commandname = args[i]
- thecommands += require(`./${commandname}.js`).help + '\n'
- }catch(err){
- logger.info(err)
- }
- }
- }
- message.reply(thecommands)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement