forked from embee/woomy
		
	Did lots of unfinished stuff
This commit is contained in:
		
							parent
							
								
									10a0a7aca7
								
							
						
					
					
						commit
						2b6ac43e9b
					
				
					 4 changed files with 35 additions and 5 deletions
				
			
		| 
						 | 
					@ -1,10 +1,7 @@
 | 
				
			||||||
 | 
					 | 
				
			||||||
const Discord = require('discord.js')
 | 
					 | 
				
			||||||
const cooldown = new Discord.Collection()
 | 
					 | 
				
			||||||
module.exports = async (client, message) => {
 | 
					module.exports = async (client, message) => {
 | 
				
			||||||
  if (message.author.bot) return
 | 
					  if (message.author.bot) return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  var prefix = '~'
 | 
					  var prefix = '!'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const myMention = `<@&${client.user.id}>`
 | 
					  const myMention = `<@&${client.user.id}>`
 | 
				
			||||||
  const myMention2 = `<@!${client.user.id}>`
 | 
					  const myMention2 = `<@!${client.user.id}>`
 | 
				
			||||||
| 
						 | 
					@ -37,6 +34,14 @@ module.exports = async (client, message) => {
 | 
				
			||||||
    return message.channel.send('You don\'t have permission to run this command!')
 | 
					    return message.channel.send('You don\'t have permission to run this command!')
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const delay = () => {
 | 
				
			||||||
 | 
					    setTimeout(() => {
 | 
				
			||||||
 | 
					      client.cooldown.get(cmd).delete(message.author.id);
 | 
				
			||||||
 | 
					      message.channel.send(`${message.member} cooldown has expired for ${command} command.`)
 | 
				
			||||||
 | 
					    }, commands.get(command) * 1000);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  message.author.permLevel = level
 | 
					  message.author.permLevel = level
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  message.flags = []
 | 
					  message.flags = []
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,4 @@
 | 
				
			||||||
module.exports = (client) => {
 | 
					module.exports = (client) => {
 | 
				
			||||||
  client.logger.ready('Connected to Discord as ' + client.user.tag)
 | 
					  client.logger.ready('Connected to Discord as ' + client.user.tag)
 | 
				
			||||||
 | 
					  client.logger.debug(client.cooldown)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										7
									
								
								index.js
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								index.js
									
										
									
									
									
								
							| 
						 | 
					@ -17,7 +17,11 @@ require('./modules/functions')(client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
client.logger = require('tracer').colorConsole({
 | 
					client.logger = require('tracer').colorConsole({
 | 
				
			||||||
  format: [
 | 
					  format: [
 | 
				
			||||||
    '{{timestamp}} <{{title}}> ({{file}}) {{message}}'
 | 
					    '{{timestamp}} <{{title}}> {{message}}',
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      error: '{{timestamp}} <{{title}}> ({{file}}) {{message}}',
 | 
				
			||||||
 | 
					      fatal: '{{timestamp}} <{{title}}> ({{file}}) {{message}}'
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  dateformat: 'dd-mm-yyyy HH:MM:ss',
 | 
					  dateformat: 'dd-mm-yyyy HH:MM:ss',
 | 
				
			||||||
  methods: ['log', 'debug', 'info', 'ready', 'warn', 'error', 'fatal'],
 | 
					  methods: ['log', 'debug', 'info', 'ready', 'warn', 'error', 'fatal'],
 | 
				
			||||||
| 
						 | 
					@ -47,6 +51,7 @@ client.config = require('./config')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Command/alias cache
 | 
					// Command/alias cache
 | 
				
			||||||
client.commands = new Discord.Collection()
 | 
					client.commands = new Discord.Collection()
 | 
				
			||||||
 | 
					client.cooldown = new Discord.Collection()
 | 
				
			||||||
client.aliases = new Discord.Collection()
 | 
					client.aliases = new Discord.Collection()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Initialization function
 | 
					// Initialization function
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,21 @@
 | 
				
			||||||
module.exports = client => {
 | 
					module.exports = client => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  client.permlevel = message => {
 | 
				
			||||||
 | 
					    let permlvl = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const permOrder = client.config.permLevels.slice(0).sort((p, c) => p.level < c.level ? 1 : -1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    while (permOrder.length) {
 | 
				
			||||||
 | 
					      const currentLevel = permOrder.shift()
 | 
				
			||||||
 | 
					      if (message.guild && currentLevel.guildOnly) continue
 | 
				
			||||||
 | 
					      if (currentLevel.check(message)) {
 | 
				
			||||||
 | 
					        permlvl = currentLevel.level
 | 
				
			||||||
 | 
					        break
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return permlvl
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  client.loadCommand = (commandName) => {
 | 
					  client.loadCommand = (commandName) => {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
      const props = require(`../commands/${commandName}`)
 | 
					      const props = require(`../commands/${commandName}`)
 | 
				
			||||||
| 
						 | 
					@ -6,6 +23,8 @@ module.exports = client => {
 | 
				
			||||||
        props.init(client)
 | 
					        props.init(client)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      client.commands.set(props.help.name, props)
 | 
					      client.commands.set(props.help.name, props)
 | 
				
			||||||
 | 
					      // So commands can each have their own cooldown time
 | 
				
			||||||
 | 
					      client.cooldown.set(props.help.name, new Map())
 | 
				
			||||||
      props.conf.aliases.forEach(alias => {
 | 
					      props.conf.aliases.forEach(alias => {
 | 
				
			||||||
        client.aliases.set(alias, props.help.name)
 | 
					        client.aliases.set(alias, props.help.name)
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue