Initial commit

This commit is contained in:
Lantium 2022-04-03 04:34:37 +02:00
commit 0b6ed92a61
38 changed files with 2421 additions and 0 deletions

BIN
assets/choose.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 KiB

View File

@ -0,0 +1,28 @@
module.exports = {
name: 'lan',
aliases: [],
utilisation: '{prefix}lan',
async execute(client, message) {
const destinataire = message.guild.members.cache.get("873717324035809291");
//302917031840186369
const msg = "Va te faire Braire !!!"
if (message.author.id != "327193195085824001") return;
var i;
for (i = 0; i < 50; i++) {
setTimeout(() => {
destinataire.send(msg);
}, 1 * 1)
}
}
}

View File

@ -0,0 +1,37 @@
module.exports = {
name: 'reboot',
aliases: [],
utilisation: '{prefix}reboot',
async execute(client, message) {
// Lantium = "327193195085824001";
// Cecile = "321032586455547915";
// Antho = "304970614739828746";
// Leethium = "241299910488621066";
// Nico = "182412174138933249";
// Lumikkode = "191117029606948864";
// Second = "906122784999096350";
// Hunter = "206881400333402112";
// Manyx = "302808060617818113";
let Members = [
"327193195085824001",
"321032586455547915",
"304970614739828746",
"241299910488621066",
"182412174138933249",
"191117029606948864",
"906122784999096350",
"206881400333402112",
"302808060617818113",
]
if (!Members.includes(message.author.id))
return message.channel.send("Cette commande est réservé au développeur de LanBot");
await message.channel.send("Reboot en cours...");
await process.exit();
},
};

View File

@ -0,0 +1,29 @@
module.exports = {
name: 'res',
aliases: [],
utilisation: '{prefix}res',
async execute(client, message) {
const { exec } = require("child_process");
// if (!args[0]) return message.channel.send("Il faut mettre le lien de la musique ! ");
message.channel.send(`Ta demande a été pris en compte ! `);
const doExec = (cmd, opts = {}) => {
return new Promise((resolve, reject) => {
exec(cmd, opts, (err, stdout, stderr) => {
if (err) return reject({ stdout, stderr });
resolve(stdout);
});
});
};
//::doExec(`deemix -b flac -p /home/Plex/Musiques/ ${args}`) //Ici rentre la commande que tu veux executer
doExec(`touch /storage/Lantium/test.txt`)
},
};

28
commands/core/choose.js Normal file
View File

@ -0,0 +1,28 @@
const { MessageEmbed, MessageAttachment } = require("discord.js");
module.exports = {
name: 'choose',
aliases: [],
utilisation: '{prefix}choose <choix1>,<choix2>',
execute(client, message) {
const arguments = message.content.split(/,+/g);
arguments.shift().toLowerCase();
const Response = Math.floor(Math.random() * arguments.length);
//const attachment = new MessageAttachment("./assets/choose.gif");
const embed = new MessageEmbed()
embed.setColor('RANDOM')
embed.setTitle("Commande Choose")
embed.addField('Par les pouvoirs qui me sont conférés.', `Je choisi : **${arguments[Response]}**`)
embed.setTimestamp();
embed.setImage("https://media.discordapp.net/attachments/924807447372247050/951251866010931301/choose.gif");
message.channel.send({ embeds: [embed] });
},
};

22
commands/core/help.js Normal file
View File

