diff --git a/bot.js b/bot.js index 475061c..e829303 100644 --- a/bot.js +++ b/bot.js @@ -22,9 +22,11 @@ client.misc = { enabled: [], xp: {}, hasLevelRoles: [] - } + }, + mute: new Map() }, - loggers: {} + loggers: {}, + neptune: '691122844339404800' }; //const config = require('./config.js'); diff --git a/commands/moderation/mute..js b/commands/moderation/mute.js similarity index 91% rename from commands/moderation/mute..js rename to commands/moderation/mute.js index 192822e..ae44420 100644 --- a/commands/moderation/mute..js +++ b/commands/moderation/mute.js @@ -2,7 +2,7 @@ const Discord = require('discord.js'); const Mute = require('../../models/mute'); -const muted = '717419538970312755'; +const muted = '834613812271251476'; module.exports = { name: "mute", @@ -29,6 +29,7 @@ module.exports = { if (person.roles.cache.has(muted)) {return message.reply("That person is already muted!");} if (message.guild.roles.cache.get(muted).position <= person.roles.highest.position) {return message.reply("I don't have permissions to mute that member as their highest role is above or equal to the muted role!");} + if (person.roles.highest.positon >= message.guild.roles.cache.get(muted)) {return message.reply("You can't mute that member as their highest role is higher than the muted role (in other words they are a moderator or admin of the server)");} let udur = args[1] ? args[1].toLowerCase().trim() : '1h'; let time; @@ -46,9 +47,9 @@ module.exports = { if (args[2]) {args.shift(); args.shift(); reason = args.join(" ").trim();} try { - person.roles.add("717419538970312755") + person.roles.add("834613812271251476") .then(() => message.channel.send("I've muted that member!") - .then(() => message.guild.channels.cache.get('830600344668602409').send(new Discord.MessageEmbed() + .then(() => message.guild.channels.cache.get('834611202377515018').send(new Discord.MessageEmbed() .setAuthor(message.member.displayName, message.author.avatarURL()) .setTitle("Member Muted!") .setDescription(`<@${person.id}> was muted!`) diff --git a/commands/social/blush.js b/commands/social/blush.js new file mode 100644 index 0000000..9278378 --- /dev/null +++ b/commands/social/blush.js @@ -0,0 +1,37 @@ +const Discord = require('discord.js'); +const Saves = require('../../models/saves'); +const UserData = require('../../models/user'); +const makeId = require('../../util/makeid'); + +module.exports = { + name: "blush", + help: "Let others know that someone made your cheeks red `{{p}}sip`.", + meta: { + category: 'Social', + description: "Let others know that someone made your cheeks red", + syntax: '`blush`', + extra: null + }, + async execute(message, msg, args, cmd, prefix, mention, client) { + let savess = await Saves.findOne({name: 'blush'}) ? await Saves.findOne({name: 'blush'}) : new Saves({name: 'blush'}); + let saves = savess.saves; + if (!args.length) {return message.channel.send(new Discord.MessageEmbed() + .setTitle(`${message.guild ? message.member.displayName : message.author.username} blushes UwU`) + .setImage(String(Array.from(saves.values())[Math.floor(Math.random() * saves.size)])) + .setColor('ad0072') + );} + if (['s', 'save', 'n', 'new', 'a', 'add'].includes(args[0].toLowerCase())) { + if (!args[1]) {return message.channel.send('oi there cunt, give me a link of an image to add!');} + let tu = await UserData.findOne({uid: message.author.id}); + if ((!tu || !tu.developer) && !client.misc.savers.includes(message.author.id)) {return message.reply("You must be a Luno Developer in order to add new sip GIFs.");} + let e = true; + let id; + while (e === true) {id = makeId(6); if (!saves.has(id)) {e = false;}} + args.shift(); + saves.set(id, args.join(" ").trim()); + savess.saves = saves; + savess.save(); + return message.channel.send("Save added!"); + } + } +}; \ No newline at end of file diff --git a/events/guildMemberRemove.js b/events/guildMemberRemove.js index bc43efd..4740aeb 100644 --- a/events/guildMemberRemove.js +++ b/events/guildMemberRemove.js @@ -17,7 +17,7 @@ module.exports = async (client, member) => { let cm = Mute.findOne({uid: member.id}); if (cm) { member.guild.members.ban(member.id) - .then(() => message.guild.channels.cache.get('830600344668602409').send("<@&828000073203974166>", new Discord.MessageEmbed() + .then(() => message.guild.channels.cache.get('834611202377515018').send("<@&828000073203974166>", new Discord.MessageEmbed() .setAuthor(member.displayName, client.users.cache.get(member.id).avatarURL()) .setTitle("Mute Evasion Detected!") .setDescription(`<@${member.id}> has evaded their mute, and I've automatically banned them!`) @@ -27,7 +27,7 @@ module.exports = async (client, member) => { .setTimestamp() )).catch(e => { console.error(`\n${chalk.red('[ERROR]')} >> ${chalk.yellow(`At [${date}] | Occurred while trying to ban a member for mute evasion`)}`, e); - message.guild.channels.cache.get('830600344668602409').send("<@&828000073203974166> **Failed automatic mute evasion ban!**", new Discord.MessageEmbed() + message.guild.channels.cache.get('834611202377515018').send("<@&828000073203974166> **Failed automatic mute evasion ban!**", new Discord.MessageEmbed() .setAuthor(member.displayName, client.users.cache.get(member.id).avatarURL()) .setTitle("Mute Evasion Detected!") .setDescription(`<@${member.id}> has evaded their mute, but I was not able to automatically ban them! Their user ID is \`${member.id}\`.`) diff --git a/events/ready.js b/events/ready.js index 80a5d71..9917312 100644 --- a/events/ready.js +++ b/events/ready.js @@ -7,6 +7,7 @@ const ora = require('ora'); const GuildSettings = require('../models/guild'); const BotDataSchema = require('../models/bot'); const LogData = require('../models/log'); +const Mute = require('../models/mute'); const siftStatuses = require('../util/siftstatuses'); const localXPCacheClean = require('../util/lxp/cacheloop'); @@ -68,6 +69,34 @@ module.exports = async client => { }}; setPL(); + const muteLoop = async () => { + let ct = new Date().getTime(); + let mute; for (mute of Array.from(client.misc.cache.mute.keys())) { + if (ct >= client.misc.cache.mute.get(mute)) { + if (client.guilds.cache.get(client.misc.neptune).members.cache.has(mute)) { + let mutedata = await Mute.findOne({uid: mute}); + client.guilds.cache.get(client.misc.neptune).members.cache.get(mute).roles.remove('834613812271251476') + .then(() => { + let muten = client.guilds.cache.get(client.misc.neptune).members.cache.get(mute).displayName; + client.guilds.cache.get(client.misc.neptune).channels.cache.get('834611202377515018').send(new Discord.MessageEmbed() + .setTitle("Member Automatically Unmuted") + .setDescription(`<@${mute}>${muten.endsWith('s') ? "'" : "'s"} mute time has ended, and I've unmuted them.`) + .addField("Muting Moderator", `<@${mutedata.mutedBy}>`, true) + .addField("Reason", mutedata.reason.length ? mutedata.reason : 'No reason provided', true) + .setColor('c77dff') + .setFooter("Luno", client.user.avatarURL()) + .setTimestamp() + ); + }); + } + await Mute.deleteOne({uid: mute}); + client.misc.cache.mute.delete(mute); + } + } + } + muteLoop(); + setInterval(muteLoop, 60000); + siftStatuses(); setInterval(() => {setPL(); siftStatuses(client, null);}, 120000); diff --git a/responses/crescent.js b/responses/crescent.js index be79f46..7cec5a8 100644 --- a/responses/crescent.js +++ b/responses/crescent.js @@ -21,9 +21,26 @@ module.exports = { return message.channel.send(r[Math.floor(Math.random() * r.length)]); } - if (incl(["heya luno", "hi luno", "sup luno", "what's up luno", "whats up luno"])) { - const r = ["Heya there Crescent!", "Hi cutie ^^", "Sup qt ;)", "What's up my favorite femboy?"]; - return message.channel.send(r[Math.floor(Math.random() * r.length)]); + if (incl(["heya luno", "hi luno", "sup luno", "what's up luno", "whats up luno", "hey luno", "hai luno", "howdy luno"])) { + const r = ["Heya there Crescent! How are ya?", "Hi cutie ^^ What's up?", "Sup qt ;) Hru?", "What's up my favorite femboy?"]; + await message.channel.send(r[Math.floor(Math.random() * r.length)]); + try { + let content = await message.channel.awaitMessages(m => m.author.id === "480535078150340609", {max: 1, errors: ['time'], time: 60000, maxMatches: 1}); + content = content.first().content; + if (incl(["not so good", "not good", "not pog"], content.toLowerCase())) { + const r2 = ["Aw :( I sowwy", "y sadge moment?"]; + await message.channel.send(r2[Math.floor(Math.random() * r2.length)]); + try { + content = await message.channel.awaitMessages(m => m.author.id === "480535078150340609", {max: 1, errors: ['time'], time: 60000, maxMatches: 1}); + content = content.first().content; + + } catch {} + } + if (content.toLowerCase().includes("good")) { + const r2 = ["That's good to hear qt ^^", "Me too!", ":) Glad to know my favorite femboy is doing well!"]; + return message.channel.send(r2[Math.floor(Math.random() * r2.length)]); + } + } catch {} } } } \ No newline at end of file diff --git a/util/cache.js b/util/cache.js index 19c959c..57c82d1 100644 --- a/util/cache.js +++ b/util/cache.js @@ -23,4 +23,9 @@ module.exports = async (client) => { await require('./cache/lr')(client); ora_lrCache.stop(); ora_lrCache.clear(); console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.lxp.hasLevelRoles.length}`)} ${chalk.blueBright(`guilds with Level Roles enabled.`)}`); + + let ora_mCache = ora("Caching Mutes...").start(); + await require('./cache/mute')(client); + ora_mCache.stop(); ora_mCache.clear(); + console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.mute.size}`)} ${chalk.blueBright(`mutes`)}`); }; \ No newline at end of file diff --git a/util/cache/mute.js b/util/cache/mute.js new file mode 100644 index 0000000..68bdec4 --- /dev/null +++ b/util/cache/mute.js @@ -0,0 +1,9 @@ +const Mute = require('../../models/mute'); + +module.exports = async (client) => { + client.misc.cache.mute = new Map(); + + for await (const mute of Mute.find()) { + client.misc.cache.mute.set(mute.uid, mute.until); + } +}; \ No newline at end of file