Finally decided on a help command I like
This commit is contained in:
		
							parent
							
								
									aedce9fc34
								
							
						
					
					
						commit
						bfde321b3e
					
				
					 10 changed files with 90 additions and 70 deletions
				
			
		| 
						 | 
					@ -4,4 +4,10 @@ Woomy 2.0:
 | 
				
			||||||
- Logger now logs which file a log came from
 | 
					- Logger now logs which file a log came from
 | 
				
			||||||
- Functions file has been separated into multiple helpers
 | 
					- Functions file has been separated into multiple helpers
 | 
				
			||||||
- Added systemNotice feature, stops Woomy from outputting permission errors and stuff
 | 
					- Added systemNotice feature, stops Woomy from outputting permission errors and stuff
 | 
				
			||||||
- New ping command
 | 
					- New ping command
 | 
				
			||||||
 | 
					- help command overhauled
 | 
				
			||||||
 | 
					- added `pride` command
 | 
				
			||||||
 | 
					- eval now dm's errors to the user who ran the command
 | 
				
			||||||
 | 
					- ship command overhauled
 | 
				
			||||||
 | 
					- added volume command
 | 
				
			||||||
 | 
					- usage errors are now shown in an embed
 | 
				
			||||||
| 
						 | 
					@ -1,44 +1,41 @@
 | 
				
			||||||
