mirror of
				https://github.com/musix-org/musix-oss
				synced 2025-11-04 12:59:31 +00:00 
			
		
		
		
	3.2 fixes and improvements
This commit is contained in:
		@@ -16,7 +16,9 @@ module.exports = {
 | 
				
			|||||||
      secret: client.config.spotify_client_secret,
 | 
					      secret: client.config.spotify_client_secret,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    spotify.setAccessToken(client.config.spotify_access_key);
 | 
					    spotify.setAccessToken(
 | 
				
			||||||
 | 
					      client.global.db.guilds[msg.guild.id].spotify_access_key
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const youtube = new YouTube(client.config.api_key);
 | 
					    const youtube = new YouTube(client.config.api_key);
 | 
				
			||||||
    const searchString = args.slice(1).join(" ");
 | 
					    const searchString = args.slice(1).join(" ");
 | 
				
			||||||
@@ -123,7 +125,7 @@ module.exports = {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        function (err) {
 | 
					        function (err) {
 | 
				
			||||||
          console.log(err);
 | 
					          console.log(err);
 | 
				
			||||||
          msg.channel.send(client.messages.noResults);
 | 
					          msg.channel.send(client.messages.noResultsSpotify);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
    } else if (
 | 
					    } else if (
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,7 @@ module.exports = {
 | 
				
			|||||||
      )
 | 
					      )
 | 
				
			||||||
      .addField(
 | 
					      .addField(
 | 
				
			||||||
        client.messages.settingsBlacklist,
 | 
					        client.messages.settingsBlacklist,
 | 
				
			||||||
        client.messages.settingsBlacklist,
 | 
					        client.messages.settingsBlacklistDesc,
 | 
				
			||||||
        true
 | 
					        true
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
      .addField(
 | 
					      .addField(
 | 
				
			||||||
@@ -48,6 +48,11 @@ module.exports = {
 | 
				
			|||||||
        client.messages.settingsBassDesc,
 | 
					        client.messages.settingsBassDesc,
 | 
				
			||||||
        true
 | 
					        true
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
 | 
					      .addField(
 | 
				
			||||||
 | 
					        client.messages.settingsSetKey,
 | 
				
			||||||
 | 
					        client.messages.settingsSetKeyDesc,
 | 
				
			||||||
 | 
					        true
 | 
				
			||||||
 | 
					      )
 | 
				
			||||||
      .setFooter(footer)
 | 
					      .setFooter(footer)
 | 
				
			||||||
      .setAuthor(client.user.username, client.user.displayAvatarURL)
 | 
					      .setAuthor(client.user.username, client.user.displayAvatarURL)
 | 
				
			||||||
      .setColor(client.config.embedColor);
 | 
					      .setColor(client.config.embedColor);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,12 @@
 | 
				
			|||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
  name: "premium",
 | 
					  name: "premium",
 | 
				
			||||||
  async execute(msg, args, client) {
 | 
					  async execute(msg, args, client) {
 | 
				
			||||||
    if (msg.member.id !== client.config.devId)
 | 
					 | 
				
			||||||
      return msg.channel.send(client.messages.onlyDev);
 | 
					 | 
				
			||||||
    if (!args[2])
 | 
					    if (!args[2])
 | 
				
			||||||
      return msg.channel.send(
 | 
					      return msg.channel.send(
 | 
				
			||||||
        `${client.messages.correctUsage} ${client.messages.premiumUsage}`
 | 
					        client.messages.premiumState + client.global.db.guilds[args[2]].premium
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
 | 
					    if (msg.member.id !== client.config.devId)
 | 
				
			||||||
 | 
					      return msg.channel.send(client.messages.onlyDev);
 | 
				
			||||||
    if (client.global.db.guilds[args[2]].premium === false) {
 | 
					    if (client.global.db.guilds[args[2]].premium === false) {
 | 
				
			||||||
      client.global.db.guilds[args[2]].premium = true;
 | 
					      client.global.db.guilds[args[2]].premium = true;
 | 
				
			||||||
      let message;
 | 
					      let message;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								src/commands/settings/setKey.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/commands/settings/setKey.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					module.exports = {
 | 
				
			||||||
 | 
					  name: "setkey",
 | 
				
			||||||
 | 
					  async execute(msg, args, client) {
 | 
				
			||||||
 | 
					    msg.channel.send(client.messages.setKeyUsage);
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -1,32 +1,51 @@
 | 
				
			|||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
    name: 'message',
 | 
					  name: "message",
 | 
				
			||||||
    async execute(client, msg, Discord) {
 | 
					  async execute(client, msg, Discord) {
 | 
				
			||||||
        if (msg.author.bot || !msg.guild) return;
 | 
					    if (msg.author.bot) return;
 | 
				
			||||||
        if (!client.global.db.guilds[msg.guild.id]) return;
 | 
					    if (!msg.guild && msg.content.startsWith("setkey")) {
 | 
				
			||||||
        let prefix = client.global.db.guilds[msg.guild.id].prefix;
 | 
					      const args = msg.content.split(" ");
 | 
				
			||||||
        if (client.config.devMode) prefix = client.config.devPrefix;
 | 
					      if (!args[1] || !args[2])
 | 
				
			||||||
        const args = msg.content.slice(prefix.length).split(' ');
 | 
					        return msg.channel.send(client.messages.setKeyUsage);
 | 
				
			||||||
        if (msg.mentions.users.first()) {
 | 
					      if (!client.guilds.cache.get(args[2]))
 | 
				
			||||||
            if (msg.mentions.users.first().id === client.user.id) {
 | 
					        return msg.channel.send(client.messages.invalidGuild);
 | 
				
			||||||
                if (!args[1]) return;
 | 
					      client.global.db.guilds[args[2]].spotify_access_key = args[1];
 | 
				
			||||||
                if (args[1] === 'prefix') {
 | 
					      return msg.channel.send(client.messages.keySet);
 | 
				
			||||||
                    if (!args[2]) return msg.channel.send(`${client.messages.prefixHere}\`${prefix}\`.`);
 | 
					 | 
				
			||||||
                    if (args[2] === "=" && args[3]) return prefix = args[3];
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                if (args[1] === 'help') {
 | 
					 | 
				
			||||||
                    const command = client.commands.get("help");
 | 
					 | 
				
			||||||
                    return client.funcs.exe(msg, args, client, Discord, prefix, command);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (!msg.content.startsWith(prefix)) return;
 | 
					 | 
				
			||||||
        if (!args[0]) return;
 | 
					 | 
				
			||||||
        const commandName = args[0].toLowerCase();
 | 
					 | 
				
			||||||
        if (commandName === "none") return;
 | 
					 | 
				
			||||||
        const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
 | 
					 | 
				
			||||||
        if (!command && msg.content !== `${prefix}`) return;
 | 
					 | 
				
			||||||
        if (command.onlyDev && msg.author.id !== client.config.devId) return;
 | 
					 | 
				
			||||||
        if (client.config.devMode && msg.member.id !== client.config.devId) return msg.channel.send(client.messages.devMode);
 | 
					 | 
				
			||||||
        client.funcs.exe(msg, args, client, Discord, command);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					    if (!msg.guild) return;
 | 
				
			||||||
 | 
					    if (!client.global.db.guilds[msg.guild.id]) return;
 | 
				
			||||||
 | 
					    let prefix = client.global.db.guilds[msg.guild.id].prefix;
 | 
				
			||||||
 | 
					    const args = msg.content.slice(prefix.length).split(" ");
 | 
				
			||||||
 | 
					    if (client.config.devMode) prefix = client.config.devPrefix;
 | 
				
			||||||
 | 
					    if (msg.mentions.users.first()) {
 | 
				
			||||||
 | 
					      if (msg.mentions.users.first().id === client.user.id) {
 | 
				
			||||||
 | 
					        if (!args[1]) return;
 | 
				
			||||||
 | 
					        if (args[1] === "prefix") {
 | 
				
			||||||
 | 
					          if (!args[2])
 | 
				
			||||||
 | 
					            return msg.channel.send(
 | 
				
			||||||
 | 
					              `${client.messages.prefixHere}\`${prefix}\`.`
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					          if (args[2] === "=" && args[3]) return (prefix = args[3]);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (args[1] === "help") {
 | 
				
			||||||
 | 
					          const command = client.commands.get("help");
 | 
				
			||||||
 | 
					          return client.funcs.exe(msg, args, client, Discord, prefix, command);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (!msg.content.startsWith(prefix)) return;
 | 
				
			||||||
 | 
					    if (!args[0]) return;
 | 
				
			||||||
 | 
					    const commandName = args[0].toLowerCase();
 | 
				
			||||||
 | 
					    if (commandName === "none") return;
 | 
				
			||||||
 | 
					    const command =
 | 
				
			||||||
 | 
					      client.commands.get(commandName) ||
 | 
				
			||||||
 | 
					      client.commands.find(
 | 
				
			||||||
 | 
					        (cmd) => cmd.aliases && cmd.aliases.includes(commandName)
 | 
				
			||||||
 | 
					      ) ||
 | 
				
			||||||
 | 
					      client.commandAliases.get(commandName);
 | 
				
			||||||
 | 
					    if (!command && msg.content !== `${prefix}`) return;
 | 
				
			||||||
 | 
					    if (command.onlyDev && msg.author.id !== client.config.devId) return;
 | 
				
			||||||
 | 
					    if (client.config.devMode && msg.member.id !== client.config.devId)
 | 
				
			||||||
 | 
					      return msg.channel.send(client.messages.devMode);
 | 
				
			||||||
 | 
					    client.funcs.exe(msg, args, client, Discord, command);
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,9 +77,11 @@ module.exports = {
 | 
				
			|||||||
  helpTitle: "help",
 | 
					  helpTitle: "help",
 | 
				
			||||||
  idOrMentionChannel:
 | 
					  idOrMentionChannel:
 | 
				
			||||||
    emojis.redx + "Please provide a channel id or mention a channel!",
 | 
					    emojis.redx + "Please provide a channel id or mention a channel!",
 | 
				
			||||||
 | 
					  invalidGuild: emojis.redx + "Invalid guild id!",
 | 
				
			||||||
  inviteTitle: "Invite Musix to your Discord server!",
 | 
					  inviteTitle: "Invite Musix to your Discord server!",
 | 
				
			||||||
  joined: emojis.green_check_mark + "Joined",
 | 
					  joined: emojis.green_check_mark + "Joined",
 | 
				
			||||||
  joinSupport: "Join the musix support server: ",
 | 
					  joinSupport: "Join the musix support server: ",
 | 
				
			||||||
 | 
					  keySet: emojis.green_check_mark + "Key set!",
 | 
				
			||||||
  loadingSongs: emojis.loading + "Loading song(s)",
 | 
					  loadingSongs: emojis.loading + "Loading song(s)",
 | 
				
			||||||
  looping: emojis.repeat + "Looping the queue now!",
 | 
					  looping: emojis.repeat + "Looping the queue now!",
 | 
				
			||||||
  loopingSong: emojis.repeatSong + "Looping **%TITLE%** now!",
 | 
					  loopingSong: emojis.repeatSong + "Looping **%TITLE%** now!",
 | 
				
			||||||
@@ -120,6 +122,9 @@ module.exports = {
 | 
				
			|||||||
  noQuery: emojis.redx + "you need to use a link or search for a song!",
 | 
					  noQuery: emojis.redx + "you need to use a link or search for a song!",
 | 
				
			||||||
  noResults: emojis.redx + "I could not obtain any search results!",
 | 
					  noResults: emojis.redx + "I could not obtain any search results!",
 | 
				
			||||||
  noResultsLyrics: emojis.redx + "I could not obtain any results!",
 | 
					  noResultsLyrics: emojis.redx + "I could not obtain any results!",
 | 
				
			||||||
 | 
					  noResultsSpotify:
 | 
				
			||||||
 | 
					    emojis.redx +
 | 
				
			||||||
 | 
					    "I could not obtain any results! Make sure you have a key set! More info with the setkey setting.",
 | 
				
			||||||
  noServerQueue: emojis.redx + "There is nothing playing!",
 | 
					  noServerQueue: emojis.redx + "There is nothing playing!",
 | 
				
			||||||
  noSongs: emojis.redx + "That song does not exist!",
 | 
					  noSongs: emojis.redx + "That song does not exist!",
 | 
				
			||||||
  notPremium: emojis.redx + "This is not a premium guild!",
 | 
					  notPremium: emojis.redx + "This is not a premium guild!",
 | 
				
			||||||
@@ -150,7 +155,7 @@ module.exports = {
 | 
				
			|||||||
  prefixHere: "My prefix here is: ",
 | 
					  prefixHere: "My prefix here is: ",
 | 
				
			||||||
  prefixMaxLength: "The prefix must be shorter or equal to 5 letters!",
 | 
					  prefixMaxLength: "The prefix must be shorter or equal to 5 letters!",
 | 
				
			||||||
  prefixSet: emojis.green_check_mark + "New prefix set to:",
 | 
					  prefixSet: emojis.green_check_mark + "New prefix set to:",
 | 
				
			||||||
  premiumUsage: "`settings premium <guild id>`",
 | 
					  premiumState: "Premium status: ",
 | 
				
			||||||
  provideANumber:
 | 
					  provideANumber:
 | 
				
			||||||
    "Please provide a number ranging from 1-10 to select one of the search results.",
 | 
					    "Please provide a number ranging from 1-10 to select one of the search results.",
 | 
				
			||||||
  provideASong:
 | 
					  provideASong:
 | 
				
			||||||
@@ -175,6 +180,8 @@ module.exports = {
 | 
				
			|||||||
  seekMax:
 | 
					  seekMax:
 | 
				
			||||||
    emojis.redx +
 | 
					    emojis.redx +
 | 
				
			||||||
    "The lenght of this song is %LENGTH% seconds! You can't seek further than that!",
 | 
					    "The lenght of this song is %LENGTH% seconds! You can't seek further than that!",
 | 
				
			||||||
 | 
					  setKeyUsage:
 | 
				
			||||||
 | 
					    "Usage: `setkey <key> <guild id>`. Get your key from <https://developer.spotify.com/documentation/web-playback-sdk/quick-start/#> by pressing `Get your web playback sdk access token`.\nThe key will expire in 60 minutes!\nDO THIS COMMAND IN THE DMS! YOUR KEY IS PRIVATE DO NOT SHARE IT WITH ANYONE!",
 | 
				
			||||||
  settingsAnnounceSongs: "announcesongs",
 | 
					  settingsAnnounceSongs: "announcesongs",
 | 
				
			||||||
  settingsAnnounceSongsDesc:
 | 
					  settingsAnnounceSongsDesc:
 | 
				
			||||||
    "Whether to announce songs that start playing or not.",
 | 
					    "Whether to announce songs that start playing or not.",
 | 
				
			||||||
@@ -192,6 +199,8 @@ module.exports = {
 | 
				
			|||||||
  settingsSetDj: "setdj",
 | 
					  settingsSetDj: "setdj",
 | 
				
			||||||
  settingsSetDjDesc:
 | 
					  settingsSetDjDesc:
 | 
				
			||||||
    "Set a DJ role. This will allow chosen users to freely use all Musix commands. This will automatically set the `permissions` settings to true in order for the `DJ` role to have effect!",
 | 
					    "Set a DJ role. This will allow chosen users to freely use all Musix commands. This will automatically set the `permissions` settings to true in order for the `DJ` role to have effect!",
 | 
				
			||||||
 | 
					  settingsSetKey: "setkey",
 | 
				
			||||||
 | 
					  settingsSetKeyDesc: "Get instructions on how to set a spotify key.",
 | 
				
			||||||
  settingsTitle: "Guild settings for Musix",
 | 
					  settingsTitle: "Guild settings for Musix",
 | 
				
			||||||
  settingsVolume: "volume",
 | 
					  settingsVolume: "volume",
 | 
				
			||||||
  settingsVolumeDesc:
 | 
					  settingsVolumeDesc:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user