1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-09-20 01:21:56 +00:00

Chore update 3.10.0

This commit is contained in:
MatteZ02 2020-07-18 22:33:09 +03:00
parent 1ce6c40a9b
commit ef195e4377
14 changed files with 50 additions and 45 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "musix", "name": "musix",
"version": "3.9.0", "version": "3.10.0",
"description": "V3 for Musix the discord music bot", "description": "V3 for Musix the discord music bot",
"main": "./index.js", "main": "./index.js",
"scripts": { "scripts": {
@ -48,4 +48,4 @@
"ytsr": "^0.1.15", "ytsr": "^0.1.15",
"zlib-sync": "^0.1.7" "zlib-sync": "^0.1.7"
} }
} }

View File

@ -3,7 +3,6 @@ module.exports = {
description: "Boost the bass in your music!", description: "Boost the bass in your music!",
alias: ["none"], alias: ["none"],
usage: "<bass>", usage: "<bass>",
cooldown: 5,
onlyDev: false, onlyDev: false,
permission: "MANAGE_MESSAGES", permission: "MANAGE_MESSAGES",
category: "audio modifiers", category: "audio modifiers",
@ -15,8 +14,8 @@ module.exports = {
); );
const bass = parseFloat(args[1]); const bass = parseFloat(args[1]);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
if (queue.nigthCore) if (queue.nightCore)
return msg.channel.send(client.messages.disableNigthCore); return msg.channel.send(client.messages.disableNightCore);
if (isNaN(bass)) return msg.channel.send(client.messages.validNumber); if (isNaN(bass)) return msg.channel.send(client.messages.validNumber);
if (bass > 10) return msg.channel.send(client.messages.maxBass); if (bass > 10) return msg.channel.send(client.messages.maxBass);
if (bass < 0) return msg.channel.send(client.messages.positiveBass); if (bass < 0) return msg.channel.send(client.messages.positiveBass);

View File

@ -1,8 +1,8 @@
module.exports = { module.exports = {
name: "nigthcore", name: "nightcore",
alias: ["nc"], alias: ["nc"],
usage: "<true/false>", usage: "<true/false>",
description: "Change nigthcore audio modifier on/off", description: "Change nightcore audio modifier on/off",
onlyDev: false, onlyDev: false,
permission: "MANAGE_MESSAGES", permission: "MANAGE_MESSAGES",
category: "audio modifiers", category: "audio modifiers",
@ -10,16 +10,16 @@ module.exports = {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (!args[1] && queue) if (!args[1] && queue)
return msg.channel.send( return msg.channel.send(
`${client.messages.currentNigthCore}**${queue.nigthCore}**` `${client.messages.currentNightCore}**${queue.nightCore}**`
); );
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
if (args[1] === "true") { if (args[1] === "true") {
queue.nigthCore = true; queue.nightCore = true;
} else if (args[1] === "false") { } else if (args[1] === "false") {
queue.nigthCore = false; queue.nightCore = false;
} else return msg.channel.send(client.messages.boolean); } else return msg.channel.send(client.messages.boolean);
let message; let message;
message = client.messages.nigthCoreApplied.replace("%BOOLEAN%", args[1]); message = client.messages.nightCoreApplied.replace("%BOOLEAN%", args[1]);
return msg.channel.send(message); return msg.channel.send(message);
} }
}, },

View File

@ -38,7 +38,7 @@ module.exports = {
.setURL(queue.songs[0].url) .setURL(queue.songs[0].url)
.setThumbnail(thumbnail.url) .setThumbnail(thumbnail.url)
.setColor(client.config.embedColor); .setColor(client.config.embedColor);
if (queue.nigthCore) if (queue.nightCore)
embed.setDescription( embed.setDescription(
`${client.messages.nowPlayingDesc} ${queue.songs[0].title} \nchannel: \`${queue.songs[0].info.author.name}\`` `${client.messages.nowPlayingDesc} ${queue.songs[0].title} \nchannel: \`${queue.songs[0].info.author.name}\``
); );

View File

@ -50,18 +50,12 @@ module.exports = {
client.spotify.searchTracks(`track:${videos[videoIndex].title}`) client.spotify.searchTracks(`track:${videos[videoIndex].title}`)
.then(function (data) { .then(function (data) {
client.funcs.handleVideo( client.funcs.handleVideo(
videoResults[0].link, videos[videoIndex].link, msg, voiceChannel, client, false, "ytdl",
msg,
voiceChannel,
client,
false,
"ytdl",
data.body.tracks.items[0] data.body.tracks.items[0]
); );
}, function (err) { }, function (err) {
console.log('Something went wrong!', err); console.log('Something went wrong!', err);
}); });
return client.funcs.handleVideo(videos[videoIndex].link, msg, voiceChannel, client, false, "ytdl");
}) })
} }
}; };