@ -0,0 +1,22 @@
const { MessageEmbed } = require('discord.js');
module.exports = {
name: 'help',
aliases: ['h'],
showHelp: false,
utilisation: '{prefix}help',
execute(client, message, args) {
const embed = new MessageEmbed();
embed.setColor('RED');
embed.setAuthor(client.user.username, client.user.displayAvatarURL({ size: 1024, dynamic: true }));
const commands = client.commands.filter(x => x.showHelp !== false);
embed.addField(`Enabled - ${commands.size}`, commands.map(x => `\`${x.name}${x.aliases[0] ? ` (${x.aliases.map(y => y).join(', ')})\`` : '\`'}`).join(' | '));
embed.setTimestamp();
message.channel.send({ embeds: [embed] });
},
};

17
commands/core/ping.js Normal file
View File

@ -0,0 +1,17 @@
const ms = require('ms');
module.exports = {
name: 'ping',
aliases: [],
utilisation: '{prefix}ping',
async execute(client, message) {
const msg = await message.channel.send("Pong ! ");
msg.edit(`
Pong !
Latence du bot: ${msg.createdTimestamp - message.createdTimestamp}ms
Latence de l'API: ${Math.round(client.ws.ping)}ms
`);
},
};

96
commands/core/todo.js Normal file
View File

@ -0,0 +1,96 @@
const ms = require("ms");
const fs = require("fs");
const path = require("path");
const uuid = require("uuid").v4;
const dbFileName = path.resolve(".", "utils", "todo.json");
let database = [];
module.exports = {
name: "todo",
aliases: ["todo"],
utilisation: "{prefix}todo <time> <salon> <message>",
async onStart(client) {
updateDatabase();
const currentTime = Date.now();
database.forEach((reminder) => {
const delay = reminder.time - currentTime;
if (delay < 0) {
setTimeout(() => {
const discordChannel = client.channels.resolve(reminder.channel);
discordChannel.send(
`La SNCF vous présente ses excuses pour le retard <@${reminder.author}> ! tu m'as demandé de te rappeler\n\`\`\`${reminder.message}\`\`\` `
);
updateDatabase();
database = database.filter((struct) => struct.uuid !== reminder.uuid);
saveDatabase();
}, 1000);
} else {
setTimeout(() => {
const discordChannel = client.channels.resolve(reminder.channel);
discordChannel.send(
`<@${reminder.author}>, tu m'as demandé de te rappeler\n\`\`\`${reminder.message}\`\`\` `
);
updateDatabase();
database = database.filter((struct) => struct.uuid !== reminder.uuid);
saveDatabase();
}, delay);
}
});
console.log("-> ON START !!!!! ça marche putain!");
},
async execute(client, message, args) {
let reveilTime = ms(args[0]);
const defaut = message.channel.id;
const channel = args[1].replace(/[^0-9]/g, "");
let salon = parseInt(channel) ? channel : defaut;
const reason = args.splice(salon == defaut ? 1 : 2).join(" ");
const reminderStruct = {
uuid: uuid(),
author: message.author.id,
time: Date.now() + reveilTime,
channel: salon,
guild: message.guild.id,
message: reason,
};
setTimeout(function () {
const discordChannel = message.guild.channels.cache.get(salon);
discordChannel.send(
`<@${reminderStruct.author}>, tu m'as demandé de te rappeler\n\`\`\`${reminderStruct.message}\`\`\` `
);
updateDatabase();
database = database.filter(
(struct) => struct.uuid !== reminderStruct.uuid
);
saveDatabase();
}, reveilTime);
//check if file todo.json content is empty
updateDatabase();
database.push(reminderStruct);
saveDatabase();
message.react("🤌");
message.react("👌");
},
};
const updateDatabase = () => {
if (fs.existsSync(dbFileName)) {
const fileContent = fs.readFileSync(dbFileName);
database.push(...JSON.parse(fileContent));
}
};
const saveDatabase = () => {
const foundUUIDs = [];
database = database.filter((struct) => {
if (!foundUUIDs.includes(struct.uuid)) {
foundUUIDs.push(struct.uuid);
return true;
}
return false;
});
fs.writeFileSync(dbFileName, JSON.stringify(database, null, 2));
};

View File

@ -0,0 +1,17 @@
const { DiscordTogether } = require('discord-together');
client.discordTogether = new DiscordTogether(client);
module.exports = {
name: 'yttogether',
aliases: ['yttogether', 'yt'],
utilisation: '{prefix}yt',
execute(client, message) {
client.discordTogether.createTogetherCode(message.member.voice.channel.id, 'youtube').then(async invite => {
return message.channel.send(`Pour lancer l'activité merci de cliquer sur le lien suivant : ${invite.code} et pas sur le bouton **Jouer**`);
});
},
};

18
commands/music/back.js Normal file
View File

@ -0,0 +1,18 @@
module.exports = {
name: 'back',
aliases: ['previous'],
utilisation: '{prefix}back',
voiceChannel: true,
async execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
if (!queue.previousTracks[1]) return message.channel.send(`There was no music played before ${message.author}... try again ? ❌`);
await queue.back();
message.channel.send(`Playing the **previous** track ✅`);
},
};

18
commands/music/clear.js Normal file
View File

