1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-17 04:26:00 +00:00

Update V3.2.0

This commit is contained in:
MatteZ02
2020-04-19 20:00:16 +03:00
parent ce214a827f
commit ec07bdb5a3
33 changed files with 2319 additions and 659 deletions

View File

@ -1,24 +1,35 @@
module.exports = {
name: 'bass',
description: 'Bassboost command.',
alias: 'none',
usage: '<bass>',
cooldown: 5,
onlyDev: false,
permission: 'MANAGE_MESSAGES',
category: 'music',
execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id);
if (!args[1] && queue) return msg.channel.send(`${client.messages.currentBass}**${queue.bass}**`);
const bass = parseFloat(args[1]);
if (client.funcs.check(client, msg, command)) {
if (isNaN(bass)) return msg.channel.send(client.messages.validNumber);
if (bass > 100) return msg.channel.send(client.messages.maxBass);
if (bass < 0) return msg.channel.send(client.messages.positiveBass);
queue.bass = bass;
let message;
message = client.messages.bassApplied.replace("%BASS%", bass);
return msg.channel.send(message);
}
name: "bass",
description: "Bassboost command.",
alias: "none",
usage: "<bass>",
cooldown: 5,
onlyDev: false,
permission: "MANAGE_MESSAGES",
category: "music",
execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id);
if (!args[1] && queue)
return msg.channel.send(
`${client.messages.currentBass}**${queue.bass}**`
);
const bass = parseFloat(args[1]);
if (client.funcs.check(client, msg, command)) {
if (queue.nigthCore)
return msg.channel.send(client.messages.disableNigthCore);
if (isNaN(bass)) return msg.channel.send(client.messages.validNumber);
if (bass > 100) return msg.channel.send(client.messages.maxBass);
if (bass < 0) return msg.channel.send(client.messages.positiveBass);
queue.bass = bass;
client.funcs.end(
client,
msg,
(queue.connection.dispatcher.streamTime + queue.time) / 1000,
command
);
let message;
message = client.messages.bassApplied.replace("%BASS%", bass);
return msg.channel.send(message);
}
},
};

33
src/commands/lyrics.ts Normal file
View File