View File

@ -9,8 +9,8 @@ module.exports = {
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
if (queue.nigthCore) if (queue.nightCore)
return msg.channel.send(client.messages.disableNigthCore); return msg.channel.send(client.messages.disableNightCore);
if (!args[1]) if (!args[1])
return msg.channel.send( return msg.channel.send(
`${client.messages.correctUsage}\`${ `${client.messages.correctUsage}\`${

View File

@ -1,5 +1,3 @@
const ms = require("ms");
module.exports = { module.exports = {
name: "message", name: "message",
async execute(client, msg, Discord) { async execute(client, msg, Discord) {

View File

@ -41,7 +41,7 @@ function findSimilar(client, queue, prevSongs, guild) {
let retries = 0; let retries = 0;
const query = const query =
prevSongs[Math.floor(Math.random() * Math.floor(prevSongs.length))]; prevSongs[Math.floor(Math.random() * Math.floor(prevSongs.length))];
if (!query || !query.track) return client.funcs.play(guild, queue.songs[0], client, 0, true); if (!query || !query.track) return findSimilar(client, queue, prevSongs, guild);
similarSongs.find({ similarSongs.find({
title: query.track.name, title: query.track.name,
artist: query.track.artists[0].name, artist: query.track.artists[0].name,
@ -52,7 +52,20 @@ function findSimilar(client, queue, prevSongs, guild) {
}, },
async function (err, songs) { async function (err, songs) {
if (err) { if (err) {
if (
err.message ==
'The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota</a>.'
) {
queue.voiceChannel.leave();
queue.exists = false;
client.queue.delete(guild.id);
queue.textChannel.send(client.messages.quotaReached);
return;
}
console.log(err.message); console.log(err.message);
queue.voiceChannel.leave();
queue.exists = false;
client.queue.delete(guild.id);
return queue.textChannel.send(client.messages.error); return queue.textChannel.send(client.messages.error);
} }
if (songs[0]) { if (songs[0]) {

View File

@ -11,8 +11,8 @@ const SpotifyApi = require("spotify-web-api-node");
const YouTube = require("simple-youtube-api"); const YouTube = require("simple-youtube-api");
const config = require("./config/config"); const config = require("./config/config");
const myIntents = new Intents(); const GatewayIntents = new Intents();
myIntents.add( GatewayIntents.add(
1 << 0, // GUILDS 1 << 0, // GUILDS
1 << 7, // GUILD_VOICE_STATES 1 << 7, // GUILD_VOICE_STATES
1 << 9, // GUILD_MESSAGES 1 << 9, // GUILD_MESSAGES
@ -24,7 +24,7 @@ module.exports = class extends Client {
disableEveryone: true, disableEveryone: true,
disabledEvents: ["TYPING_START"], disabledEvents: ["TYPING_START"],
ws: { ws: {
intents: myIntents intents: GatewayIntents
} }
}); });

View File

@ -68,7 +68,7 @@ module.exports.queueConfig = {
songs: [], songs: [],
volume: null, volume: null,
bass: null, bass: null,
nigthCore: false, nightCore: false,
playing: false, playing: false,
paused: false, paused: false,
looping: false, looping: false,

View File

@ -35,7 +35,7 @@ module.exports = {
currentBass: emojis.loudSound + "The current bass is: ", currentBass: emojis.loudSound + "The current bass is: ",
currentDefaultBass: emojis.speaker + "Currect default bass level: ", currentDefaultBass: emojis.speaker + "Currect default bass level: ",
currentDefaultVolume: emojis.speaker + "Current default volume is:", currentDefaultVolume: emojis.speaker + "Current default volume is:",
currentNigthCore: emojis.speaker + "Currect Nigthcore setting: ", currentNightCore: emojis.speaker + "Currect Nightcore setting: ",
currentPrefix: "Current prefix:", currentPrefix: "Current prefix:",
currentVolume: emojis.loudSound + "The current volume is: ", currentVolume: emojis.loudSound + "The current volume is: ",
dbSaved: emojis.green_check_mark + "DB Saved!", dbSaved: emojis.green_check_mark + "DB Saved!",
@ -47,7 +47,7 @@ module.exports = {
devMode: emojis.redx + devMode: emojis.redx +
"Dev mode has been turned on! Commands are only available to developer(s)!", "Dev mode has been turned on! Commands are only available to developer(s)!",
disabledSpotifySongs: emojis.redx + "Spotify songs cannot be played currently!", disabledSpotifySongs: emojis.redx + "Spotify songs cannot be played currently!",
disableNigthCore: emojis.redx + "Please disable nigthCore in order to use this command!", disableNightCore: emojis.redx + "Please disable nightCore in order to use this command!",
dispatcherError: "Error with the dispatcher: ", dispatcherError: "Error with the dispatcher: ",
djFalse: emojis.green_check_mark + "`DJ` now set to `false`", djFalse: emojis.green_check_mark + "`DJ` now set to `false`",
djRoleCreated: emojis.green_check_mark + djRoleCreated: emojis.green_check_mark +
@ -84,8 +84,8 @@ module.exports = {
mentionChannel: emojis.redx + "Please mention a channel!", mentionChannel: emojis.redx + "Please mention a channel!",
musicCommandsDisabled: emojis.redx + musicCommandsDisabled: emojis.redx +
"This channels has been blacklisted! Music commands cannot be used here!", "This channels has been blacklisted! Music commands cannot be used here!",
nigthCoreApplied: emojis.green_check_mark + nightCoreApplied: emojis.green_check_mark +
"NigthCore is now **%BOOLEAN%** this will be applied when the next song starts playing!", "NightCore is now **%BOOLEAN%** this will be applied when the next song starts playing!",
noDj: emojis.redx + "You need the `DJ` role to use this command!", noDj: emojis.redx + "You need the `DJ` role to use this command!",
noLooping: emojis.repeat + "No longer looping the queue!", noLooping: emojis.repeat + "No longer looping the queue!",
noLoopingSong: emojis.repeatSong + "No longer looping the song!", noLoopingSong: emojis.repeatSong + "No longer looping the song!",

View File

@ -2,11 +2,11 @@ module.exports = async function (client, msg, pos, command) {
const seek = parseInt(pos); const seek = parseInt(pos);
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (command.name === "seek") { if (command.name === "seek") {
queue.time = pos * 1000; queue.time = seek * 1000;
} else { } else {
queue.time = queue.connection.dispatcher.streamTime + queue.time; queue.time = queue.connection.dispatcher.streamTime + queue.time;
} }
queue.connection.dispatcher.end(); queue.connection.dispatcher.end();
queue.endReason = "seek"; queue.endReason = "seek";
client.funcs.play(msg.guild, queue.songs[0], client, seek, false); client.funcs.play(msg.guild, queue.songs[0], client, seek, false);
}; };

View File

@ -39,7 +39,7 @@ module.exports = async function (
prevSongs: [], prevSongs: [],
volume: client.global.db.guilds[msg.guild.id].defaultVolume, volume: client.global.db.guilds[msg.guild.id].defaultVolume,
bass: client.global.db.guilds[msg.guild.id].bass, bass: client.global.db.guilds[msg.guild.id].bass,
nigthCore: false, nightCore: false,
playing: false, playing: false,
paused: false, paused: false,
looping: false, looping: false,

View File

@ -1,13 +1,14 @@
const {
Readable: ReadableStream
} = require("stream");
const Discord = require("discord.js");
const ytdl = require("ytdl-core");
const {
streamConfig
} = require("../config/config.js");
const prism = require("prism-media");
module.exports = async function (guild, song, client, seek, play) { module.exports = async function (guild, song, client, seek, play) {
const {
Readable: ReadableStream
} = require("stream");
const Discord = require("discord.js");
const ytdl = require("ytdl-core");
const {
streamConfig
} = require("../config/config.js");
const prism = require("prism-media");
const queue = client.queue.get(guild.id); const queue = client.queue.get(guild.id);
if (!song) { if (!song) {
queue.voiceChannel.leave(); queue.voiceChannel.leave();
@ -47,7 +48,7 @@ module.exports = async function (guild, song, client, seek, play) {
`bass=g=${queue.bass}`, `bass=g=${queue.bass}`,
]; ];
client.funcs.sleep(500); client.funcs.sleep(500);
if (queue.nigthCore) { if (queue.nightCore) {
ffmpegArgs.push("-af"); ffmpegArgs.push("-af");
ffmpegArgs.push("asetrate=52920"); ffmpegArgs.push("asetrate=52920");
} }