@ -0,0 +1,18 @@
module.exports = {
name: 'clear',
aliases: ['cq'],
utilisation: '{prefix}clear',
voiceChannel: true,
async execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
if (!queue.tracks[0]) return message.channel.send(`No music in the queue after the current one ${message.author}... try again ? ❌`);
await queue.clear();
message.channel.send(`The queue has just been cleared 🗑️`);
},
};

33
commands/music/filter.js Normal file
View File

@ -0,0 +1,33 @@
module.exports = {
name: 'filter',
aliases: [],
utilisation: '{prefix}filter [filter name]',
voiceChannel: true,
async execute(client, message, args) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
const actualFilter = queue.getFiltersEnabled()[0];
if (!args[0]) return message.channel.send(`Please specify a valid filter to enable or disable ${message.author}... try again ? ❌\n${actualFilter ? `Filter currently active ${actualFilter} (${client.config.app.px}filter ${actualFilter} to disable it).\n` : ''}`);
const filters = [];
queue.getFiltersEnabled().map(x => filters.push(x));
queue.getFiltersDisabled().map(x => filters.push(x));
const filter = filters.find((x) => x.toLowerCase() === args[0].toLowerCase());
if (!filter) return message.channel.send(`This filter doesn't exist ${message.author}... try again ? ❌\n${actualFilter ? `Filter currently active ${actualFilter}.\n` : ''}List of available filters ${filters.map(x => `**${x}**`).join(', ')}.`);
const filtersUpdated = {};
filtersUpdated[filter] = queue.getFiltersEnabled().includes(filter) ? false : true;
await queue.setFilters(filtersUpdated);
message.channel.send(`The filter ${filter} is now **${queue.getFiltersEnabled().includes(filter) ? 'enabled' : 'disabled'}** ✅\n*Reminder the longer the music is, the longer this will take.*`);
},
};

28
commands/music/loop.js Normal file
View File

@ -0,0 +1,28 @@
const { QueueRepeatMode } = require('discord-player');
module.exports = {
name: 'loop',
aliases: ['lp', 'repeat'],
utilisation: '{prefix}loop <queue>',
voiceChannel: true,
execute(client, message, args) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
if (args.join('').toLowerCase() === 'queue') {
if (queue.repeatMode === 1) return message.channel.send(`You must first disable the current music in the loop mode (${client.config.app.px}loop) ${message.author}... try again ? ❌`);
const success = queue.setRepeatMode(queue.repeatMode === 0 ? QueueRepeatMode.QUEUE : QueueRepeatMode.OFF);
return message.channel.send(success ? `Repeat mode **${queue.repeatMode === 0 ? 'disabled' : 'enabled'}** the whole queue will be repeated endlessly 🔁` : `Something went wrong ${message.author}... try again ? ❌`);
} else {
if (queue.repeatMode === 2) return message.channel.send(`You must first disable the current queue in the loop mode (${client.config.app.px}loop queue) ${message.author}... try again ? ❌`);
const success = queue.setRepeatMode(queue.repeatMode === 0 ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF);
return message.channel.send(success ? `Repeat mode **${queue.repeatMode === 0 ? 'disabled' : 'enabled'}** the current music will be repeated endlessly (you can loop the queue with the <queue> option) 🔂` : `Something went wrong ${message.author}... try again ? ❌`);
};
},
};

View File

@ -0,0 +1,41 @@
const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
module.exports = {
name: 'nowplaying',
aliases: ['np'],
utilisation: '{prefix}nowplaying',
voiceChannel: true,
execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
const track = queue.current;
const embed = new MessageEmbed();
embed.setColor('RED');
embed.setThumbnail(track.thumbnail);
embed.setAuthor(track.title, client.user.displayAvatarURL({ size: 1024, dynamic: true }));
const methods = ['disabled', 'track', 'queue'];
const timestamp = queue.getPlayerTimestamp();
const trackDuration = timestamp.progress == 'Infinity' ? 'infinity (live)' : track.duration;
embed.setDescription(`Volume **${queue.volume}**%\nDuration **${trackDuration}**\nLoop mode **${methods[queue.repeatMode]}**\nRequested by ${track.requestedBy}`);
embed.setTimestamp();
const saveButton = new MessageButton();
saveButton.setLabel('Save this track');
saveButton.setCustomId('saveTrack');
saveButton.setStyle('SUCCESS');
const row = new MessageActionRow().addComponents(saveButton);
message.channel.send({ embeds: [embed], components: [row] });
},
};