exports.conf = {
 | 
					exports.conf = {
 | 
				
			||||||
    enabled: true,
 | 
					  enabled: true,
 | 
				
			||||||
    guildOnly: false,
 | 
					  guildOnly: false,
 | 
				
			||||||
    aliases: [],
 | 
					  aliases: ['enlarge'],
 | 
				
			||||||
    permLevel: 'User',
 | 
					  permLevel: 'User',
 | 
				
			||||||
    requiredPerms: []
 | 
					  requiredPerms: []
 | 
				
			||||||
  };
 | 
					}
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
exports.help = {
 | 
					exports.help = {
 | 
				
			||||||
    name: 'emoji',
 | 
					  name: 'emoji',
 | 
				
			||||||
    category: 'Utility',
 | 
					  category: 'Utility',
 | 
				
			||||||
    description: 'Enlarges and links an custom emoji',
 | 
					  description: 'Enlarges a custom emoji.',
 | 
				
			||||||
    usage: 'emoji [emoji]',
 | 
					  usage: 'emoji [emoji]',
 | 
				
			||||||
    params: '`[emoji] - Custom emoji you want to enlarge.'
 | 
					  parameters: '`[emoji] - Custom emoji you want to enlarge'
 | 
				
			||||||
};
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.run = async (client, message, args) => {
 | 
					exports.run = async (client, message, args) => {
 | 
				
			||||||
    if(!args[0]) {
 | 
					  if (!args[0]) {
 | 
				
			||||||
      return message.channel.send(`You need to specify a custom emoji. Usage: \`${client.commands.get(`emoji`).help.usage}\``)
 | 
					    return message.channel.send(client.userError(exports, 'Missing argument, the `emoji` argument is required!'))
 | 
				
			||||||
    };
 | 
					  };
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
    var ID;
 | 
					  var ID
 | 
				
			||||||
    var format = '.png'
 | 
					  var format = '.png'
 | 
				
			||||||
    var string =  args[0].replace(/\D/g,'');
 | 
					  var string = args[0].replace(/\D/g, '')
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
    if(args[0].charAt(1) == 'a' && args[0].charAt(2) == ':') {
 | 
					  if (args[0].charAt(1) === 'a' && args[0].charAt(2) === ':') {
 | 
				
			||||||
      format = '.gif'
 | 
					    format = '.gif'
 | 
				
			||||||
    };
 | 
					  };
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
    if(string.length > 18) {
 | 
					  if (string.length > 18) {
 | 
				
			||||||
      ID = string.slice(string.length - 18);
 | 
					    ID = string.slice(string.length - 18)
 | 
				
			||||||
    } else {
 | 
					  } else {
 | 
				
			||||||
      ID = string;
 | 
					    ID = string
 | 
				
			||||||
    };
 | 
					  };
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
    if(!ID) {
 | 
					  if (!ID) {
 | 
				
			||||||
      return message.channel.send(`<:error:466995152976871434> Invalid emoji. This command only works with custom emojis.`)
 | 
					    return message.channel.send('<:error:466995152976871434> This command only works with custom emojis, sorry ;~;')
 | 
				
			||||||
    };
 | 
					  }
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  
 | 
					  message.channel.send('https://cdn.discordapp.com/emojis/' + ID + format)
 | 
				
			||||||
  
 | 
					}
 | 
				
			||||||
    message.channel.send('https://cdn.discordapp.com/emojis/' + ID + format)
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,10 +10,10 @@ exports.conf = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.help = {
 | 
					exports.help = {
 | 
				
			||||||
  name: 'eval',
 | 
					  name: 'eval',
 | 
				
			||||||
  category: 'Owner',
 | 
					  category: 'Developer',
 | 
				
			||||||
  description: 'Evaluates arbitrary javascript.',
 | 
					  description: 'Evaluates arbitrary javascript.',
 | 
				
			||||||
  usage: 'eval [code]',
 | 
					  usage: 'eval [code]',
 | 
				
			||||||
  params: '`[code] - Javascript code you want to execute.'
 | 
					  parameters: '`[code] - Javascript code you want to execute.'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.run = async (client, message, args, level, data) => {
 | 
					exports.run = async (client, message, args, level, data) => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@ exports.help = {
 | 
				
			||||||
  name: 'help',
 | 
					  name: 'help',
 | 
				
			||||||
  category: 'Bot',
 | 
					  category: 'Bot',
 | 
				
			||||||
  description: 'Lists all commands Woomy has, what they do, and how to use them.',
 | 
					  description: 'Lists all commands Woomy has, what they do, and how to use them.',
 | 
				
			||||||
  usage: '`help` - Lists all commands.\n`help <command>` - Show detailed information on how to use the specified command.',
 | 
					  usage: '`help` - Shows the embed that provides info on how to use woomy. `help all` - Lists all commands.\n`help <command>` - Show detailed information on how to use the specified command.',
 | 
				
			||||||
  parameters: '`command` - The name of the command you want more information on.'
 | 
					  parameters: '`command` - The name of the command you want more information on.'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,8 +20,19 @@ exports.run = (client, message, args, level, data) => {
 | 
				
			||||||
  const embed = new Discord.MessageEmbed()
 | 
					  const embed = new Discord.MessageEmbed()
 | 
				
			||||||
  embed.setColor(client.embedColour(message.guild))
 | 
					  embed.setColor(client.embedColour(message.guild))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const commands = client.commands
 | 
				
			||||||
 | 
					  const categories = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  commands.forEach((cmd) => {
 | 
				
			||||||
 | 
					    if (!categories.includes(cmd.help.category)) {
 | 
				
			||||||
 | 
					      if (cmd.help.category === 'Developer' && !client.config.devs.includes('message.author.id')) {
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      categories.push(cmd.help.category)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!args[0]) {
 | 
					  if (!args[0]) {
 | 
				
			||||||
    const categories = []
 | 
					 | 
				
			||||||
    let uPrefix = '`' + data.user.prefix + '`'
 | 
					    let uPrefix = '`' + data.user.prefix + '`'
 | 
				
			||||||
    let gPrefix = '`' + data.guild.prefix + '`'
 | 
					    let gPrefix = '`' + data.guild.prefix + '`'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,32 +44,31 @@ exports.run = (client, message, args, level, data) => {
 | 
				
			||||||
      gPrefix = 'None set, use: `~prefix`'
 | 
					      gPrefix = 'None set, use: `~prefix`'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    embed.setTitle('Woomy Help')
 | 
					    embed.setTitle('Help & Commands')
 | 
				
			||||||
    embed.setDescription(`**Prefixes**\n» Default: \`${client.config.defaultPrefix}\`\n» Server: ${gPrefix}\n» Personal: ${uPrefix}\n\n» [Join my discord server](https://discord.gg/HCF8mdv) if you need help!\n» Use \`help <command>\` to recieve more information about a command!`)
 | 
					    embed.setDescription('')
 | 
				
			||||||
    const commands = client.commands
 | 
					    if (client.version.news.length > 0) {
 | 
				
			||||||
 | 
					      embed.addField('**News**', client.version.news)
 | 
				
			||||||
    commands.forEach((cmd) => {
 | 
					    }
 | 
				
			||||||
      if (!categories.includes(cmd.help.category)) {
 | 
					    embed.addField('**Prefixes**', `Default Prefix: \`${client.config.defaultPrefix}\`\nServer Prefix: ${gPrefix}\nUser Prefix: ${uPrefix}`)
 | 
				
			||||||
        if (cmd.help.category === 'Developer' && !client.config.devs.includes('message.author.id')) {
 | 
					    embed.addField('**Command Syntax**', 'For arguments in commands:\n» Arguments in `[]` brackets are required.\n» Arguments in `<>` brackets are optional.\n» Arguments prefixed with `-` are flags, and are placed at the start of the command (`avatar -jpg mudkipscience`)')
 | 
				
			||||||
          return
 | 
					    embed.addField('**Commands**', `Use \`${message.prefix}help all\` to view all commands, or \`${message.prefix}help <command>\` for more information on a specific command.\n\n[Bot Invite](https://discordapp.com/oauth2/authorize?client_id=${client.user.id}&permissions=2134240503&scope=bot) | [Discord Server](https://discord.gg/HCF8mdv) | [GitHub](https://github.com/mudkipscience/woomy) | [Vote for me!](https://top.gg/bot/435961704145485835/vote)`)
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        categories.push(cmd.help.category)
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return message.channel.send(embed)
 | 
				
			||||||
 | 
					  } else if (args[0] === 'all') {
 | 
				
			||||||
 | 
					    embed.setTitle('Commands')
 | 
				
			||||||
    categories.sort().forEach((cat) => {
 | 
					    categories.sort().forEach((cat) => {
 | 
				
			||||||
      const filtered = commands.filter((cmd) => cmd.help.category === cat)
 | 
					      const filtered = commands.filter((cmd) => cmd.help.category === cat)
 | 
				
			||||||
      embed.addField('**' + cat + '**', filtered.map((cmd) => '`' + cmd.help.name + '`').join(', '), true)
 | 
					      embed.addField('**' + cat + '**', filtered.map((cmd) => '`' + cmd.help.name + '`').join(', '))
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (message.guild && data.guild.customCommands.length > 0) {
 | 
					    if (message.guild && data.guild.customCommands.length > 0) {
 | 
				
			||||||
      embed.addField('**Custom**', data.guild.customCommands.map((cmd) => '`' + cmd.name + '`').join(' '), true)
 | 
					      embed.addField('**Custom**', data.guild.customCommands.map((cmd) => '`' + cmd.name + '`').join(' '))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return message.channel.send(embed)
 | 
					    return message.channel.send(embed)
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    const command = args.shift().toLowerCase()
 | 
					    const command = args.shift().toLowerCase()
 | 
				
			||||||
    const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command))
 | 
					    const cmd = commands.get(command) || commands.get(client.aliases.get(command))
 | 
				
			||||||
    if (!cmd) {
 | 
					    if (!cmd) {
 | 
				
			||||||
      return message.channel.send('Command/alias doesn\'t exist')
 | 
					      return message.channel.send('Command/alias doesn\'t exist')
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -72,12 +82,12 @@ exports.run = (client, message, args, level, data) => {
 | 
				
			||||||
    embed.setTitle(cmd.help.category.toLowerCase() + ':' + cmd.help.name)
 | 
					    embed.setTitle(cmd.help.category.toLowerCase() + ':' + cmd.help.name)
 | 
				
			||||||
    embed.setDescription(cmd.help.description)
 | 
					    embed.setDescription(cmd.help.description)
 | 
				
			||||||
    embed.addField('**Usage**', cmd.help.usage)
 | 
					    embed.addField('**Usage**', cmd.help.usage)
 | 
				
			||||||
    if (aliases) {
 | 
					 | 
				
			||||||
      embed.addField('**Aliases**', aliases)
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if (cmd.help.parameters.length > 0) {
 | 
					    if (cmd.help.parameters.length > 0) {
 | 
				
			||||||
      embed.addField('**Parameters**', cmd.help.parameters)
 | 
					      embed.addField('**Parameters**', cmd.help.parameters)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (aliases) {
 | 
				
			||||||
 | 
					      embed.addField('**Aliases**', aliases)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    embed.addField('**Rank required**', cmd.conf.permLevel, true)
 | 
					    embed.addField('**Rank required**', cmd.conf.permLevel, true)
 | 
				
			||||||
    embed.addField('**Server only**', cmd.conf.guildOnly, true)
 | 
					    embed.addField('**Server only**', cmd.conf.guildOnly, true)
 | 
				
			||||||
    embed.addField('**Cooldown**', cmd.conf.cooldown / 1000 + ' seconds', true)
 | 
					    embed.addField('**Cooldown**', cmd.conf.cooldown / 1000 + ' seconds', true)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@ exports.help = {
 | 
				
			||||||
  category: 'Bot',
 | 
					  category: 'Bot',
 | 
				
			||||||
  description: 'Returns your permission level.',
 | 
					  description: 'Returns your permission level.',
 | 
				
			||||||
  usage: 'level',
 | 
					  usage: 'level',
 | 
				
			||||||
  params: ''
 | 
					  parameters: ''
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.run = async (client, message, args, level, data) => {
 | 
					exports.run = async (client, message, args, level, data) => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,9 +10,9 @@ exports.conf = {
 | 
				
			||||||
exports.help = {
 | 
					exports.help = {
 | 
				
			||||||
  name: 'ping',
 | 
					  name: 'ping',
 | 
				
			||||||
  category: 'Bot',
 | 
					  category: 'Bot',
 | 
				
			||||||
  description: 'Displays bot latency in miliseconds.',
 | 
					  description: 'Check if bot is dying.',
 | 
				
			||||||
  usage: 'ping',
 | 
					  usage: 'ping',
 | 
				
			||||||
  params: ''
 | 
					  parameters: ''
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.run = async (client, message, args, level, data) => {
 | 
					exports.run = async (client, message, args, level, data) => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@ exports.help = {
 | 
				
			||||||
  category: 'Music',
 | 
					  category: 'Music',
 | 
				
			||||||
  description: 'Plays or adds to queue requested music.',
 | 
					  description: 'Plays or adds to queue requested music.',
 | 
				
			||||||
  usage: 'play [query]',
 | 
					  usage: 'play [query]',
 | 
				
			||||||
  params: '[query] - A query to find video by or a link to the video.'
 | 
					  parameters: '[query] - A query to find video by or a link to the video.'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.run = async (client, message, args, level, data) => {
 | 
					exports.run = async (client, message, args, level, data) => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
exports.conf = {
 | 
					exports.conf = {
 | 
				
			||||||
  enabled: true,
 | 
					  enabled: true,
 | 
				
			||||||
  guildOnly: false,
 | 
					  guildOnly: false,
 | 
				
			||||||
  aliases: ['flag'],
 | 
					  aliases: [],
 | 
				
			||||||
  permLevel: 'User',
 | 
					  permLevel: 'User',
 | 
				
			||||||
  requiredPerms: ['ATTACH_FILES'],
 | 
					  requiredPerms: ['ATTACH_FILES'],
 | 
				
			||||||
  cooldown: 15000
 | 
					  cooldown: 15000
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@ exports.help = {
 | 
				
			||||||
  category: 'Music',
 | 
					  category: 'Music',
 | 
				
			||||||
  description: 'Sets volume of currently playing music. (100% = 25% of the actual volume)',
 | 
					  description: 'Sets volume of currently playing music. (100% = 25% of the actual volume)',
 | 
				
			||||||
  usage: 'volume [volume]',
 | 
					  usage: 'volume [volume]',
 | 
				
			||||||
  params: '[volume] - Target volume from 0-100%'
 | 
					  parameters: '[volume] - Target volume from 0-100%'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.run = async (client, message, args, level, data) => {
 | 
					exports.run = async (client, message, args, level, data) => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@ module.exports = async (client, message) => {
 | 
				
			||||||
  if (message.guild) {
 | 
					  if (message.guild) {
 | 
				
			||||||
    if (!message.channel.permissionsFor(client.user).has('SEND_MESSAGES')) {
 | 
					    if (!message.channel.permissionsFor(client.user).has('SEND_MESSAGES')) {
 | 
				
			||||||
      try {
 | 
					      try {
 | 
				
			||||||
        return message.author.send(`I don't have permission to speak in **#${message.channel.name}**, Please ask a moderator to give me the send messages permission!`)
 | 
					        return message.author.send(`I don't have permission to speak in \`#${message.channel.name}\`, Please ask a moderator to give me the send messages permission!`)
 | 
				
			||||||
      } catch (err) {}
 | 
					      } catch (err) {}
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    data.guild = await client.findOrCreateGuild(message.guild)
 | 
					    data.guild = await client.findOrCreateGuild(message.guild)
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,13 @@ module.exports = async (client, message) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (message.content.indexOf(prefix) !== 0) return
 | 
					  if (message.content.indexOf(prefix) !== 0) return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  console.log(prefix)
 | 
				
			||||||
 | 
					  if (prefix === `<@${client.user.id}> ` || prefix === `<@!${client.user.id}> `) {
 | 
				
			||||||
 | 
					    message.prefix = '@Woomy '
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    message.prefix = prefix
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const args = message.content.slice(prefix.length).trim().split(/ +/g)
 | 
					  const args = message.content.slice(prefix.length).trim().split(/ +/g)
 | 
				
			||||||
  const command = args.shift().toLowerCase()
 | 
					  const command = args.shift().toLowerCase()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue