Compare commits

..

No commits in common. 'c661b573b868d9fddf21c1fcec740826f835c577' and '262276defa55ba9a8fa0f66fd1117c73480dd016' have entirely different histories.

  1. 5
      bot.js
  2. 2
      commands/leveling/leaderboard.js
  3. 65
      commands/misc/ar.js
  4. 5
      commands/misc/help.js
  5. 25
      commands/music/clearqueue.js
  6. 31
      commands/music/newcontroller.js
  7. 22
      commands/music/pause.js
  8. 116
      commands/music/play.js
  9. 59
      commands/music/queue.js
  10. 44
      commands/music/skip.js
  11. 1
      commands/utility/apply.js
  12. 2
      events/guildMemberAdd.js
  13. 2
      events/guildMemberRemove.js
  14. 13
      events/messageReactionRemove.js
  15. 11
      events/ready.js
  16. 1479
      package-lock.json
  17. 3
      package.json
  18. 55
      util/actmusiccont.js
  19. 21
      util/updatecontroller.js

@ -27,10 +27,7 @@ client.misc = {
monners: {}
},
loggers: {},
neptune: '782727129414500374',
alt: '845060238910291968',
queue: {},
attemptedQueue: []
neptune: '782727129414500374'
};
//const config = require('./config.js');

@ -21,7 +21,7 @@ module.exports = {
let xp = gxp.xp;
let lvlp = Object.keys(xp).sort((a, b) => {return xp[a][1] - xp[b][1];}).reverse();
let lvl = lvlp.slice(0, Object.keys(xp).length >= 10 ? 10 : Object.keys(xp).length);
let lvl = lvlp.slice(0, Object.keys(xp).length >= 5 ? 5 : Object.keys(xp).length);
let lvls = ``;
let i; for (i=0; i<lvl.length; i++) {lvls += `${i+1}. <@${lvl[i]}> -> **Level ${xp[lvl[i]][1]}**\n`;}
lvls += `\n${cfmh} *You are ranked **#${lvlp.indexOf(message.author.id) + 1}** at Level ${xp[lvlp[lvlp.indexOf(message.author.id)]][1]}.*`;

@ -4,7 +4,6 @@ const AR = require('../../models/ar');
const GuildData = require('../../models/guild');
const ask = require('../../util/ask');
const {Pagination} = require('../../util/pagination');
module.exports = {
name: "ar",
@ -28,57 +27,19 @@ module.exports = {
function sortARs(tar) {
let t = tar.triggers;
let res = {};
res.paginate = t.length > 10;
let ar = tar.ars;
if (res.paginate) {
let pages = [];
let cond = false;
let x = 0;
while (true) {
let s = '';
for (let i = 0; i < 10; i++) {
if (ar[(x * 10) + i] === undefined) {cond = true; break;}
s += `\`${(x*10)+i+1}.\` ${t[(x * 10) + i]}\n-> ${ar[(x * 10) + i]}\n\n`;
if ((x * 10) + i >= ar.length) {cond = true; break;}
}
pages.push(new Discord.MessageEmbed()
.setTitle(`Auto-Responses in this Server`)
.setDescription(s)
.setColor('328ba8')
.setTimestamp()
);
if (cond) {break;}
x++;
}
res.pagination = new Pagination(message.channel, pages, message, client, true);
} else {
let s = '';
for (let i=0;i<t.length;i++) {s+=`\`${i+1}.\` ${t[i]}\n-> ${ar[i]}\n\n`;}
res.s = s;
}
return res;
let s = '';
for (let i=0;i<t.length;i++) {s+=`\`${i+1}.\` ${t[i]}\n-> ${ar[i]}\n\n`;}
return s;
}
function viewARs(res, mode) {
return new Promise(async resolve => {
if (res.paginate) {
if (mode) {res.pagination.pages.forEach(page => page.addField(mode === 'edit' ? "Editing" : 'Deletion', `Please say the **number** of the AR you wish to ${mode}.`));}
let r = await res.pagination.start({endTime: 60000, user: message.author.id});
return resolve(r);
} else {
let string = res.s;
let embed = new Discord.MessageEmbed()
.setTitle("Auto-Responses in this Server")
.setDescription(string)
.setColor('328ba8')
.setFooter("Luno", client.user.avatarURL())
.setTimestamp();
if (mode) {embed.addField(mode === 'edit' ? "Editing" : 'Deletion', `Please say the **number** of the AR you wish to ${mode}.`);}
let r = await message.channel.send(embed);
return resolve(r);
}
});
function viewARs(string) {
return new Discord.MessageEmbed()
.setTitle("Auto-Responses in this Server")
.setDescription(string)
.setColor('328ba8')
.setFooter("Luno", client.user.avatarURL())
.setTimestamp();
}
if (['a', 'add'].includes(args[0].toLowerCase())) {
@ -102,7 +63,7 @@ module.exports = {
if (!tar || !tar.triggers.length) {return message.channel.send("You can't edit any auto-responses... because there aren't any here...");}
let sar = sortARs(tar);
await viewARs(sar, 'edit');
await message.channel.send(viewARs(sar).addField("Editing", "Please say the **number** of the AR you wish to edit."));
let collected;
try {collected = await message.channel.awaitMessages(m => m.author.id === message.author.id, {errors: ['time'], time: 60001, max: 1});}
catch {return message.channel.send("This question has timed out. Please try again!");}
@ -127,7 +88,7 @@ module.exports = {
if (!tar || !tar.triggers.length) {return message.channel.send("It's not like this server has any ARs for me to delete in the first place!");}
let sar = sortARs(tar);
await viewARs(sar, 'delete');
await message.channel.send(viewARs(sar).addField("Deletion", "Please say the **number** of the AR you wish to delete."));
let collected;
try {collected = await message.channel.awaitMessages(m => m.author.id === message.author.id, {errors: ['time'], time: 60000, max: 1});}
catch {return message.channel.send("This question has timed out. Please try again!");}
@ -151,7 +112,7 @@ module.exports = {
if (['v', 'view', 'l', 'list'].includes(args[0].toLowerCase())) {
let tar = await AR.findOne({gid: message.guild.id});
if (!tar || !tar.triggers.length) {return message.channel.send("This server has no ARs!");}
return await viewARs(sortARs(tar));
return message.channel.send(viewARs(sortARs(tar)));
}
if (['s', 'settings'].includes(args[0].toLowerCase())) {

@ -36,8 +36,8 @@ module.exports = {
helpSorted[category] = categorySorted;
}
let cat = await ask(message, "What would you like help with? (`Fun`|`Utility`|`Misc`|`Moderation`|`Social`|`Leveling`|`Music`) or `all` if you'd like to browse all commands", 60000); if (!cat) {return;}
if (!['f', 'fun', 'u', 'util', 'utility', 'utilities', 'm', 'misc', 'miscellaneous', 'mod', 'moderation', 's', 'social', 'leveling', 'l', 'level', 'music', 'a', 'all'].includes(`${cat}`.trim().toLowerCase())) {return message.channel.send("That wasn't a valid response! Try again?");}
let cat = await ask(message, "What would you like help with? (`Fun`|`Utility`|`Misc`|`Moderation`|`Social`|`Leveling`) or `all` if you'd like to browse all commands", 60000); if (!cat) {return;}
if (!['f', 'fun', 'u', 'util', 'utility', 'utilities', 'm', 'misc', 'miscellaneous', 'mod', 'moderation', 's', 'social', 'leveling', 'l', 'level', 'a', 'all'].includes(`${cat}`.trim().toLowerCase())) {return message.channel.send("That wasn't a valid response! Try again?");}
let pages;
if (['f', 'fun'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Fun'];}
@ -47,7 +47,6 @@ module.exports = {
if (['mod', 'moderation'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Moderation'];}
if (['s', 'social'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Social'];}
if (['l', 'leveling', 'level'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Leveling'];}
if (["music"].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Music'];}
if (['a', 'all'].includes(`${cat}`.trim().toLowerCase())) {pages = []; let c; for (c of Object.values(helpSorted)) {let h; for (h of c) {pages.push(h)}}}
await require('../../util/wait')(500);

@ -1,25 +0,0 @@
const Discord = require('discord.js');
module.exports = {
name: "clearqueue",
aliases: ['cq'],
meta: {
category: 'Music',
description: "Clear your music queue",
syntax: '`clearqueue`',
extra: null
},
help: "Clear your music queue",
async execute(message, msg, args, cmd, prefix, mention, client) {
if (!message.guild) {return message.channel.send("You must be in a server in order to use this command!");}
if (!client.misc.queue[message.guild.id]) {return message.channel.send("This server doesn't have any music playing!");}
if (!message.member.voice.channel || !message.member.voice.channel === client.misc.queue[message.guild.id].updates) {return message.channel.send("You're not in the music voice channel!");}
let ct = client.misc.queue[message.guild.id].queue[0];
client.misc.queue[message.guild.id].queue = [];
client.misc.queue[message.guild.id].queue.push(ct);
require('../../util/updatecontroller')(message, client);
message.channel.send("Queue cleared!");
}
};

@ -1,31 +0,0 @@
const Discord = require('discord.js');
const moment = require('moment');
require('moment-precise-range-plugin');
const activateControls = require('../../util/actmusiccont');
const updateController = require('../../util/updatecontroller');
module.exports = {
name: "newcontroller",
aliases: ['ncont', 'nc'],
meta: {
category: 'Music',
description: "Create a new music controller to replace the old one in case it gets buried in chat",
syntax: '`newcontroller`',
extra: null
},
help: "Create a new music controller to replace the old one in case it gets buried in chat",
async execute(message, msg, args, cmd, prefix, mention, client) {
if (!message.guild) {return message.channel.send("You must be in a server in order to use this command!");}
if (!client.misc.queue[message.guild.id]) {return message.channel.send("This server doesn't have any music playing!");}
if (!message.member.voice.channel || !message.member.voice.channel === client.misc.queue[message.guild.id].updates) {return message.channel.send("You're not in the music voice channel!");}
client.misc.queue[message.guild.id].controller = await message.channel.send("One moment...");
await require('../../util/wait')(500);
updateController(message, client);
let reactions = ['⏯', '⏭', '⏹', '🔁', '🔉', '🔊'];
for (let i = 0; i < reactions.length; i++) {await client.misc.queue[message.guild.id].controller.react(reactions[i]);}
activateControls(client.misc.queue[message.guild.id].controller, client);
}
};

@ -1,22 +0,0 @@
const Discord = require('discord.js');
module.exports = {
name: "pause",
aliases: ['pa', 'res', 'resume'],
meta: {
category: 'Music',
description: "Pause/play the current song",
syntax: '`pause`',
extra: null
},
help: "Pause/play the current song",
async execute(message, msg, args, cmd, prefix, mention, client) {
if (!message.guild) {return message.channel.send("You must be in a server in order to use this command!");}
if (!client.misc.queue[message.guild.id]) {return message.channel.send("This server doesn't have any music playing!");}
if (!message.member.voice.channel || !message.member.voice.channel === client.misc.queue[message.guild.id].updates) {return message.channel.send("You're not in the music voice channel!");}
await client.misc.queue[message.guild.id].player.pause(!client.misc.queue[message.guild.id].player.paused);
require('../../util/updatecontroller')(message, client);
return message.channel.send(`${client.misc.queue[message.guild.id].player.paused ? "Paused your music." : "Resuming the tunes <a:NC_happy:830701612426199040>"}`);
}
};

@ -1,116 +0,0 @@
const Discord = require('discord.js');
const axios = require('axios');
const moment = require('moment');
require('moment-precise-range-plugin');
const sw = require('swwrap');
const activateControls = require('../../util/actmusiccont');
const updateController = require('../../util/updatecontroller');
module.exports = {
name: "play",
aliases: ['p'],
meta: {
category: 'Music',
description: "Play a song!",
syntax: '`play <songName|songURL>`',
extra: null
},
help: new Discord.MessageEmbed()
.setTitle("Help -> Music Playing")
.setDescription("Plays a song by searching for it or using a URL you provide.")
.addField("Notice", "You must be in a voice channel in order to use this command!")
.addField("Syntax", "`play <songName|songURL>`"),
async execute(message, msg, args, cmd, prefix, mention, client) {
if (!message.guild) {return message.channel.send("You must be in a server in order to use this command.");}
if (!args.length) {return message.channel.send(`Syntax: \`${prefix}play <songName|songURL>\``);}
if (!message.member.voice.channel) {return message.channel.send("You have to be in a voice channel to play music, silly!");}
if (client.misc.queue[message.guild.id] && (client.misc.queue[message.guild.id].channel !== message.member.voice.channel.id)) {return message.channel.send("You're in a voice channel, but it's not the music voice channel. Since there's already music playing from me in this server, I can't join your channel.");}
if (client.misc.attemptedQueue.includes(message.guild.id)) {return message.channel.send("A wee too fast there!");}
client.misc.attemptedQueue.push(message.guild.id);
const swc = new sw.Client();
const node = client.lavacordManager.idealNodes[0];
const params = new URLSearchParams();
let search = args.join(' ');
let gotSpotify = false;
const checkSpotify = () => {return new Promise(resolve => {
if (search.match(/^https:\/\/open\.spotify\.com\/track\/\w+/gm)) {
swc.getTrack(search.replace(/^https:\/\/open\.spotify\.com\/track\//gm, '').replace(/\?si=.+/gm, ''))
.then(r => {gotSpotify = true; search = `${r.artist} - ${r.name}`; return resolve(undefined);})
.catch(() => {return resolve(undefined);});
} else {resolve(undefined);}
});}
await checkSpotify();
params.append('identifier', search.match(/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/g) ? search : `ytsearch:${search}`);
const data = await axios(`http://${node.host}:${node.port}/loadtracks?${params}`, {
headers: {
Authorization: node.password
}
});
let [song] = data.data.tracks;
client.misc.attemptedQueue.splice(client.misc.attemptedQueue.indexOf(message.guild.id), 1);
if (!song) {return message.channel.send("I couldn't find that song! Try again?");}
if (!client.misc.queue[message.guild.id]) {
let player = await client.lavacordManager.join({
guild: message.guild.id,
channel: message.member.voice.channel.id,
node: client.lavacordManager.idealNodes[0].id
}, {selfdeaf: true});
client.misc.queue[message.guild.id] = {
player: player,
queue: [{song: song, player: message.author.id}],
votes: [],
updates: message.channel.id,
channel: message.member.voice.channel.id,
volume: 50
};
player.on('end', async data => {
if (data.reason === "REPLACED" || data.reason === "STOPPED") return;
client.misc.queue[message.guild.id].queue.shift();
if (!client.misc.queue[message.guild.id].queue.length) {
await client.lavacordManager.leave(message.guild.id);
message.guild.channels.cache.get(client.misc.queue[message.guild.id].updates).send('Finished playing.');
return delete client.misc.queue[message.guild.id];
}
await player.play(client.misc.queue[message.guild.id].queue[0].song.track);
updateController(message, client);
});
await player.play(song.track);
await player.volume(50);
let tc = await message.channel.send(new Discord.MessageEmbed()
.setAuthor("Now Playing", message.author.avatarURL())
.setTitle(song.info.title)
.setThumbnail(`https://i.ytimg.com/vi/${song.info.identifier}/maxresdefault.jpg`)
.setDescription(`Channel: ${song.info.author}\n[Original video](${song.info.uri})`)
.addField("Queued By", `<@${message.author.id}>`, true)
.addField("Length", moment.preciseDiff(Date.now(), Date.now() + song.info.length), true)
.addField("Songs in Queue", `**1** Song\n${moment.preciseDiff(Date.now(), Date.now() + song.info.length)}`)
.addField("Settings", `Volume: **${client.misc.queue[message.guild.id].volume}**/**150**`)
.setColor('328ba8')
.setFooter("Luno")
);
let reactions = ['⏯', '⏭', '⏹', '🔁', '🔉', '🔊'];
for (let i = 0; i < reactions.length; i++) {await tc.react(reactions[i]);}
client.misc.queue[message.guild.id].controller = tc;
activateControls(client.misc.queue[message.guild.id].controller, client);
} else {
if (client.misc.queue[message.guild.id].queue.length >= 100) {return message.channel.send("Your queue is too big! Add the song after this one has played.");}
client.misc.queue[message.guild.id].queue.push({song: song, player: message.author.id});
message.channel.send(`Queued **${song.info.title}** | **${client.misc.queue[message.guild.id].queue.length - 1} song${client.misc.queue[message.guild.id].queue.length - 1 > 1 ? 's' : ''}** remaining until it's played.`);
updateController(message, client);
}
}
};

@ -1,59 +0,0 @@
const Discord = require('discord.js');
const moment = require('moment');
require('moment-precise-range-plugin');
const {Pagination} = require('../../util/pagination');
module.exports = {
name: "queue",
aliases: ['q'],
meta: {
category: 'Music',
description: "View your music queue",
syntax: '`queue`',
extra: null
},
help: "View your music queue",
async execute(message, msg, args, cmd, prefix, mention, client) {
if (!message.guild) {return message.channel.send("You must be in a server in order to use this command!");}
if (!client.misc.queue[message.guild.id]) {return message.channel.send("This server doesn't have any music playing!");}
let queue = client.misc.queue[message.guild.id].queue;
if (queue.length > 10) {
let pages = [];
let x = 0;
while (true) {
let cond = false;
let page = '';
for (let i = 0; i < 10; i++) {
if (queue[(x * 10) + i] === undefined) {cond = true; break;}
page += `**${(x * 10) + i + 1}.** **${queue[(x * 10) + i].song.info.title}** - ${queue[(x * 10) + i].song.info.author}\n<@${queue[(x * 10) + i].player}> | ${moment.preciseDiff(Date.now(), Date.now() + queue[(x * 10) + i].song.info.length)}\n`;
if ((x * 10) + i >= queue.length) {cond = true; break;}
}
pages.push(new Discord.MessageEmbed()
.setTitle(`Server Music Queue [${(x * 10) + 1}-${(x * 10) + 10} of ${queue.length}]`)
.setThumbnail(message.guild.iconURL({size: 2048}))
.setDescription(page)
.setColor('2c9cb0')
.setFooter("Kit", client.user.avatarURL())
.setTimestamp()
);
if (cond) {break;}
x++;
}
let queueList = new Pagination(message.channel, pages, message, client, true);
return queueList.start({user: message.author.id, endTime: 60000});
} else {
let page = '';
for (let i = 0; i < queue.length; i++) {page += `**${i + 1}.** **${queue[i].song.info.title}** - ${queue[i].song.info.author}\n<@${queue[i].player}> | ${moment.preciseDiff(Date.now(), Date.now() + queue[i].song.info.length)}\n`;}
return message.channel.send(new Discord.MessageEmbed()
.setTitle(`Server Music Queue - ${queue.length}`)
.setThumbnail(message.guild.iconURL({size: 2048}))
.setDescription(page)
.setColor('2c9cb0')
.setFooter("Kit", client.user.avatarURL())
.setTimestamp()
);
}
}
};

@ -1,44 +0,0 @@
const Discord = require('discord.js');
const updateController = require('../../util/updatecontroller');
module.exports = {
name: "skip",
aliases: ['s'],
meta: {
category: 'Music',
description: "Skips the currently-playing song",
syntax: '`skip [count]`',
extra: null
},
help: "Skips the currently-playing song",
async execute(message, msg, args, cmd, prefix, mention, client) {
if (!message.guild) {return message.channel.send("You must be in a server in order to use this command!");}
if (!client.misc.queue[message.guild.id]) {return message.channel.send("This server doesn't have any music playing!");}
if (!message.member.voice.channel || !message.member.voice.channel === client.misc.queue[message.guild.id].updates) {return message.channel.send("You're not in the music voice channel!");}
let skips = 0;
async function skip() {
client.misc.queue[message.guild.id].queue.shift();
skips++;
if (!client.misc.queue[message.guild.id].queue.length) {
await client.lavacordManager.leave(message.guild.id);
message.guild.channels.cache.get(client.misc.queue[message.guild.id].updates).send('Finished playing.');
delete client.misc.queue[message.guild.id];
return false;
}
return true;
}
if (args[0] && (isNaN(Number(args[0])) || Number(args[0]) < 1)) {return message.channel.send("You must specify a positive number of songs to delete!");}
if (args[0] && Number(args[0]) > 50) {return message.channel.send("That's too big of a number!");}
let count = args[0] ? Number(args[0]) : 1;
for (let i=0; i < count; i++) {if (!skip()) {break;}}
await message.channel.send(`Skipped ${skips} song${skips === 1 ? '' : 's'}!`);
await client.misc.queue[message.guild.id].player.play(client.misc.queue[message.guild.id].queue[0].song.track);
await updateController(message, client);
}
};

@ -16,7 +16,6 @@ module.exports = {
},
help: "Apply for a moderation position here!",
async execute(message, msg, args, cmd, prefix, mention, client) {
if ((message.guild && message.guild.id === client.misc.alt) || !client.guilds.cache.get(client.misc.neptune).members.cache.has(message.author.id)) {return message.channel.send("That command isn't available in this server *yet*");}
let ma = await ModApp.findOne({gid: client.misc.neptune}) || new ModApp({gid: client.misc.neptune});
if (!ma.enabled && !message.author.id === '330547934951112705') {return message.channel.send("Moderation applications are not currently open at this time! We'll announce when we're looking for mods, so keep your eyes peeled!");}
if (ma.apps[message.author.id]) {return message.channel.send("Looks like you already have an application made! If you need it to be removed for some reason, contact WubzyGD.");};

@ -21,8 +21,6 @@ module.exports = async (client, member) => {
try {member.guild.channels.cache.get(tg.wch).send(await sendResponse(member, member.guild.channels.cache.get(tg.wch), 'xdlol', client, tr.responses.get(tr.bindings.get('welcome'))));} catch {}
}
if (member.guild.id === client.misc.alt) {return;}
member.guild.channels.cache.get('857097085915496468').send(new Discord.MessageEmbed()
.setAuthor(member.displayName, client.users.cache.get(member.id).avatarURL())
.setTitle("New User's Account Age")

@ -17,8 +17,6 @@ module.exports = async (client, member) => {
try {member.guild.channels.cache.get(tg.lch).send(await sendResponse(member, member.guild.channels.cache.get(tg.lch), 'xdlol', client, tr.responses.get(tr.bindings.get('leave'))));} catch {}
}
if (member.guild.id === client.misc.alt) {return;}
let cm = await Mute.findOne({uid: member.id});
if (cm) {
member.guild.members.ban(member.id)

@ -1,13 +0,0 @@
module.exports = async (client, reaction, user) => {
if (reaction.partial) {try {await reaction.fetch();} catch {return;}}
if (user.bot) {return;}
if (reaction.message.guild && client.misc.queue[reaction.message.guild.id]
&& reaction.message.guild.members.cache.get(user.id).voice.channel
&& reaction.message.guild.members.cache.get(user.id).voice.channel.id === client.misc.queue[reaction.message.guild.id].channel
&& reaction.message.id === client.misc.queue[reaction.message.guild.id].controller.id
&& reaction.emoji.name === '⏯') {
await client.misc.queue[reaction.message.guild.id].player.pause(false);
require('../util/updatecontroller')(reaction.message, client);
}
};

@ -3,7 +3,6 @@ const chalk = require('chalk');
const moment = require('moment');
const mongoose = require('mongoose');
const ora = require('ora');
const Lavalink = require('@lavacord/discord.js');
const GuildSettings = require('../models/guild');
const BotDataSchema = require('../models/bot');
@ -80,16 +79,6 @@ module.exports = async client => {
setInterval(() => localXPCacheClean(client), 150000);
client.lavacordManager = new Lavalink.Manager(client, client.config.lava.nodes, {user: client.user.id});
client.lavacordManager.on('error', (err, node) => {console.error(`\nAn error occurred on Lava node ${node.id}.`, err)});
await client.lavacordManager.connect()
.then(() => {
console.log(`${chalk.gray('\n[INFO]')} >> ${chalk.greenBright("Connected")} to Lavacord.`);
client.misc.lava = true;
})
.catch(e => {console.log(`${chalk.red('\n[ERROR]')} >> ${chalk.yellow("Occured while connecting to Lavacord:")}`); console.error(e);});
let botData = await BotDataSchema.findOne({finder: 'lel'})
? await BotDataSchema.findOne({finder: 'lel'})
: new BotDataSchema({

1479
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -5,8 +5,7 @@
"main": "bot.js",
"author": "LunoDev",
"dependencies": {
"@lavacord/discord.js": "^0.0.7",
"axios": "^0.21.1",
"canvas": "^2.6.1",
"chalk": "^4.1.0",
"dblapi.js": "^2.4.1",
"discord.io": "https://github.com/woor/discord.io/tarball/gateway_v6",

@ -1,55 +0,0 @@
const Discord = require("discord.js");
const moment = require('moment');
require('moment-precise-range-plugin');
const updateController = require("./updatecontroller");
module.exports = async function activateControls(message, client) {
let col = await message.createReactionCollector((r) => ['⏯', '⏭', '⏹', '🔁', '🔉', '🔊'].includes(r.emoji.name), {time: 1000 * 60 * 30});
col.on('collect', async (r, u) => {
if (!r.message.guild.members.cache.get(u.id).voice.channel || !r.message.guild.members.cache.get(u.id).voice.channel === client.misc.queue[message.guild.id].channel) {return;}
let functions = {
'⏯': async () => {
await client.misc.queue[message.guild.id].player.pause(!client.misc.queue[message.guild.id].player.paused);
updateController(message, client);
},
'⏭': async () => {
client.misc.queue[message.guild.id].queue.shift();
if (!client.misc.queue[message.guild.id].queue.length) {
await client.lavacordManager.leave(message.guild.id);
message.guild.channels.cache.get(client.misc.queue[message.guild.id].updates).send('Finished playing.');
col.stop();
return delete client.misc.queue[message.guild.id];
}
await client.misc.queue[message.guild.id].player.play(client.misc.queue[message.guild.id].queue[0].song.track);
updateController(message, client);
},
'⏹': async () => {
await client.lavacordManager.leave(message.guild.id);
message.guild.channels.cache.get(client.misc.queue[message.guild.id].updates).send('Finished playing.');
col.stop();
return delete client.misc.queue[message.guild.id];
},
'🔁': () => {},
'🔉': async () => {
if (client.misc.queue[message.guild.id].volume <= 10) {return;}
client.misc.queue[message.guild.id].volume -= 10;
await client.misc.queue[message.guild.id].player.volume(client.misc.queue[message.guild.id].volume);
updateController(message, client);
},
'🔊': async () => {
if (client.misc.queue[message.guild.id].volume >= 150) {return;}
client.misc.queue[message.guild.id].volume += 10;
await client.misc.queue[message.guild.id].player.volume(client.misc.queue[message.guild.id].volume);
updateController(message, client);
}
};
return functions[r.emoji.name]();});
col.on('end', () => {
if (!client.misc.queue[message.guild.id]) {return;}
client.misc.queue[message.guild.id].controller.delete().catch(() => {});
if (client.misc.queue[message.guild.id].queue.length) {updateController(message, client);}
});
};

@ -1,21 +0,0 @@
const Discord = require("discord.js");
const moment = require('moment');
require('moment-precise-range-plugin');
module.exports = async (message, client) => {
let t = client.misc.queue[message.guild.id].queue[0];
let length = 0;
client.misc.queue[message.guild.id].queue.forEach(x => length += x.song.info.length);
await client.misc.queue[message.guild.id].controller.edit("", new Discord.MessageEmbed()
.setAuthor("Now Playing", client.users.cache.get(t.player).avatarURL())
.setTitle(t.song.info.title)
.setThumbnail(`https://i.ytimg.com/vi/${t.song.info.identifier}/maxresdefault.jpg`)
.setDescription(`Channel: ${t.song.info.author}\n[Original video](${t.song.info.uri})`)
.addField("Queued By", `<@${t.player}>`, true)
.addField("Length", moment.preciseDiff(Date.now(), Date.now() + t.song.info.length), true)
.addField("Songs in Queue", `**${client.misc.queue[message.guild.id].queue.length}** Song${client.misc.queue[message.guild.id].queue.length > 1 ? 's' : ''}\n${moment.preciseDiff(Date.now(), Date.now() + length)}${client.misc.queue[message.guild.id].queue.length > 1 ? `\n\nNext up: **${client.misc.queue[message.guild.id].queue[1].song.info.title}**` : ''}`)
.addField("Settings", `Volume: **${client.misc.queue[message.guild.id].volume}**/**150**${client.misc.queue[message.guild.id].player.paused ? '\n**Currently paused.**' : ''}`)
.setColor('328ba8')
.setFooter("Luno")
).catch(() => {});
};
Loading…
Cancel
Save