@ -0,0 +1,33 @@
const { getLyrics } = require("genius-lyrics-api");
module.exports = {
name: "lyrics",
alias: "l",
usage: "<song>",
description: "see the lyrics for a song",
onlyDev: false,
permission: "none",
category: "util",
async execute(msg, args, client, Discord, prefix, command) {
const searchString = args.slice(1).join(" ");
const options = {
apiKey: client.config.genius_api_key,
title: searchString,
artist: "",
optimizeQuery: true,
};
const queue = client.queue.get(msg.guild.id);
if (queue && !args[1]) options.title = queue.songs[0].title;
if (!queue && !args[1])
return msg.channel.send(client.messages.lyricsUsage);
getLyrics(options).then((lyrics) => {
if (lyrics === null)
return msg.channel.send(client.messages.noResultsLyrics);
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.lyricsTitle)
.setDescription(lyrics)
.setColor(client.config.embedColor);
msg.channel.send(embed);
});
},
};

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false,
permission: "MANAGE_MESSAGES",
category: "music",
async execute(msg, args, client, Discord, prefix, command) {
async execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id);
if (!args[1] && queue)
return msg.channel.send(

View File

@ -1,32 +1,50 @@
module.exports = {
name: 'nowplaying',
alias: 'np',
usage: '',
description: 'See the currently playing song position and length.',
onlyDev: false,
permission: 'none',
category: 'music',
async execute(msg, args, client, Discord, command) {
const getThumb = require('video-thumbnail-url');
const ytdl = require('ytdl-core');
const queue = client.queue.get(msg.guild.id);
if (!queue) return msg.channel.send(client.messages.noServerQueue);
let data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
let songtime = (data.length_seconds * 1000).toFixed(0);
queue.time = queue.connection.dispatcher.streamTime;
let completed = (queue.time.toFixed(0));
let barlength = 30;
let completedpercent = ((completed / songtime) * barlength).toFixed(0);
let array = []; for (let i = 0; i < completedpercent - 1; i++) { array.push('⎯'); } array.push('⭗'); for (let i = 0; i < barlength - completedpercent - 1; i++) { array.push('⎯'); }
const thumbnail = getThumb(queue.songs[0].url);
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.nowPlaying)
.setDescription(`${client.messages.nowPlayingDesc} ${queue.songs[0].title}\n${array.join('')} | \`${client.funcs.msToTime(completed, "hh:mm:ss")} / ${client.funcs.msToTime(songtime, "hh:mm:ss")}\``)
.setFooter(`Queued by ${queue.songs[0].author.tag}`)
.setURL(queue.songs[0].url)
.setThumbnail(thumbnail._rejectionHandler0)
.setColor(client.config.embedColor)
return msg.channel.send(embed);
name: "nowplaying",
alias: "np",
usage: "",
description: "See the currently playing song position and length.",
onlyDev: false,
permission: "none",
category: "music",
async execute(msg, args, client, Discord, command) {
const getThumb = require("video-thumbnail-url");
const ytdl = require("ytdl-core");
const queue = client.queue.get(msg.guild.id);
if (!queue) return msg.channel.send(client.messages.noServerQueue);
let data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
let songTime = (data.length_seconds * 1000).toFixed(0);
let completed = (
queue.connection.dispatcher.streamTime + queue.time
).toFixed(0);
let barlength = 30;
let completedpercent = ((completed / songTime) * barlength).toFixed(0);
let array = [];
for (let i = 0; i < completedpercent - 1; i++) {
array.push("⎯");
}
array.push("⭗");
for (let i = 0; i < barlength - completedpercent - 1; i++) {
array.push("⎯");
}
const thumbnail = getThumb(queue.songs[0].url);
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.nowPlaying)
.setDescription(
`${client.messages.nowPlayingDesc} ${
queue.songs[0].title
}\n${array.join("")} | \`${client.funcs.msToTime(
completed,
"hh:mm:ss"
)} / ${client.funcs.msToTime(songTime, "hh:mm:ss")}\``
)
.setFooter(`Queued by ${queue.songs[0].author.tag}`)
.setURL(queue.songs[0].url)
.setThumbnail(thumbnail._rejectionHandler0)
.setColor(client.config.embedColor);
if (queue.nigthCore)
embed.setDescription(
`${client.messages.nowPlayingDesc} ${queue.songs[0].title}`
);
return msg.channel.send(embed);
},
};

View File