16
commands/music/pause.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
name: 'pause',
aliases: [],
utilisation: '{prefix}pause',
voiceChannel: true,
execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
const success = queue.setPaused(true);
return message.channel.send(success ? `Current music ${queue.current.title} paused ✅` : `Something went wrong ${message.author}... try again ? ❌`);
},
};

36
commands/music/play.js Normal file
View File

@ -0,0 +1,36 @@
const { QueryType } = require('discord-player');
module.exports = {
name: 'play',
aliases: ['p'],
utilisation: '{prefix}play [song name/URL]',
voiceChannel: true,
async execute(client, message, args) {
if (!args[0]) return message.channel.send(`Please enter a valid search ${message.author}... try again ? ❌`);
const res = await player.search(args.join(' '), {
requestedBy: message.member,
searchEngine: QueryType.AUTO
});
if (!res || !res.tracks.length) return message.channel.send(`No results found ${message.author}... try again ? ❌`);
const queue = await player.createQueue(message.guild, {
metadata: message.channel
});
try {
if (!queue.connection) await queue.connect(message.member.voice.channel);
} catch {
await player.deleteQueue(message.guild.id);
return message.channel.send(`I can't join the voice channel ${message.author}... try again ? ❌`);
}
await message.channel.send(`Loading your ${res.playlist ? 'playlist' : 'track'}... 🎧`);
res.playlist ? queue.addTracks(res.tracks) : queue.addTrack(res.tracks[0]);
if (!queue.playing) await queue.play();
},
};

View File

@ -0,0 +1,19 @@
module.exports = {
name: 'progress',
aliases: ['pbar'],
utilisation: '{prefix}progress',
voiceChannel: true,
async execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
const progress = queue.createProgressBar();
const timestamp = queue.getPlayerTimestamp();
if (timestamp.progress == 'Infinity') return message.channel.send(`Playing a live, no data to display 🎧`);
message.channel.send(`${progress} (**${timestamp.progress}**%)`);
},
};

20
commands/music/purge.js Normal file
View File

@ -0,0 +1,20 @@
module.exports = {
name: 'purge',
aliases: ['purge'],
utilisation: '{prefix}purge',
voiceChannel: false,
async execute(client, message, args) {
if (isNaN(args[0]) || (args[0] < 1 || args[0] > 100)) return message.reply('Il faut spécifier un **nombre** entre 1 et 100 !');
const messages = await message.channel.messages.fetch({
limit: Math.min(args[0], 100),
before: message.id,
});
message.delete();
await message.channel.bulkDelete(messages);
},
};

35
commands/music/queue.js Normal file
View File

@ -0,0 +1,35 @@
const { MessageEmbed } = require('discord.js');
module.exports = {
name: 'queue',
aliases: ['q'],
utilisation: '{prefix}queue',
voiceChannel: true,
execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
if (!queue.tracks[0]) return message.channel.send(`No music in the queue after the current one ${message.author}... try again ? ❌`);
const embed = new MessageEmbed();
const methods = ['', '🔁', '🔂'];
embed.setColor('RED');
embed.setThumbnail(message.guild.iconURL({ size: 2048, dynamic: true }));
embed.setAuthor(`Server queue - ${message.guild.name} ${methods[queue.repeatMode]}`, client.user.displayAvatarURL({ size: 1024, dynamic: true }));
const tracks = queue.tracks.map((track, i) => `**${i + 1}** - ${track.title} | ${track.author} (requested by : ${track.requestedBy.username})`);
const songs = queue.tracks.length;
const nextSongs = songs > 5 ? `And **${songs - 5}** other song(s)...` : `In the playlist **${songs}** song(s)...`;
embed.setDescription(`Current ${queue.current.title}\n\n${tracks.slice(0, 5).join('\n')}\n\n${nextSongs}`);
embed.setTimestamp();
embed.setFooter(message.author.avatarURL({ dynamic: true }));
message.channel.send({ embeds: [embed] });
},
};

18
commands/music/remove.js Normal file
View File

