daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Feb 14th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var fs = require('fs')
  2. var path = require('path')
  3.  
  4. module.exports = {
  5.   run: function (clients,message,args,logger){
  6.     logger.info('!help summoned')
  7.     var thecommands = ""
  8.    
  9.     if(args.length==0){
  10.       thecommands = "Command list:\n"
  11.       fs.readdir('./commands',function(err,files){
  12.         files.forEach(file => {
  13.           if(file.endsWith('.js')&&(file !== 'help.js')){
  14.             console.log(file.slice(0,file.indexOf('.')))
  15.             thecommands = [thecommands,file.slice(0,path.basename(file))].join('\n')
  16.           }
  17.         })
  18.       })
  19.     }
  20.    
  21.     else{
  22.       for(var i=0;i<args.length;i++){
  23.         try{
  24.          var commandname = args[i]
  25.          thecommands += require(`./${commandname}.js`).help + '\n'
  26.         }catch(err){
  27.           logger.info(err)
  28.         }
  29.       }
  30.     }
  31.    
  32.     message.reply(thecommands)
  33.   }
  34. }
RAW Paste Data
Top