1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 09:53: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) { async execute(client, msg, Discord) {
if (msg.author.bot || !msg.guild) return; if (msg.author.bot || !msg.guild) return;
let prefix = client.global.db.guilds[msg.guild.id].prefix; 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(' '); const args = msg.content.slice(prefix.length).split(' ');
if (msg.mentions.users.first()) { if (msg.mentions.users.first()) {
if (msg.mentions.users.first().id === client.user.id) { if (msg.mentions.users.first().id === client.user.id) {
@ -17,11 +17,11 @@ module.exports = {
} }
if (!msg.content.startsWith(prefix)) return; if (!msg.content.startsWith(prefix)) return;
if (!args[0]) 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 commandName = args[0].toLowerCase();
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName); 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 && 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 (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); client.funcs.exe(msg, args, client, Discord, prefix, command);
} }
} }

View File

@ -7,7 +7,8 @@ module.exports = {
remoteMusixGuildsData.forEach(guildData => { remoteMusixGuildsData.forEach(guildData => {
client.global.db.guilds[guildData.id] = guildData.d; 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.guilds.cache.forEach(guild => {
client.global.db.guilds[guild.id] = { client.global.db.guilds[guild.id] = {
prefix: client.config.prefix, prefix: client.config.prefix,
@ -15,7 +16,8 @@ module.exports = {
permissions: client.config.permissions, permissions: client.config.permissions,
dj: client.config.dj, dj: client.config.dj,
djrole: client.config.djrole, 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, premium: client.global.db.guilds[guild.id].premium,
dj: client.global.db.guilds[guild.id].dj, dj: client.global.db.guilds[guild.id].dj,
djrole: client.global.db.guilds[guild.id].djrole, 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, saveDB: true,
//db values //db values
prefix: ">", prefix: ">",
devPrefix: "-",
defaultVolume: 5, defaultVolume: 5,
permissions: false, permissions: false,
dj: false, dj: false,
djrole: null, djrole: null,
startPlaying: true, 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 Discord = require('discord.js');
const ytdl = require('ytdl-core'); const ytdl = require('ytdl-core');
const getThumb = require('video-thumbnail-url'); const getThumb = require('video-thumbnail-url');
const prism = require('prism-media');
const serverQueue = client.queue.get(guild.id); const serverQueue = client.queue.get(guild.id);
if (!song) { if (!song) {
@ -10,8 +11,9 @@ module.exports = async function (guild, song, client, seek, play) {
client.queue.delete(guild.id); client.queue.delete(guild.id);
return; return;
} }
const dispatcher = serverQueue.connection 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 => { .on("finish", reason => {
client.dispatcher.finish(client, reason, guild); client.dispatcher.finish(client, reason, guild);
}); });