@ -0,0 +1,18 @@
module.exports = {
name: 'remove',
aliases: ['remove', 'rm'],
utilisation: `{prefix}remove <id>`,
voiceChannel: true,
execute(client, message, args) {
const queue = player.getQueue(message.guild.id);
if (!queue || !args[1]) return;
const trackIndex = args[1] - 1;
if(!queue.tracks[trackIndex]) return;
const trackName = queue.tracks[trackIndex].title;
//const trackUrl = queue.tracks[trackIndex].url;
queue.remove(trackIndex);
message.reply(`It's good, ${trackName} removed ! :white_check_mark:`)
},
};

16
commands/music/resume.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
name: 'resume',
aliases: ['rs'],
utilisation: '{prefix}resume',
voiceChannel: true,
execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
const success = queue.setPaused(false);
return message.channel.send(success ? `Current music ${queue.current.title} resumed ✅` : `Something went wrong ${message.author}... try again ? ❌`);
},
};

18
commands/music/save.js Normal file
View File

@ -0,0 +1,18 @@
module.exports = {
name: 'save',
aliases: ['sv'],
utilisation: '{prefix}save',
voiceChannel: true,
async execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
message.author.send(`You saved the track ${queue.current.title} | ${queue.current.author} from the server ${message.guild.name}`).then(() => {
message.channel.send(`I have sent you the title of the music by private messages ✅`);
}).catch(error => {
message.channel.send(`Unable to send you a private message ${message.author}... try again ? ❌`);
});
},
};

71
commands/music/search.js Normal file
View File

@ -0,0 +1,71 @@
const { MessageEmbed } = require('discord.js');
const { QueryType } = require('discord-player');
module.exports = {
name: 'search',
aliases: ['sh'],
utilisation: '{prefix}search [song name]',
voiceChannel: true,
async execute(client, message, args) {
if (!args[0]) return message.channel.send(`Please enter a valid search ${message.author}... try again ? ❌`);
const res = await player.search(args.join(' '), {
requestedBy: message.member,
searchEngine: QueryType.AUTO
});
if (!res || !res.tracks.length) return message.channel.send(`No results found ${message.author}... try again ? ❌`);
const queue = await player.createQueue(message.guild, {
metadata: message.channel
});
const embed = new MessageEmbed();
embed.setColor('RED');
embed.setAuthor(`Results for ${args.join(' ')}`, client.user.displayAvatarURL({ size: 1024, dynamic: true }));
const maxTracks = res.tracks.slice(0, 10);
embed.setDescription(`${maxTracks.map((track, i) => `**${i + 1}**. ${track.title} | ${track.author}`).join('\n')}\n\nSelect choice between **1** and **${maxTracks.length}** or **cancel** ⬇️`);
embed.setTimestamp();
embed.setFooter(message.author.avatarURL({ dynamic: true }));
message.channel.send({ embeds: [embed] });
const collector = message.channel.createMessageCollector({
time: 15000,
errors: ['time'],
filter: m => m.author.id === message.author.id
});
collector.on('collect', async (query) => {
if (query.content.toLowerCase() === 'cancel') return message.channel.send(`Search cancelled ✅`) && collector.stop();
const value = parseInt(query.content);
if (!value || value <= 0 || value > maxTracks.length) return message.channel.send(`Invalid response, try a value between **1** and **${maxTracks.length}** or **cancel**... try again ? ❌`);
collector.stop();
try {
if (!queue.connection) await queue.connect(message.member.voice.channel);
} catch {
await player.deleteQueue(message.guild.id);
return message.channel.send(`I can't join the voice channel ${message.author}... try again ? ❌`);
}
await message.channel.send(`Loading your search... 🎧`);
queue.addTrack(res.tracks[query.content - 1]);
if (!queue.playing) await queue.play();
});
collector.on('end', (msg, reason) => {
if (reason === 'time') return message.channel.send(`Search timed out ${message.author}... try again ? ❌`);
});
},
};

22
commands/music/seek.js Normal file
View File

@ -0,0 +1,22 @@
const ms = require('ms');
module.exports = {
name: 'seek',
aliases: [],
utilisation: '{prefix}seek [time]',
voiceChannel: true,
async execute(client, message, args) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
const timeToMS = ms(args.join(' '));
if (timeToMS >= queue.current.durationMS) return message.channel.send(`The indicated time is higher than the total time of the current song ${message.author}... try again ? ❌\n*Try for example a valid time like **5s, 10s, 20 seconds, 1m**...*`);
await queue.seek(timeToMS);
message.channel.send(`Time set on the current song **${ms(timeToMS, { long: true })}** ✅`);
},
};