@ -1,45 +1,168 @@
const YouTube = require("simple-youtube-api");
const search = require('yt-search');
const search = require("yt-search");
const SpotifyApi = require("spotify-web-api-node");
module.exports = {
name: 'play',
alias: 'p',
usage: '<song name>',
description: 'Play some music.',
onlyDev: false,
permission: 'none',
category: 'music',
async execute(msg, args, client, Discord, command) {
const youtube = new YouTube(client.config.api_key);
const searchString = args.slice(1).join(" ");
const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
const queue = client.queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel;
if (!queue) {
if (!msg.member.voice.channel) return msg.channel.send(client.messages.noVoiceChannel);
} else {
if (voiceChannel !== queue.voiceChannel) return msg.channel.send(client.messages.wrongVoiceChannel);
}
if (!args[1]) return msg.channel.send(client.messages.noQuery);
if (voiceChannel.full) return msg.channel.send(client.messages.channelFull);
if (!voiceChannel.joinable) return msg.channel.send(client.messages.noPermsConnect);
if (!voiceChannel.speakable) return msg.channel.send(client.messages.noPermsSpeak);
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
const lmsg = await msg.channel.send(client.messages.loadingSongs);
const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos();
for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id);
await client.funcs.handleVideo(video2, msg, voiceChannel, client, true);
}
client.messages.playlistAdded = client.messages.playlistAdded.replace("%TITLE%", playlist.title);
return lmsg.edit(client.messages.playlistAdded);
} else {
search(searchString, function (err, res) {
if (err) return console.log(err);
if (res.videos.length === 0) return msg.channel.send(client.messages.noResults);
client.funcs.handleVideo(res.videos[0], msg, voiceChannel, client, false);
})
}
}
name: "play",
alias: "p",
usage: "<song name>",
description: "Play some music.",
onlyDev: false,
permission: "none",
category: "music",
async execute(msg, args, client, Discord, command) {
const spotify = new SpotifyApi({
id: client.config.spotify_client_id,
secret: client.config.spotify_client_secret,
});
spotify.setAccessToken(client.config.spotify_access_key);
const youtube = new YouTube(client.config.api_key);
const searchString = args.slice(1).join(" ");
const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
const queue = client.queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel;
if (
client.global.db.guilds[msg.guild.id].blacklist.includes(
msg.member.voice.channelID
)
)
return msg.channel.send(client.messages.blackListedVC);
if (!queue) {
if (!msg.member.voice.channel)
return msg.channel.send(client.messages.noVoiceChannel);
} else {
if (voiceChannel !== queue.voiceChannel)
return msg.channel.send(client.messages.wrongVoiceChannel);
}
if (!args[1]) return msg.channel.send(client.messages.noQuery);
if (voiceChannel.full) return msg.channel.send(client.messages.channelFull);
if (!voiceChannel.joinable)
return msg.channel.send(client.messages.noPermsConnect);
if (!voiceChannel.speakable)
return msg.channel.send(client.messages.noPermsSpeak);
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];
spotify.getPlaylist(playlistId).then(
async function (data) {
const lmsg = await msg.channel.send(client.messages.loadingSongs);
let failed = 0;
for (let i = 0; data.body.tracks.items.length > i; i++) {
const track = await data.body.tracks.items[i].track;
await client.funcs.sleep(250);
await search(
`${track.artists[0].name} ${track.name} audio`,
async function (err, res) {
if (err) return console.log(err);
if (res.videos.length === 0) {
await search(
`${track.artists[0].name} ${track.name} lyrics`,
async function (err, res) {
if (err) return console.log(err);
if (res.videos.length === 0) {
await search(
`${track.artists[0].name} ${track.name}`,
async function (err, res) {
if (err) return console.log(err);
if (res.videos.length === 0) {
failed++;
return;
}
await client.funcs.handleVideo(
res.videos[0],
msg,
voiceChannel,
client,
true,
"ytdl"
);
}
);
return;
}
await client.funcs.handleVideo(
res.videos[0],
msg,
voiceChannel,
client,
true,
"ytdl"
);
}
);
failed++;
return;
}
await client.funcs.handleVideo(
res.videos[0],
msg,
voiceChannel,
client,
true,
"ytdl"
);
}
);
}
let message;
if (failed === 0) {
message = client.messages.playlistAdded.replace(
"%TITLE%",
data.body.name
);
} else {
message = `${client.messages.playlistAdded.replace(
"%TITLE%",
data.body.name
)}\n${client.messages.failedToLoad + failed}`;
}
lmsg.edit(message);
},
function (err) {
console.log(err);
msg.channel.send(client.messages.noResults);
}
);
} else if (
url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)
) {
const lmsg = await msg.channel.send(client.messages.loadingSongs);
const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos();
for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id);
await client.funcs.handleVideo(
video2,
msg,
voiceChannel,
client,
true,
"ytdl"
);
}
let message;
message = client.messages.playlistAdded.replace(
"%TITLE%",
playlist.title
);
return lmsg.edit(message);
} else {
search(searchString, function (err, res) {
if (err) return console.log(err);
if (res.videos.length === 0)
return msg.channel.send(client.messages.noResults);
client.funcs.handleVideo(
res.videos[0],
msg,
voiceChannel,
client,
false,
"ytdl"
);
});
}
},
};

View File

