1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-16 18:56:00 +00:00

Fix code to work on this decade 1/x

This commit is contained in:
Christer Warén
2024-02-10 09:33:59 +02:00
parent 99ecd9787d
commit 86b4676159
61 changed files with 3842 additions and 471 deletions

View File

@ -1,9 +1,8 @@
module.exports = function (client) {
const Discord = require('discord.js');
client.on('ready', () => {
require(`./ready.js`).execute(client, Discord);
require(`./ready.js`).execute(client);
}).on('message', (msg) => {
require(`./msg.js`).execute(client, msg, Discord);
require(`./msg.js`).execute(client, msg);
}).on('guildCreate', (guild) => {
require(`./guildCreate.js`).execute(client, guild);
})
@ -34,4 +33,4 @@ module.exports = function (client) {
client.logs.push(`Warn! info: ${info}`);
console.log(`Warn! info: ${info}`);
});
}
}

View File

@ -27,7 +27,7 @@ module.exports = {
},
};
function getCommand(client, args, msg, Discord) {
function getCommand(client, args, msg) {
if (!args[0]) return;
const commandName = args[0].toLowerCase();
if (commandName === "none") return;
@ -37,8 +37,5 @@ function getCommand(client, args, msg, Discord) {
(cmd) => cmd.alias && cmd.alias.includes(commandName)
);
if (!command) return;
if (command.onlyDev && msg.author.id !== client.config.devId) return msg.channel.send(client.messages.onlyDev);
if (client.config.devMode && msg.member.id !== client.config.devId && msg.guild.id !== "718081535240306738")
return msg.channel.send(client.messages.devMode);
client.funcs.exe(msg, args, client, Discord, command);
client.funcs.exe(msg, args, client, command);
}

View File

@ -29,7 +29,6 @@ module.exports = {
client.user.setActivity(`@${client.user.username} help | 🎶`, {
type: "LISTENING",
});
if (client.config.api && !client.config.devMode) client.funcs.botListApi(client);
client.user.setStatus("online");
client.funcs.getSpotifyKey(client);
console.log(`- Activated - Shard: ${client.shard.ids} -`);
@ -42,8 +41,5 @@ module.exports = {
setInterval(() => {
client.funcs.getSpotifyKey(client);
}, 3600000);
setInterval(() => {
client.funcs.ffmpeg(client, Discord);
}, 7200000);
},
};
};

View File

@ -1,6 +1,5 @@
const similarSongs = require("similar-songs");
const ytdl = require("ytdl-core");
const Discord = require("discord.js");
module.exports = {
async execute(client, guild) {
@ -48,7 +47,7 @@ function findSimilar(client, queue, prevSongs, guild) {
limit: 10,
lastfmAPIKey: client.config.lastfm_api_key,
lastfmAPISecret: client.config.lastfm_secret,
youtubeAPIKey: client.config.api_keys[(client.shard.ids / 2).toFixed() || client.config.api_key],
youtubeAPIKey: client.config.youtube_api_key,
},
async function (err, songs) {
if (err) {
@ -74,7 +73,7 @@ function findSimilar(client, queue, prevSongs, guild) {
`https://www.youtube.com/watch?v=${songs[random].youtubeId}`
);
queue.songs.push({
title: Discord.Util.escapeMarkdown(songInfo.videoDetails.title),
title: songInfo.videoDetails.title,
url: `https://www.youtube.com/watch?v=${songs[random].youtubeId}`,
author: client.user,
type: "ytdl",
@ -93,4 +92,4 @@ function findSimilar(client, queue, prevSongs, guild) {
}
}
);
}
}