Added initial support for detecting videos, prevent music messages from showing on soundboard commands, fixed(?) permission checking
This commit is contained in:
		
							parent
							
								
									8aa0cc2163
								
							
						
					
					
						commit
						c67499af9d
					
				
					 6 changed files with 26 additions and 22 deletions
				
			
		| 
						 | 
				
			
			@ -4,7 +4,8 @@ const Command = require("../../classes/command.js");
 | 
			
		|||
class ChannelCommand extends Command {
 | 
			
		||||
  async run() {
 | 
			
		||||
    if (!this.message.channel.guild) return `${this.message.author.mention}, this command only works in servers!`;
 | 
			
		||||
    if (!this.message.member.permissions.has("administrator") && this.message.member.id !== process.env.OWNER) return `${this.message.author.mention}, you need to be an administrator to enable/disable me!`;
 | 
			
		||||
    console.log(this.message.member.permission);
 | 
			
		||||
    if (!this.message.member.permission.has("administrator") && this.message.member.id !== process.env.OWNER) return `${this.message.author.mention}, you need to be an administrator to enable/disable me!`;
 | 
			
		||||
    if (this.args.length === 0) return `${this.message.author.mention}, you need to provide whether I should be enabled or disabled in this channel!`;
 | 
			
		||||
    if (this.args[0] !== "disable" && this.args[0] !== "enable") return `${this.message.author.mention}, that's not a valid option!`;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ class PrefixCommand extends Command {
 | 
			
		|||
    if (!this.message.channel.guild) return `${this.message.author.mention}, this command only works in servers!`;
 | 
			
		||||
    const guild = await database.getGuild(this.message.channel.guild.id);
 | 
			
		||||
    if (this.args.length !== 0) {
 | 
			
		||||
      if (!this.message.member.permissions.has("administrator") && this.message.member.id !== process.env.OWNER) return `${this.message.author.mention}, you need to be an administrator to change the bot prefix!`;
 | 
			
		||||
      if (!this.message.member.permission.has("administrator") && this.message.member.id !== process.env.OWNER) return `${this.message.author.mention}, you need to be an administrator to change the bot prefix!`;
 | 
			
		||||
      await database.setPrefix(this.args[0], this.message.channel.guild);
 | 
			
		||||
      return `The prefix has been changed to ${this.args[0]}.`;
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,13 +25,13 @@ class TagsCommand extends Command {
 | 
			
		|||
      case "remove":
 | 
			
		||||
        if (this.args[1] === undefined) return `${this.message.author.mention}, you need to provide the name of the tag you want to delete!`;
 | 
			
		||||
        if (!tags[this.args[1].toLowerCase()]) return `${this.message.author.mention}, this tag doesn't exist!`;
 | 
			
		||||
        if (tags[this.args[1].toLowerCase()].author !== this.message.author.id && !this.message.member.permissions.has("manageMessages") && this.message.author.id !== process.env.OWNER) return `${this.message.author.mention}, you don't own this tag!`;
 | 
			
		||||
        if (tags[this.args[1].toLowerCase()].author !== this.message.author.id && !this.message.member.permission.has("manageMessages") && this.message.author.id !== process.env.OWNER) return `${this.message.author.mention}, you don't own this tag!`;
 | 
			
		||||
        await database.removeTag(this.args[1].toLowerCase(), this.message.channel.guild);
 | 
			
		||||
        return `${this.message.author.mention}, the tag \`${this.args[1].toLowerCase()}\` has been deleted!`;
 | 
			
		||||
      case "edit":
 | 
			
		||||
        if (this.args[1] === undefined) return `${this.message.author.mention}, you need to provide the name of the tag you want to edit!`;
 | 
			
		||||
        if (!tags[this.args[1].toLowerCase()]) return `${this.message.author.mention}, this tag doesn't exist!`;
 | 
			
		||||
        if (tags[this.args[1].toLowerCase()].author !== this.message.author.id && !this.message.member.permissions.has("manageMessages") && this.message.author.id !== process.env.OWNER) return `${this.message.author.mention}, you don't own this tag!`;
 | 
			
		||||
        if (tags[this.args[1].toLowerCase()].author !== this.message.author.id && !this.message.member.permission.has("manageMessages") && this.message.author.id !== process.env.OWNER) return `${this.message.author.mention}, you don't own this tag!`;
 | 
			
		||||
        await this.setTag(this.args.slice(2).join(" "), this.args[1].toLowerCase(), this.message, guild);
 | 
			
		||||
        return `${this.message.author.mention}, the tag \`${this.args[1].toLowerCase()}\` has been edited!`;
 | 
			
		||||
      case "own":
 | 
			
		||||
| 
						 | 
				
			
			@ -72,7 +72,7 @@ class TagsCommand extends Command {
 | 
			
		|||
        return tags[random(Object.keys(tags))].content;
 | 
			
		||||
      case "enable":
 | 
			
		||||
      case "disable":
 | 
			
		||||
        if (!this.message.member.permissions.has("manageMessages") && this.message.author.id !== process.env.OWNER) return `${this.message.author.mention}, you don't have permission to disable tags!`;
 | 
			
		||||
        if (!this.message.member.permission.has("manageMessages") && this.message.author.id !== process.env.OWNER) return `${this.message.author.mention}, you don't have permission to disable tags!`;
 | 
			
		||||
        var toggleResult = await database.toggleTags(this.message.channel.guild);
 | 
			
		||||
        return `${this.message.author.mention}, tags for this guild have been ${toggleResult ? "disabled" : "enabled"}. To ${toggleResult ? "enable" : "disable"} them again, run ${guild.prefix}tags ${toggleResult ? "enable" : "disable"}.`;
 | 
			
		||||
      default:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue