1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 00:23:17 +00:00
This commit is contained in:
MatteZ02 2020-02-20 22:31:03 +02:00
parent 6c0ed31c1b
commit 282ac01b3b
4 changed files with 13 additions and 6 deletions

View File

@ -3,7 +3,7 @@ module.exports = {
async execute(client, msg, Discord) {
if (msg.author.bot || !msg.guild) return;
let prefix = client.global.db.guilds[msg.guild.id].prefix;
if (client.config.devMode) prefix = "-";
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) {
@ -17,11 +17,11 @@ module.exports = {
}
if (!msg.content.startsWith(prefix)) return;
if (!args[0]) return;
if (client.config.devMode && msg.member.id !== client.config.devId) return msg.channel.send('<:redx:674263474704220182> Dev mode has been turned on! Commands are only available to developer(s)!');
const commandName = args[0].toLowerCase();
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 msg.channel.send('<:redx:674263474704220182> You are not allowed to do that!');
if (client.config.devMode && msg.member.id !== client.config.devId) return msg.channel.send('<:redx:674263474704220182> Dev mode has been turned on! Commands are only available to developer(s)!');
client.funcs.exe(msg, args, client, Discord, prefix, command);
}
}

View File

@ -7,7 +7,8 @@ module.exports = {
remoteMusixGuildsData.forEach(guildData => {
client.global.db.guilds[guildData.id] = guildData.d;
});
if (client.devMode) {
if (client.config.devMode) {
console.log('dev mode');
client.guilds.cache.forEach(guild => {
client.global.db.guilds[guild.id] = {
prefix: client.config.prefix,
@ -15,7 +16,8 @@ module.exports = {
permissions: client.config.permissions,
dj: client.config.dj,
djrole: client.config.djrole,
startPlaying: client.config.startPlaying
startPlaying: client.config.startPlaying,
bass: client.config.bass,
};
});
}
@ -41,7 +43,8 @@ module.exports = {
premium: client.global.db.guilds[guild.id].premium,
dj: client.global.db.guilds[guild.id].dj,
djrole: client.global.db.guilds[guild.id].djrole,
startPlaying: client.global.db.guilds[guild.id].startPlaying
startPlaying: client.global.db.guilds[guild.id].startPlaying,
bass: client.global.db.guilds[guild.id].bass,
});
});
}

View File

@ -20,9 +20,11 @@ module.exports = {
saveDB: true,
//db values
prefix: ">",
devPrefix: "-",
defaultVolume: 5,
permissions: false,
dj: false,
djrole: null,
startPlaying: true,
bass: false,
}

View File

@ -2,6 +2,7 @@ module.exports = async function (guild, song, client, seek, play) {
const Discord = require('discord.js');
const ytdl = require('ytdl-core');
const getThumb = require('video-thumbnail-url');
const prism = require('prism-media');
const serverQueue = client.queue.get(guild.id);
if (!song) {
@ -10,8 +11,9 @@ module.exports = async function (guild, song, client, seek, play) {
client.queue.delete(guild.id);
return;
}
const dispatcher = serverQueue.connection
.play(await ytdl(song.url, { filter: "audio", highWaterMark: /*512*/1 << 25, volume: false }), { seek: seek, bitrate: 1024, passes: 10, volume: 1 })
.play(ytdl(song.url), { filter: "audio", highWaterMark: 1 << 25, volume: false, seek: seek, bitrate: 1024, passes: 10, bassboost: client.global.db.guilds[guild.id].bass })
.on("finish", reason => {
client.dispatcher.finish(client, reason, guild);
});