@ -1,25 +1,31 @@
module.exports = {
name: 'remove',
alias: 'rm',
usage: '<song pos>',
description: 'Remove a song from the queue',
onlyDev: false,
permission: 'MANAGE_MESSAGES',
category: 'music',
execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) {
if (!args[1]) return msg.channel.send(client.messages.provideASong);
const pos = parseInt(args[1]);
if (isNaN(pos)) return msg.channel.send(client.messages.validNumber);
if (pos < 1) return msg.channel.send(client.messages.noSongs);
let message1;
let message2;
message1 = client.messages.queueLength.replace("%LENGTH%", queue.songs.length);
if (pos > queue.songs.length) return msg.channel.send(message1);
message2 = client.messages.removed.replace("%SONG%", queue.songs[pos].title);
msg.channel.send(message2);
return queue.songs.splice(pos, 1);
}
name: "remove",
alias: "rm",
usage: "<song pos>",
description: "Remove a song from the queue",
onlyDev: false,
permission: "MANAGE_MESSAGES",
category: "music",
execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) {
if (!args[1]) return msg.channel.send(client.messages.provideASong);
const pos = parseInt(args[1]);
if (isNaN(pos)) return msg.channel.send(client.messages.validNumber);
if (pos < 1) return msg.channel.send(client.messages.noSongs);
let message1;
let message2;
message1 = client.messages.queueLength.replace(
"%LENGTH%",
queue.songs.length
);
if (pos > queue.songs.length) return msg.channel.send(message1);
message2 = client.messages.removed.replace(
"%SONG%",
queue.songs[pos].title
);
msg.channel.send(message2);
return queue.songs.splice(pos, 1);
}
},
};

View File

@ -1,29 +1,36 @@
module.exports = {
name: 'seek',
alias: 'none',
usage: '<point in song>',
description: 'Seek to a specific point in the currently playing song.',
onlyDev: true,
permission: 'MANAGE_MESSAGES',
category: 'music',
async execute(msg, args, client, Discord, command) {
const ytdl = require('ytdl-core');
const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) {
let data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
if (!args[1]) return msg.channel.send(`${client.messages.correctUsage}\`${client.global.db.guilds[msg.guild.id].prefix}seek ${command.usage}\``);
let point = args[1];
const pos = parseInt(args[1]);
if (isNaN(pos)) {
if (pos < 0) return msg.channel.send(client.messages.seekingPointPositive);
let message;
message = client.messages.seekMax.replace("%LENGTH%", data.length_seconds);
if (pos > data.length_seconds) return msg.channel.send(message);
point = pos;
}
queue.connection.dispatcher.end();
queue.endReason = "seek";
client.funcs.play(msg.guild, queue.songs[0], client, msg, point, false);
}
name: "seek",
alias: "none",
usage: "<point in song (seconds)>",
description: "Seek to a specific point in the currently playing song.",
onlyDev: false,
permission: "MANAGE_MESSAGES",
category: "music",
async execute(msg, args, client, Discord, command) {
const ytdl = require("ytdl-core");
const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) {
if (queue.nigthCore)
return msg.channel.send(client.messages.disableNigthCore);
let data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
if (!args[1])
return msg.channel.send(
`${client.messages.correctUsage}\`${
client.global.db.guilds[msg.guild.id].prefix
}seek ${command.usage}\``
);
const pos = parseInt(args[1]);
if (isNaN(pos)) {
if (pos < 0)
return msg.channel.send(client.messages.seekingPointPositive);
let message;
message = client.messages.seekMax.replace(
"%LENGTH%",
data.length_seconds
);
if (pos > data.length_seconds) return msg.channel.send(message);
}
client.funcs.end(client, msg, pos, command);
}
},
};

View File

