mirror of
				https://github.com/musix-org/musix-oss
				synced 2025-11-04 09:49:32 +00:00 
			
		
		
		
	3.2 fixes and improvements
This commit is contained in:
		@@ -16,7 +16,9 @@ module.exports = {
 | 
			
		||||
      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 searchString = args.slice(1).join(" ");
 | 
			
		||||
@@ -123,7 +125,7 @@ module.exports = {
 | 
			
		||||
        },
 | 
			
		||||
        function (err) {
 | 
			
		||||
          console.log(err);
 | 
			
		||||
          msg.channel.send(client.messages.noResults);
 | 
			
		||||
          msg.channel.send(client.messages.noResultsSpotify);
 | 
			
		||||
        }
 | 
			
		||||
      );
 | 
			
		||||
    } else if (
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ module.exports = {
 | 
			
		||||
      )
 | 
			
		||||
      .addField(
 | 
			
		||||
        client.messages.settingsBlacklist,
 | 
			
		||||
        client.messages.settingsBlacklist,
 | 
			
		||||
        client.messages.settingsBlacklistDesc,
 | 
			
		||||
        true
 | 
			
		||||
      )
 | 
			
		||||
      .addField(
 | 
			
		||||
@@ -48,6 +48,11 @@ module.exports = {
 | 
			
		||||
        client.messages.settingsBassDesc,
 | 
			
		||||
        true
 | 
			
		||||
      )
 | 
			
		||||
      .addField(
 | 
			
		||||
        client.messages.settingsSetKey,
 | 
			
		||||
        client.messages.settingsSetKeyDesc,
 | 
			
		||||
        true
 | 
			
		||||
      )
 | 
			
		||||
      .setFooter(footer)
 | 
			
		||||
      .setAuthor(client.user.username, client.user.displayAvatarURL)
 | 
			
		||||
      .setColor(client.config.embedColor);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,12 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
  name: "premium",
 | 
			
		||||
  async execute(msg, args, client) {
 | 
			
		||||
    if (msg.member.id !== client.config.devId)
 | 
			
		||||
      return msg.channel.send(client.messages.onlyDev);
 | 
			
		||||
    if (!args[2])
 | 
			
		||||
      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) {
 | 
			
		||||
      client.global.db.guilds[args[2]].premium = true;
 | 
			
		||||
      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,19 +1,32 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
    name: 'message',
 | 
			
		||||
  name: "message",
 | 
			
		||||
  async execute(client, msg, Discord) {
 | 
			
		||||
        if (msg.author.bot || !msg.guild) return;
 | 
			
		||||
    if (msg.author.bot) return;
 | 
			
		||||
    if (!msg.guild && msg.content.startsWith("setkey")) {
 | 
			
		||||
      const args = msg.content.split(" ");
 | 
			
		||||
      if (!args[1] || !args[2])
 | 
			
		||||
        return msg.channel.send(client.messages.setKeyUsage);
 | 
			
		||||
      if (!client.guilds.cache.get(args[2]))
 | 
			
		||||
        return msg.channel.send(client.messages.invalidGuild);
 | 
			
		||||
      client.global.db.guilds[args[2]].spotify_access_key = args[1];
 | 
			
		||||
      return msg.channel.send(client.messages.keySet);
 | 
			
		||||
    }
 | 
			
		||||
    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;
 | 
			
		||||
        const args = msg.content.slice(prefix.length).split(' ');
 | 
			
		||||
    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] === "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') {
 | 
			
		||||
        if (args[1] === "help") {
 | 
			
		||||
          const command = client.commands.get("help");
 | 
			
		||||
          return client.funcs.exe(msg, args, client, Discord, prefix, command);
 | 
			
		||||
        }
 | 
			
		||||
@@ -23,10 +36,16 @@ module.exports = {
 | 
			
		||||
    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);
 | 
			
		||||
    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);
 | 
			
		||||
    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",
 | 
			
		||||
  idOrMentionChannel:
 | 
			
		||||
    emojis.redx + "Please provide a channel id or mention a channel!",
 | 
			
		||||
  invalidGuild: emojis.redx + "Invalid guild id!",
 | 
			
		||||
  inviteTitle: "Invite Musix to your Discord server!",
 | 
			
		||||
  joined: emojis.green_check_mark + "Joined",
 | 
			
		||||
  joinSupport: "Join the musix support server: ",
 | 
			
		||||
  keySet: emojis.green_check_mark + "Key set!",
 | 
			
		||||
  loadingSongs: emojis.loading + "Loading song(s)",
 | 
			
		||||
  looping: emojis.repeat + "Looping the queue 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!",
 | 
			
		||||
  noResults: emojis.redx + "I could not obtain any search 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!",
 | 
			
		||||
  noSongs: emojis.redx + "That song does not exist!",
 | 
			
		||||
  notPremium: emojis.redx + "This is not a premium guild!",
 | 
			
		||||
@@ -150,7 +155,7 @@ module.exports = {
 | 
			
		||||
  prefixHere: "My prefix here is: ",
 | 
			
		||||
  prefixMaxLength: "The prefix must be shorter or equal to 5 letters!",
 | 
			
		||||
  prefixSet: emojis.green_check_mark + "New prefix set to:",
 | 
			
		||||
  premiumUsage: "`settings premium <guild id>`",
 | 
			
		||||
  premiumState: "Premium status: ",
 | 
			
		||||
  provideANumber:
 | 
			
		||||
    "Please provide a number ranging from 1-10 to select one of the search results.",
 | 
			
		||||
  provideASong:
 | 
			
		||||
@@ -175,6 +180,8 @@ module.exports = {
 | 
			
		||||
  seekMax:
 | 
			
		||||
    emojis.redx +
 | 
			
		||||
    "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",
 | 
			
		||||
  settingsAnnounceSongsDesc:
 | 
			
		||||
    "Whether to announce songs that start playing or not.",
 | 
			
		||||
@@ -192,6 +199,8 @@ module.exports = {
 | 
			
		||||
  settingsSetDj: "setdj",
 | 
			
		||||
  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!",
 | 
			
		||||
  settingsSetKey: "setkey",
 | 
			
		||||
  settingsSetKeyDesc: "Get instructions on how to set a spotify key.",
 | 
			
		||||
  settingsTitle: "Guild settings for Musix",
 | 
			
		||||
  settingsVolume: "volume",
 | 
			
		||||
  settingsVolumeDesc:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user