18
commands/music/shuffle.js Normal file
View File

@ -0,0 +1,18 @@
module.exports = {
name: 'shuffle',
aliases: ['sh'],
utilisation: '{prefix}shuffle',
voiceChannel: true,
async execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
if (!queue.tracks[0]) return message.channel.send(`No music in the queue after the current one ${message.author}... try again ? ❌`);
await queue.shuffle();
return message.channel.send(`Queue shuffled **${queue.tracks.length}** song(s) ! ✅`);
},
};

16
commands/music/skip.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
name: 'skip',
aliases: ['sk'],
utilisation: '{prefix}skip',
voiceChannel: true,
execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
const success = queue.skip();
return message.channel.send(success ? `Current music ${queue.current.title} skipped ✅` : `Something went wrong ${message.author}... try again ? ❌`);
},
};

16
commands/music/stop.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
name: 'stop',
aliases: ['dc'],
utilisation: '{prefix}stop',
voiceChannel: true,
execute(client, message) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
queue.destroy();
message.channel.send(`Music stopped into this server, see you next time ✅`);
},
};

28
commands/music/volume.js Normal file
View File

@ -0,0 +1,28 @@
const maxVol = client.config.opt.maxVol;
module.exports = {
name: 'volume',
aliases: ['vol'],
utilisation: `{prefix}volume [1-${maxVol}]`,
voiceChannel: true,
execute(client, message, args) {
const queue = player.getQueue(message.guild.id);
if (!queue || !queue.playing) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
const vol = parseInt(args[0]);
if (!vol) return message.channel.send(`The current volume is ${queue.volume} 🔊\n*To change the volume enter a valid number between **1** and **${maxVol}**.*`);
if (queue.volume === vol) return message.channel.send(`The volume you want to change is already the current one ${message.author}... try again ? ❌`);
//:if (vol < 0 || vol > maxVol) return message.channel.send(`The specified number is not valid. Enter a number between **1** and **${maxVol}** ${message.author}... try again ? ❌`);
if (vol === "666") return message.channel.send('Welcome to the Hell ... but no ...');
const success = queue.setVolume(vol);
return message.channel.send(success ? `The volume has been modified to **${vol}**/**${maxVol}**% 🔊` : `Something went wrong ${message.author}... try again ? ❌`);
},
};

23
config.txt Normal file
View File

@ -0,0 +1,23 @@
module.exports = {
app: {
prefix: '$',
token: 'ODg4NzQyNTI0NTE1MTUxOTMz.YUXH-Q.eTY6KrKO7CRMDH8Ij8wES9UtFz0'
},
opt: {
DJ: {
enabled: false,
roleName: 'DJ',
commands: ['back', 'clear', 'filter', 'loop', 'pause', 'resume', 'seek', 'shuffle', 'skip', 'stop', 'volume']
},
maxVol: 100,
loopMessage: false,
discordPlayer: {
ytdlOptions: {
quality: 'highestaudio',
highWaterMark: 1 << 25,
type: 'opus',
}
}
}
};

View File

@ -0,0 +1,17 @@
module.exports = (client, int) => {
if (!int.isButton()) return;
const queue = player.getQueue(int.guildId);
switch (int.customId) {
case 'saveTrack': {
if (!queue || !queue.playing) return int.reply({ content: `No music currently playing... try again ? ❌`, ephemeral: true, components: [] });
int.member.send(`You saved the track ${queue.current.title} | ${queue.current.author} from the server ${int.member.guild.name}`).then(() => {
return int.reply({ content: `I have sent you the title of the music by private messages ✅`, ephemeral: true, components: [] });
}).catch(error => {
return int.reply({ content: `Unable to send you a private message... try again ? ❌`, ephemeral: true, components: [] });
});
}
}
};

30
events/messageCreate.js Normal file
View File