@ -1,32 +1,68 @@
module.exports = {
name: 'settings',
alias: 'pref',
usage: '<setting> <value(opt)>',
description: 'Change the server settings for Musix.',
name: "settings",
alias: "pref",
usage: "<setting> <value(opt)>",
description: "Change the server settings for Musix.",
onlyDev: false,
permission: 'MANAGE_GUILD',
category: 'util',
permission: "MANAGE_GUILD",
category: "util",
async execute(msg, args, client, Discord, command) {
let footer;
footer = client.messages.settingsFooter.replace("%PREFIX%", client.global.db.guilds[msg.guild.id].prefix);
footer = client.messages.settingsFooter.replace(
"%PREFIX%",
client.global.db.guilds[msg.guild.id].prefix
);
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.settingsTitle)
.addField(client.messages.settingsPrefix, client.messages.settingsPrefixDesc, true)
.addField(client.messages.settingsVolume, client.messages.settingsVolumeDesc, true)
.addField(client.messages.settingsPermissions, client.messages.settingsPermissionsDesc, true)
.addField(client.messages.settingsSetDj, client.messages.settingsSetDjDesc, true)
.addField(client.messages.settingsAnnounceSongs, client.messages.settingsAnnounceSongsDesc)
.addField(client.messages.settingsBass, client.messages.settingsBassDesc, true)
.addField(
client.messages.settingsPrefix,
client.messages.settingsPrefixDesc,
true
)
.addField(
client.messages.settingsVolume,
client.messages.settingsVolumeDesc,
true
)
.addField(
client.messages.settingsBlacklist,
client.messages.settingsBlacklist,
true
)
.addField(
client.messages.settingsPermissions,
client.messages.settingsPermissionsDesc,
true
)
.addField(
client.messages.settingsSetDj,
client.messages.settingsSetDjDesc,
true
)
.addField(
client.messages.settingsAnnounceSongs,
client.messages.settingsAnnounceSongsDesc
)
.addField(
client.messages.settingsBass,
client.messages.settingsBassDesc,
true
)
.setFooter(footer)
.setAuthor(client.user.username, client.user.displayAvatarURL)
.setColor(client.config.embedColor)
.setColor(client.config.embedColor);
const permissions = msg.channel.permissionsFor(msg.author);
if (msg.author.id !== client.config.devId) {
if (!permissions.has(command.permission)) return msg.channel.send(client.messages.noPermsManageSettings);
if (!permissions.has(command.permission))
return msg.channel.send(client.messages.noPermsManageSettings);
}
if (args[1]) {
const optionName = args[1].toLowerCase();
const option = client.settingCmd.get(optionName) || client.settingCmd.find(cmd => cmd.aliases && cmd.aliases.includes(optionName));
const option =
client.settingCmd.get(optionName) ||
client.settingCmd.find(
(cmd) => cmd.aliases && cmd.aliases.includes(optionName)
);
if (!option) return msg.channel.send(embed);
try {
option.execute(msg, args, client);
@ -34,9 +70,12 @@ module.exports = {
msg.reply(client.messages.errorExeOpt);
const embed = new Discord.MessageEmbed()
.setTitle(`Musix ${error.toString()}`)
.setDescription(error.stack.replace(/at /g, '**at **'))
.setDescription(error.stack.replace(/at /g, "**at **"))
.setColor(client.config.embedColor);
client.fetchUser(client.config.devId).then(user => user.send(embed)).catch(console.error);
client
.fetchUser(client.config.devId)
.then((user) => user.send(embed))
.catch(console.error);
client.users.cache.get(client.config.devId).send(embed);
}
} else {

View File

@ -0,0 +1,109 @@
const discord = require("discord.js");
module.exports = {
name: "blacklist",
async execute(msg, args, client) {
if (args[2] === "add") {
if (msg.mentions.channels.first()) {
if (
client.global.db.guilds[msg.guild.id].blacklist.includes(
msg.mentions.channels.first().id
)
)
return msg.channel.send(client.messages.channelAlreadyBlackListed);
} else if (
client.global.db.guilds[msg.guild.id].blacklist.includes(args[3])
)
return msg.channel.send(client.messages.channelAlreadyBlackListed);
if (
!msg.guild.channels.cache.get(args[3]) &&
!msg.mentions.channels.first()
)
return msg.channel.send(client.messages.idOrMentionChannel);
if (msg.mentions.channels.first()) {
client.global.db.guilds[msg.guild.id].blacklist.push(
msg.mentions.channels.first().id
);
let message;
message = client.messages.channelAdded.replace(
"%CHANNEL%",
msg.mentions.channels.first().name
);
msg.channel.send(message);
} else {
client.global.db.guilds[msg.guild.id].blacklist.push(args[3]);
let message;
message = client.messages.channelAdded.replace(
"%CHANNEL%",
msg.guild.channels.cache.get(args[3]).name
);
msg.channel.send(message);
}
} else if (args[2] === "remove") {
if (msg.mentions.channels.first()) {
if (
!client.global.db.guilds[msg.guild.id].blacklist.includes(
msg.mentions.channels.first().id
)
)
return msg.channel.send(client.messages.channelNotBlackListed);
if (
client.global.db.guilds[msg.guild.id].blacklist.indexOf(
msg.mentions.channels.first().id
) !== -1
) {
client.global.db.guilds[msg.guild.id].blacklist.splice(
client.global.db.guilds[msg.guild.id].blacklist.indexOf(
msg.mentions.channels.first().id
),
1
);
let message;
message = client.messages.channelRemoved.replace(
"%CHANNEL%",
msg.mentions.channels.first().name
);
}
} else {
if (!client.global.db.guilds[msg.guild.id].blacklist.includes(args[3]))
return msg.channel.send(client.messages.channelNotBlackListed);
if (
client.global.db.guilds[msg.guild.id].blacklist.indexOf(args[3]) !==
-1
) {
client.global.db.guilds[msg.guild.id].blacklist.splice(
client.global.db.guilds[msg.guild.id].blacklist.indexOf(args[3]),
1
);
let message;
message = client.messages.channelRemoved.replace(
"%CHANNEL%",
msg.guild.channels.cache.get(args[3]).name
);
msg.channel.send(message);
}
}
} else if (args[2] === "list") {
const embed = new discord.MessageEmbed()
.setTitle(client.messages.blacklistTitle)
.setDescription(
`${client.global.db.guilds[msg.guild.id].blacklist
.map((c) => `**-** <#${c}>`)
.join("\n")}`
)
.setColor(client.config.embedColor);
msg.channel.send(embed);
} else {
const embed = new discord.MessageEmbed()
.setTitle(client.messages.blacklistTitle)
.addField("add", "Add a channel to the blacklist. (ID or mention)")
.addField(
"remove",
"Remove a channel from the blacklist. (ID or mention)"
)
.addField("list", "List the currently blacklisted channels.")
.setColor(client.config.embedColor);
msg.channel.send(embed);
}
},
};

View File

@ -0,0 +1,28 @@
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}`
);
if (client.global.db.guilds[args[2]].premium === false) {
client.global.db.guilds[args[2]].premium = true;
let message;
message = client.messages.nowPremium.replace(
"%GUILD%",
client.guilds.cache.get(args[2]).name
);
msg.channel.send(message);
} else if (client.global.db.guilds[args[2]].premium === true) {
client.global.db.guilds[args[2]].premium = false;
let message;
message = client.messages.noMorePremium.replace(
"%GUILD%",
client.guilds.cache.get(args[2]).name
);
msg.channel.send(message);
}
},
};

View File

@ -1,50 +1,62 @@
module.exports = {
name: 'skip',
alias: 's',
usage: '',
description: 'Skip the currently playing song.',
onlyDev: false,
permission: 'MANAGE_MESSAGES',
category: 'music',
execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author);
if (!queue || !queue.playing) return msg.channel.send(client.messages.noServerQueue);
if (msg.author.id !== client.config.devId) {
if (msg.member.voice.channel !== queue.voiceChannel) return msg.channel.send(client.messages.wrongVoiceChannel);
if (client.global.db.guilds[msg.guild.id].permissions) {
if (!msg.member.roles.cache.has(client.global.db.guilds[msg.guild.id].djrole) || !permissions.has(command.permission)) {
return vote(queue, msg, client);
} else {
return skipSong(queue, msg, client);
}
} else {
return skipSong(queue, msg, client);
}
} else {
return skipSong(queue, msg, client);
}
}
name: "skip",
alias: "s",
usage: "",
description: "Skip the currently playing song.",
onlyDev: false,
permission: "MANAGE_MESSAGES",
category: "music",
execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author);
if (!queue || !queue.playing)
return msg.channel.send(client.messages.noServerQueue);
if (msg.author.id !== client.config.devId) {
if (msg.member.voice.channel !== queue.voiceChannel)
return msg.channel.send(client.messages.wrongVoiceChannel);
if (client.global.db.guilds[msg.guild.id].permissions) {
if (
!msg.member.roles.cache.has(
client.global.db.guilds[msg.guild.id].djrole
) ||
!permissions.has(command.permission)
) {
return vote(queue, msg, client);
} else {
return skipSong(queue, msg, client);
}
} else {
return skipSong(queue, msg, client);
}
} else {
return skipSong(queue, msg, client);
}
},
};
function skipSong(queue, msg, client) {
msg.channel.send(client.messages.skipped);
queue.endReason = "skip";
queue.connection.dispatcher.end();
};
msg.channel.send(client.messages.skipped);
queue.endReason = "skip";
queue.time = 0;
queue.connection.dispatcher.end();
}
function vote(queue, msg, client) {
queue.votesNeeded = Math.floor(queue.voiceChannel.members.size / 2);
queue.votesNeeded.toFixed();
if (queue.voiceChannel.members.size > 2) {
if (queue.voters.includes(msg.member.id)) return msg.channel.send(client.messages.alreadyVoted);
queue.votes++;
queue.voters.push(msg.member.id);
if (queue.votes >= queue.votesNeeded) {
queue.voters = [];
queue.votes = 0;
queue.votesNeeded = null;
return skipSong(queue, msg, client);
} else return msg.channel.send(`${client.messages.notEnoughVotes} ${queue.votes} / ${queue.votesNeeded}!`);
} else {
return skipSong(queue, msg, client);
}
};
queue.votesNeeded = Math.floor(queue.voiceChannel.members.size / 2);
queue.votesNeeded.toFixed();
if (queue.voiceChannel.members.size > 2) {
if (queue.voters.includes(msg.member.id))
return msg.channel.send(client.messages.alreadyVoted);
queue.votes++;
queue.voters.push(msg.member.id);
if (queue.votes >= queue.votesNeeded) {
queue.voters = [];
queue.votes = 0;
queue.votesNeeded = null;
return skipSong(queue, msg, client);
} else
return msg.channel.send(
`${client.messages.notEnoughVotes} ${queue.votes} / ${queue.votesNeeded}!`
);
} else {
return skipSong(queue, msg, client);
}
}

