1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-22 21:13:18 +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",
"version": "3.9.0",
"version": "3.10.0",
"description": "V3 for Musix the discord music bot",
"main": "./index.js",
"scripts": {
@ -48,4 +48,4 @@
"ytsr": "^0.1.15",
"zlib-sync": "^0.1.7"
}
}
}

View File

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

View File

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

View File

@ -38,7 +38,7 @@ module.exports = {
.setURL(queue.songs[0].url)
.setThumbnail(thumbnail.url)
.setColor(client.config.embedColor);
if (queue.nigthCore)
if (queue.nightCore)
embed.setDescription(
`${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}`)
.then(function (data) {
client.funcs.handleVideo(
videoResults[0].link,
msg,
voiceChannel,
client,
false,
"ytdl",
videos[videoIndex].link, msg, voiceChannel, client, false, "ytdl",
data.body.tracks.items[0]
);
}, function (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) {
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);
if (queue.nightCore)
return msg.channel.send(client.messages.disableNightCore);
if (!args[1])
return msg.channel.send(
`${client.messages.correctUsage}\`${

View File

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

View File

@ -41,7 +41,7 @@ function findSimilar(client, queue, prevSongs, guild) {
let retries = 0;
const query =
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({
title: query.track.name,
artist: query.track.artists[0].name,
@ -52,7 +52,20 @@ function findSimilar(client, queue, prevSongs, guild) {
},
async function (err, songs) {
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);
queue.voiceChannel.leave();
queue.exists = false;
client.queue.delete(guild.id);
return queue.textChannel.send(client.messages.error);
}
if (songs[0]) {

View File

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

View File

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

View File

@ -35,7 +35,7 @@ module.exports = {
currentBass: emojis.loudSound + "The current bass is: ",
currentDefaultBass: emojis.speaker + "Currect default bass level: ",
currentDefaultVolume: emojis.speaker + "Current default volume is:",
currentNigthCore: emojis.speaker + "Currect Nigthcore setting: ",
currentNightCore: emojis.speaker + "Currect Nightcore setting: ",
currentPrefix: "Current prefix:",
currentVolume: emojis.loudSound + "The current volume is: ",
dbSaved: emojis.green_check_mark + "DB Saved!",
@ -47,7 +47,7 @@ module.exports = {
devMode: emojis.redx +
"Dev mode has been turned on! Commands are only available to developer(s)!",
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: ",
djFalse: emojis.green_check_mark + "`DJ` now set to `false`",
djRoleCreated: emojis.green_check_mark +
@ -84,8 +84,8 @@ module.exports = {
mentionChannel: emojis.redx + "Please mention a channel!",
musicCommandsDisabled: emojis.redx +
"This channels has been blacklisted! Music commands cannot be used here!",
nigthCoreApplied: emojis.green_check_mark +
"NigthCore is now **%BOOLEAN%** this will be applied when the next song starts playing!",
nightCoreApplied: emojis.green_check_mark +
"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!",
noLooping: emojis.repeat + "No longer looping the queue!",
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 queue = client.queue.get(msg.guild.id);
if (command.name === "seek") {
queue.time = pos * 1000;
queue.time = seek * 1000;
} else {
queue.time = queue.connection.dispatcher.streamTime + queue.time;
}
queue.connection.dispatcher.end();
queue.endReason = "seek";
client.funcs.play(msg.guild, queue.songs[0], client, seek, false);
};
};

View File

@ -39,7 +39,7 @@ module.exports = async function (
prevSongs: [],
volume: client.global.db.guilds[msg.guild.id].defaultVolume,
bass: client.global.db.guilds[msg.guild.id].bass,
nigthCore: false,
nightCore: false,
playing: false,
paused: 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) {
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);
if (!song) {
queue.voiceChannel.leave();
@ -47,7 +48,7 @@ module.exports = async function (guild, song, client, seek, play) {
`bass=g=${queue.bass}`,
];
client.funcs.sleep(500);
if (queue.nigthCore) {
if (queue.nightCore) {
ffmpegArgs.push("-af");
ffmpegArgs.push("asetrate=52920");
}