mirror of
				https://github.com/musix-org/musix-oss
				synced 2025-11-04 09:49:32 +00:00 
			
		
		
		
	remove setkey
This commit is contained in:
		@@ -42,88 +42,86 @@ module.exports = {
 | 
				
			|||||||
    if (!voiceChannel.speakable)
 | 
					    if (!voiceChannel.speakable)
 | 
				
			||||||
      return msg.channel.send(client.messages.noPermsSpeak);
 | 
					      return msg.channel.send(client.messages.noPermsSpeak);
 | 
				
			||||||
    if (url.match(/^https?:\/\/(open.spotify.com|spotify.com)(.*)$/)) {
 | 
					    if (url.match(/^https?:\/\/(open.spotify.com|spotify.com)(.*)$/)) {
 | 
				
			||||||
      if (!client.global.db.guilds[msg.guild.id].premium)
 | 
					 | 
				
			||||||
        return msg.channel.send(client.messages.notPremium);
 | 
					 | 
				
			||||||
      const playlistId = url.split("/playlist/")[1].split("?")[0];
 | 
					      const playlistId = url.split("/playlist/")[1].split("?")[0];
 | 
				
			||||||
      spotify.getPlaylist(playlistId).then(
 | 
					      spotify.getPlaylist(playlistId).then(
 | 
				
			||||||
        async function (data) {
 | 
					        async function (data) {
 | 
				
			||||||
            const lmsg = await msg.channel.send(client.messages.loadingSongs);
 | 
					          const lmsg = await msg.channel.send(client.messages.loadingSongs);
 | 
				
			||||||
            let failed = 0;
 | 
					          let failed = 0;
 | 
				
			||||||
            for (let i = 0; data.body.tracks.items.length > i; i++) {
 | 
					          for (let i = 0; data.body.tracks.items.length > i; i++) {
 | 
				
			||||||
              const track = await data.body.tracks.items[i].track;
 | 
					            const track = await data.body.tracks.items[i].track;
 | 
				
			||||||
              await client.funcs.sleep(250);
 | 
					            await client.funcs.sleep(250);
 | 
				
			||||||
              await search(
 | 
					            await search(
 | 
				
			||||||
                `${track.artists[0].name} ${track.name} audio`,
 | 
					              `${track.artists[0].name} ${track.name} audio`,
 | 
				
			||||||
                async function (err, res) {
 | 
					              async function (err, res) {
 | 
				
			||||||
                  if (err) return console.log(err);
 | 
					                if (err) return console.log(err);
 | 
				
			||||||
                  if (res.videos.length === 0) {
 | 
					                if (res.videos.length === 0) {
 | 
				
			||||||
                    await search(
 | 
					                  await search(
 | 
				
			||||||
                      `${track.artists[0].name} ${track.name} lyrics`,
 | 
					                    `${track.artists[0].name} ${track.name} lyrics`,
 | 
				
			||||||
                      async function (err, res) {
 | 
					                    async function (err, res) {
 | 
				
			||||||
                        if (err) return console.log(err);
 | 
					                      if (err) return console.log(err);
 | 
				
			||||||
                        if (res.videos.length === 0) {
 | 
					                      if (res.videos.length === 0) {
 | 
				
			||||||
                          await search(
 | 
					                        await search(
 | 
				
			||||||
                            `${track.artists[0].name} ${track.name}`,
 | 
					                          `${track.artists[0].name} ${track.name}`,
 | 
				
			||||||
                            async function (err, res) {
 | 
					                          async function (err, res) {
 | 
				
			||||||
                              if (err) return console.log(err);
 | 
					                            if (err) return console.log(err);
 | 
				
			||||||
                              if (res.videos.length === 0) {
 | 
					                            if (res.videos.length === 0) {
 | 
				
			||||||
                                failed++;
 | 
					                              failed++;
 | 
				
			||||||
                                return;
 | 
					                              return;
 | 
				
			||||||
                              }
 | 
					 | 
				
			||||||
                              await client.funcs.handleVideo(
 | 
					 | 
				
			||||||
                                res.videos[0],
 | 
					 | 
				
			||||||
                                msg,
 | 
					 | 
				
			||||||
                                voiceChannel,
 | 
					 | 
				
			||||||
                                client,
 | 
					 | 
				
			||||||
                                true,
 | 
					 | 
				
			||||||
                                "ytdl"
 | 
					 | 
				
			||||||
                              );
 | 
					 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                          );
 | 
					                            await client.funcs.handleVideo(
 | 
				
			||||||
                          return;
 | 
					                              res.videos[0],
 | 
				
			||||||
                        }
 | 
					                              msg,
 | 
				
			||||||
                        await client.funcs.handleVideo(
 | 
					                              voiceChannel,
 | 
				
			||||||
                          res.videos[0],
 | 
					                              client,
 | 
				
			||||||
                          msg,
 | 
					                              true,
 | 
				
			||||||
                          voiceChannel,
 | 
					                              "ytdl"
 | 
				
			||||||
                          client,
 | 
					                            );
 | 
				
			||||||
                          true,
 | 
					                          }
 | 
				
			||||||
                          "ytdl"
 | 
					 | 
				
			||||||
                        );
 | 
					                        );
 | 
				
			||||||
 | 
					                        return;
 | 
				
			||||||
                      }
 | 
					                      }
 | 
				
			||||||
                    );
 | 
					                      await client.funcs.handleVideo(
 | 
				
			||||||
                    failed++;
 | 
					                        res.videos[0],
 | 
				
			||||||
                    return;
 | 
					                        msg,
 | 
				
			||||||
                  }
 | 
					                        voiceChannel,
 | 
				
			||||||
                  await client.funcs.handleVideo(
 | 
					                        client,
 | 
				
			||||||
                    res.videos[0],
 | 
					                        true,
 | 
				
			||||||
                    msg,
 | 
					                        "ytdl"
 | 
				
			||||||
                    voiceChannel,
 | 
					                      );
 | 
				
			||||||
                    client,
 | 
					                    }
 | 
				
			||||||
                    true,
 | 
					 | 
				
			||||||
                    "ytdl"
 | 
					 | 
				
			||||||
                  );
 | 
					                  );
 | 
				
			||||||
 | 
					                  failed++;
 | 
				
			||||||
 | 
					                  return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
              );
 | 
					                await client.funcs.handleVideo(
 | 
				
			||||||
            }
 | 
					                  res.videos[0],
 | 
				
			||||||
            let message;
 | 
					                  msg,
 | 
				
			||||||
            if (failed === 0) {
 | 
					                  voiceChannel,
 | 
				
			||||||
              message = client.messages.playlistAdded.replace(
 | 
					                  client,
 | 
				
			||||||
                "%TITLE%",
 | 
					                  true,
 | 
				
			||||||
                data.body.name
 | 
					                  "ytdl"
 | 
				
			||||||
              );
 | 
					                );
 | 
				
			||||||
            } else {
 | 
					              }
 | 
				
			||||||
              message = `${client.messages.playlistAdded.replace(
 | 
					            );
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					          let message;
 | 
				
			||||||
 | 
					          if (failed === 0) {
 | 
				
			||||||
 | 
					            message = client.messages.playlistAdded.replace(
 | 
				
			||||||
 | 
					              "%TITLE%",
 | 
				
			||||||
 | 
					              data.body.name
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            message = `${client.messages.playlistAdded.replace(
 | 
				
			||||||
              "%TITLE%",
 | 
					              "%TITLE%",
 | 
				
			||||||
              data.body.name
 | 
					              data.body.name
 | 
				
			||||||
            )}\n${client.messages.failedToLoad + failed}`;
 | 
					            )}\n${client.messages.failedToLoad + failed}`;
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            lmsg.edit(message);
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          function (err) {
 | 
					 | 
				
			||||||
            console.log(err);
 | 
					 | 
				
			||||||
            msg.channel.send(client.messages.noResultsSpotify);
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					          lmsg.edit(message);
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        function (err) {
 | 
				
			||||||
 | 
					          console.log(err);
 | 
				
			||||||
 | 
					          msg.channel.send(client.messages.noResultsSpotify);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
    } else if (
 | 
					    } else if (
 | 
				
			||||||
      url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)
 | 
					      url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)
 | 
				
			||||||
@@ -164,4 +162,4 @@ module.exports = {
 | 
				
			|||||||
      });
 | 
					      });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,11 +48,6 @@ 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);
 | 
				
			||||||
@@ -87,4 +82,4 @@ module.exports = {
 | 
				
			|||||||
      return msg.channel.send(embed);
 | 
					      return msg.channel.send(embed);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -1,6 +0,0 @@
 | 
				
			|||||||
module.exports = {
 | 
					 | 
				
			||||||
  name: "setkey",
 | 
					 | 
				
			||||||
  async execute(msg, args, client) {
 | 
					 | 
				
			||||||
    msg.channel.send(client.messages.setKeyUsage);
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
@@ -1,17 +1,7 @@
 | 
				
			|||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
  name: "message",
 | 
					  name: "message",
 | 
				
			||||||
  async execute(client, msg, Discord) {
 | 
					  async execute(client, msg, Discord) {
 | 
				
			||||||
    if (msg.author.bot) return;
 | 
					    if (msg.author.bot || !msg.guild) 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);
 | 
					 | 
				
			||||||
      client.config.db.collection("guilds").doc(args[2]).set({
 | 
					 | 
				
			||||||
        key: args[1],
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      return msg.channel.send(client.messages.keySet);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if (!msg.guild) return;
 | 
					 | 
				
			||||||
    if (!client.global.db.guilds[msg.guild.id]) return;
 | 
					    if (!client.global.db.guilds[msg.guild.id]) return;
 | 
				
			||||||
    let prefix = client.global.db.guilds[msg.guild.id].prefix;
 | 
					    let prefix = client.global.db.guilds[msg.guild.id].prefix;
 | 
				
			||||||
    const args = msg.content.slice(prefix.length).split(" ");
 | 
					    const args = msg.content.slice(prefix.length).split(" ");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,7 +96,7 @@ module.exports = {
 | 
				
			|||||||
  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 +
 | 
					  noResultsSpotify: emojis.redx +
 | 
				
			||||||
    "I could not obtain any results! Make sure you have a key set! More info with the setkey setting.",
 | 
					    "I could not obtain any results!",
 | 
				
			||||||
  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!",
 | 
				
			||||||
@@ -141,7 +141,6 @@ module.exports = {
 | 
				
			|||||||
  seekingPointPositive: emojis.redx + "The seeking point needs to be a positive number!",
 | 
					  seekingPointPositive: emojis.redx + "The seeking point needs to be a positive number!",
 | 
				
			||||||
  seekMax: emojis.redx +
 | 
					  seekMax: 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: "Whether to announce songs that start playing or not.",
 | 
					  settingsAnnounceSongsDesc: "Whether to announce songs that start playing or not.",
 | 
				
			||||||
  settingsBass: "bass",
 | 
					  settingsBass: "bass",
 | 
				
			||||||
@@ -155,8 +154,6 @@ module.exports = {
 | 
				
			|||||||
  settingsPrefixDesc: "Change the guild specific prefix. (string)",
 | 
					  settingsPrefixDesc: "Change the guild specific prefix. (string)",
 | 
				
			||||||
  settingsSetDj: "setdj",
 | 
					  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!",
 | 
					  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",
 | 
					  settingsTitle: "Guild settings for Musix",
 | 
				
			||||||
  settingsVolume: "volume",
 | 
					  settingsVolume: "volume",
 | 
				
			||||||
  settingsVolumeDesc: "Change the default volume that the bot will start playing at. (number)",
 | 
					  settingsVolumeDesc: "Change the default volume that the bot will start playing at. (number)",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user