View File

@ -1,25 +1,30 @@
module.exports = {
name: 'skipto',
alias: 'st',
usage: '<point in queue>',
description: 'Skip to a point in the queue',
onlyDev: false,
permission: 'MANAGE_MESSAGES',
category: 'music',
async execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) {
if (!args[1]) return msg.channel.send(`${client.messages.correctUsage}\`${command.usage}\``);
let point = parseInt(args[1]);
point = point - 1;
if (isNaN(point)) return msg.channel.send(client.messages.validNumber);
if (point > queue.songs.size) return msg.channel.send(client.messages.noSongs);
if (point < 0) return msg.channel.send(client.messages.cantSkipToCurrent);
for (let i = 0; i < point; i++) {
queue.songs.shift();
}
queue.endReason = "skipto";
queue.connection.dispatcher.end();
}
name: "skipto",
alias: "st",
usage: "<point in queue>",
description: "Skip to a point in the queue",
onlyDev: false,
permission: "MANAGE_MESSAGES",
category: "music",
async execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) {
if (!args[1])
return msg.channel.send(
`${client.messages.correctUsage}\`${command.usage}\``
);
let point = parseInt(args[1]);
point = point - 1;
if (isNaN(point)) return msg.channel.send(client.messages.validNumber);
if (point > queue.songs.size)
return msg.channel.send(client.messages.noSongs);
if (point < 0) return msg.channel.send(client.messages.cantSkipToCurrent);
for (let i = 0; i < point; i++) {
queue.songs.shift();
}
queue.endReason = "skipto";
queue.time = 0;
queue.connection.dispatcher.end();
}
},
};

View File

@ -0,0 +1,22 @@
module.exports = {
name: "soundcloud",
alias: "sc",
usage: "",
description: "",
onlyDev: true,
permission: "dev",
category: "music",
async execute(msg, args, client, Discord, prefix, command) {
const SoundCloud = require("soundcloud-api-client");
const key = client.config.soundCloud_api_key;
const soundcloud = new SoundCloud({ key });
const q = "live mix";
const genres = ["house", "tech-house", "techno"].join(",");
soundcloud
.get("/tracks", { q, genres })
.then((tracks) => console.log(tracks))
.catch((e) => console.error(e));
},
};