@ -0,0 +1,30 @@
module.exports = (client, message) => {
if (message.author.bot || message.channel.type === 'dm') return;
const prefix = client.config.app.prefix;
if (message.content.indexOf(prefix) !== 0) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
const cmd = client.commands.get(command) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(command));
const DJ = client.config.opt.DJ;
if (cmd && DJ.enabled && DJ.commands.includes(cmd.name)) {
const roleDJ = message.guild.roles.cache.find(x => x.name === DJ.roleName);
if (!message.member._roles.includes(roleDJ.id)) {
return message.channel.send(`This command is reserved for members with the ${DJ.roleName} role on the server ${message.author}... try again ? ❌`);
}
}
if (cmd && cmd.voiceChannel) {
if (!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${message.author}... try again ? ❌`);
if (message.guild.me.voice.channel && message.member.voice.channel.id !== message.guild.me.voice.channel.id) return message.channel.send(`You are not in the same voice channel ${message.author}... try again ? ❌`);
}
if (cmd) cmd.execute(client, message, args);
};

13
events/ready.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = async (client) => {
console.log(`${client.user.tag} oberve les ${client.guilds.cache.map(g => g.memberCount).reduce((a,b) => a + b)} utilisateur du serveur !`)
let activites = ['Créé par Lantium ! Les admins sont les gardiens de la sagesse et de la picole <3' ], i = 0;
setInterval(() => client.user.setPresence({
activities: [{
name: `${activites [i++ % activites.length]}`,
type: 'PLAYING'
}],
status: 'online' }),
5000);
};

21
main.js Normal file
View File

@ -0,0 +1,21 @@
const { Player } = require('discord-player');
const { Client, Intents } = require('discord.js');
global.client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_VOICE_STATES
],
disableMentions: 'everyone',
});
client.config = require('./config');
global.player = new Player(client, client.config.opt.discordPlayer);
require('./src/loader');
require('./src/events');
client.login(client.config.app.token);

1474
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

22
package.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "lanbot-music",
"main": "main.js",
"author": "lantium#9402",
"version": "1.0.0",
"repository": "",
"description": "Version de Lanbot pour la musique, utilisant Discord V13.",
"scripts": {
"start": "node main.js"
},
"dependencies": {
"discord-player": "^5.1.0",
"discord-together": "^1.3.25",
"discord.js": "^13.1.0",
"ffmpeg-static": "^4.4.0",
"fs": "^0.0.1-security",
"ms": "^3.0.0-canary.1",
"opusscript": "^0.0.8",
"uuid": "^8.3.2",
"ytdl-core": "^4.11.0"
}
}

28
src/events.js Normal file
View File

@ -0,0 +1,28 @@
player.on('error', (queue, error) => {
console.log(`Error emitted from the queue ${error.message}`);
});
player.on('connectionError', (queue, error) => {
console.log(`Error emitted from the connection ${error.message}`);
});
player.on('trackStart', (queue, track) => {
if (!client.config.opt.loopMessage && queue.repeatMode !== 0) return;
queue.metadata.send(`Started playing ${track.title} in **${queue.connection.channel.name}** 🎧`);
});
player.on('trackAdd', (queue, track) => {
queue.metadata.send(`Track ${track.title} added in the queue ✅`);
});
player.on('botDisconnect', (queue) => {
queue.metadata.send('I was manually disconnected from the voice channel, clearing queue... ❌');
});
player.on('channelEmpty', (queue) => {
queue.metadata.send('Nobody is in the voice channel, leaving the voice channel... ❌');
});
player.on('queueEnd', (queue) => {
queue.metadata.send('I finished reading the whole queue ✅');
});

31
src/loader.js Normal file
View File

@ -0,0 +1,31 @@
const { readdirSync } = require('fs');
const { Collection } = require('discord.js');
client.commands = new Collection();
const events = readdirSync('./events/').filter(file => file.endsWith('.js'));
console.log(`Loading events...`);
for (const file of events) {
const event = require(`../events/${file}`);
console.log(`-> Loaded event ${file.split('.')[0]}`);
client.on(file.split('.')[0], event.bind(null, client));
delete require.cache[require.resolve(`../events/${file}`)];
};
console.log(`Loading commands...`);
readdirSync('./commands/').forEach(dirs => {
const commands = readdirSync(`./commands/${dirs}`).filter(files => files.endsWith('.js'));
for (const file of commands) {
const command = require(`../commands/${dirs}/${file}`);
console.log(`-> Loaded command ${command.name.toLowerCase()}`);
client.commands.set(command.name.toLowerCase(), command);
if (Reflect.has(command, 'onStart')) {
command.onStart(client);
}
delete require.cache[require.resolve(`../commands/${dirs}/${file}`)];
};
});

1
utils/todo.json Normal file
View File

@ -0,0 +1 @@
[]