From 92e127d05dd6ccfa4346bfc5ae7dc9adecc47804 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Tue, 4 Jan 2022 01:07:08 -0700 Subject: [PATCH 01/96] fix more non string value bugs --- events/guildCreate.js | 2 +- events/guildDelete.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/events/guildCreate.js b/events/guildCreate.js index 50c1b9a..77dda7e 100644 --- a/events/guildCreate.js +++ b/events/guildCreate.js @@ -18,7 +18,7 @@ module.exports = async (client, guild) => { .setAuthor({name: 'New Guild Added', iconURL: client.users.cache.get(guild.ownerId).avatarURL()}) .setTitle(guild.name) .setThumbnail(guild.iconURL({size: 2048})) - .addField('Owner', client.users.cache.get(guild.ownerId).tag, true) + .addField('Owner', `${client.users.cache.get(guild.ownerId).tag}`, true) .addField('Members', `${guild.members.cache.size}`, true) .addField('Position', `Server #${client.guilds.cache.size}`, true) .setColor('55ff7f') diff --git a/events/guildDelete.js b/events/guildDelete.js index 0a76a8a..00e761c 100644 --- a/events/guildDelete.js +++ b/events/guildDelete.js @@ -17,8 +17,8 @@ module.exports = async (client, guild) => { .setAuthor({name: 'Server Lost', iconURL: client.users.cache.get(guild.ownerId).avatarURL()}) .setTitle(guild.name) .setThumbnail(guild.iconURL({size: 2048})) - .addField('Owner', client.users.cache.get(guild.ownerId).tag, true) - .addField('Members', guild.members.cache.size, true) + .addField('Owner', `${client.users.cache.get(guild.ownerId).tag}`, true) + .addField('Members', `${guild.members.cache.size}`, true) .addField('Position', `Server #${client.guilds.cache.size + 1}`, true) .setColor('ff5d6a') .setFooter({text: "Natsuki"}) From 4365bbe479f686c65bf840b8245559a82bd37447 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Tue, 4 Jan 2022 16:09:05 -0700 Subject: [PATCH 02/96] default prefix changes in dev mode --- events/messageCreate.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/events/messageCreate.js b/events/messageCreate.js index 957155e..414ad27 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -19,11 +19,10 @@ module.exports = async (client, message) => { if (!channelTypes.includes(message.channel.type)) {return undefined;} - //if (message.channel.type == "text") {if (settings[message.guild.id]) {prefix = settings[message.guild.id].prefix;};}; - if (message.guild && !message.member.permissions.has("SEND_MESSAGES")) {return undefined;} - let prefix = message.guild ? client.guildconfig.prefixes.has(message.guild.id) ? client.guildconfig.prefixes.get(message.guild.id) !== null ? client.guildconfig.prefixes.get(message.guild.id) : 'n?' : 'n?' : 'n?'; + let defaultPrefix = client.misc.config.dev ? 'n!' : 'n?'; + let prefix = message.guild ? client.guildconfig.prefixes.has(message.guild.id) ? client.guildconfig.prefixes.get(message.guild.id) !== null ? client.guildconfig.prefixes.get(message.guild.id) : defaultPrefix : defaultPrefix : defaultPrefix; let msg = message.content.toLowerCase().replace('\u200E', ''); let mention = message.mentions.users.first(); @@ -78,7 +77,7 @@ module.exports = async (client, message) => { } } - //if (message.guild && client.misc.cache.chests.includes(message.guild.id)) {require('../util/lxp/spawnchest')(client, message.member, message.channel, prefix);} + if (message.guild && client.misc.cache.chests.enabled.includes(message.guild.id)) {require('../util/lxp/spawnchest')(client, message.member, message.channel, prefix);} if (!client.misc.cache.monners[message.author.id]) { let tmonners = await Monners.findOne({uid: message.author.id}) || new Monners({uid: message.author.id}); From 4a19bff4f0af123585a0d7029f17c3a89f2e36c5 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Tue, 4 Jan 2022 16:34:26 -0700 Subject: [PATCH 03/96] chest claiming --- bot.js | 7 ++++++- commands/leveling/chests.js | 4 ++-- commands/leveling/claim.js | 29 +++++++++++++++++++++++++++++ util/cache.js | 2 +- util/cache/chest.js | 4 ++-- util/cache/lxp.js | 2 +- util/lxp/spawnchest.js | 14 ++++++++++---- 7 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 commands/leveling/claim.js diff --git a/bot.js b/bot.js index 2edc42d..8bba88a 100644 --- a/bot.js +++ b/bot.js @@ -36,6 +36,11 @@ client.misc = { }, chests: [], chestsTimeout: new Map(), + chests: { + enabled: [], + timeout: new Map(), + waiting: new Map() + }, monit: {}, monitEnabled: [], inVC: [], @@ -128,7 +133,7 @@ async function init() { client.utils.logch = async () => {return client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915');}; client.utils.s = num => num === 1 ? '' : 's'; client.utils.as = (num, text) => `${text}${client.utils.s(num)}`; - client.utils.an = (text, caps) => `${caps ? 'A' : 'a'}${['a', 'e', 'i', 'o'].includes(text.toLowerCase().trim().slice(0, 1)) ? 'n' : ''} ${text}`; + client.utils.an = (text, caps) => `${caps ? 'A' : 'a'}${['a', 'e', 'i', 'o', 'u'].includes(text.toLowerCase().trim().slice(0, 1)) ? 'n' : ''} ${text}`; client.guildconfig = {}; client.guildconfig.prefixes = new Map(); diff --git a/commands/leveling/chests.js b/commands/leveling/chests.js index 2626b49..b290ac6 100644 --- a/commands/leveling/chests.js +++ b/commands/leveling/chests.js @@ -24,7 +24,7 @@ module.exports = { if (!args.length) {args[0] = 'enable';} if (['e', 'enable'].includes(args[0].toLowerCase())) { - if (client.misc.cache.chests.includes(message.guild.id)) {return message.channel.send("This server already has chest spawning enabled.")}; + if (client.misc.cache.chests.enabled.includes(message.guild.id)) {return message.channel.send("This server already has chest spawning enabled.")}; try { am = await message.channel.send("Would you like to have me send chests to a specific channel?"); await am.react('👍'); @@ -43,7 +43,7 @@ module.exports = { } let c = new Chests({gid: message.guild.id, channel: chestCh}); c.save(); - client.misc.cache.chests.push(message.guild.id); + client.misc.cache.chests.enabled.push(message.guild.id); return message.channel.send({embeds: [new Discord.MessageEmbed() .setTitle("Chest Spawning Enabled!") .setThumbnail(message.guild.iconURL({size: 2048})) diff --git a/commands/leveling/claim.js b/commands/leveling/claim.js new file mode 100644 index 0000000..18b6a91 --- /dev/null +++ b/commands/leveling/claim.js @@ -0,0 +1,29 @@ +const Discord = require('discord.js'); + +module.exports = { + name: "claim", + aliases: [], + meta: { + category: 'Leveling', + description: "Claim a chest that has spawned in the channel", + syntax: '`claim [specialText]`', + extra: null, + guildOnly: true + }, + help: "Claim a chest that has spawned in the channel. You must be in the same channel as the chest in order to claim it.", + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!client.misc.cache.chests.enabled.includes(message.guild.id)) {return message.channel.send("Chests aren't enabled in this server!");} + if (!client.misc.cache.chests.waiting.has(message.channel.id)) {return message.channel.send("There are no chests to claim in this channel.");} + if (!client.misc.cache.monners[message.author.id]) {return message.channel.send("There was an issue on my side with claiming your chest. This happened because I don't have your Monners info cached, so send a message anywhere and then try again. Sorry!");} + + let chest = client.misc.cache.chests.waiting.get(message.channel.id); + client.misc.cache.monners[message.author.id] += chest.amount; + client.misc.cache.chests.waiting.delete(message.channel.id); + chest.message.delete().catch(() => {}); + return message.channel.send({embeds: [new Discord.MessageEmbed() + .setAuthor({name: message.member.displayName, iconURL: message.member.displayAvatarURL()}) + .setDescription(`You've claimed ${client.utils.an(chest.rarity.name, true)} Chest with **${chest.amount} Monners<:monners:926736756047495218>**`) + .setColor(chest.rarity.color) + ]}).catch(() => {}); + } +}; \ No newline at end of file diff --git a/util/cache.js b/util/cache.js index 979ae29..34e2f3c 100644 --- a/util/cache.js +++ b/util/cache.js @@ -42,5 +42,5 @@ module.exports = async (client) => { let ora_ctCache = ora("Caching Chests...").start(); await require('./cache/chest')(client); ora_ctCache.stop(); ora_ctCache.clear(); - console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.chests.length}`)} ${chalk.blueBright("guilds that spawn chests.")}`); + console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.chests.enabled.length}`)} ${chalk.blueBright("guilds that spawn chests.")}`); }; \ No newline at end of file diff --git a/util/cache/chest.js b/util/cache/chest.js index 8e9ec65..4ab945c 100644 --- a/util/cache/chest.js +++ b/util/cache/chest.js @@ -1,9 +1,9 @@ const Chests = require('../../models/chests'); module.exports = async client => { - client.misc.cache.chests = []; + client.misc.cache.chests.enabled = []; for await (const chest of Chests.find()) { - client.misc.cache.chests.push(chest.gid); + client.misc.cache.chests.enabled.push(chest.gid); } }; \ No newline at end of file diff --git a/util/cache/lxp.js b/util/cache/lxp.js index 754d7c2..3dc45c8 100644 --- a/util/cache/lxp.js +++ b/util/cache/lxp.js @@ -3,7 +3,7 @@ const LXP = require('../../models/localxp'); module.exports = async client => { client.misc.cache.lxp.enabled = []; client.misc.cache.lxp.disabledChannels = new Map(); - client.misc.cache.chests = new Map(); + client.misc.cache.chests.enabled = new Map(); for await (const xp of LXP.find()) { client.misc.cache.lxp.enabled.push(xp.gid); diff --git a/util/lxp/spawnchest.js b/util/lxp/spawnchest.js index 58680f4..1324066 100644 --- a/util/lxp/spawnchest.js +++ b/util/lxp/spawnchest.js @@ -4,7 +4,7 @@ const manyitems = require('manyitems'); const Discord = require('discord.js'); module.exports = async (client, member, channel, prefix) => { - if (client.misc.cache.chestsTimeout.has(member.guild.id) && new Date().getTime() - client.misc.cache.chestsTimeout.get(member.guild.id) < (1000 * 60 * 2)) {return;} + if (client.misc.cache.chests.timeout.has(member.guild.id) && new Date().getTime() - client.misc.cache.chests.timeout.get(member.guild.id) < (1000 * 60 * 2)) {return;} //let rand = Math.floor(Math.random() * 100); //if (rand !== 69) {return;} //decide if it even continues @@ -62,7 +62,7 @@ module.exports = async (client, member, channel, prefix) => { if (!chests) {return;} let spawnChannel = chests.channel && chests.channel.length ? chests.channel : channel; - client.misc.cache.chestsTimeout.set(member.guild.id, new Date().getTime()); + client.misc.cache.chests.timeout.set(member.guild.id, new Date().getTime()); let chestEmbed = new Discord.MessageEmbed() .setTitle(`${client.utils.an(rarity.name, true)} Chest has spawned!`) @@ -70,10 +70,16 @@ module.exports = async (client, member, channel, prefix) => { .setFooter({text: `Type \`${prefix}claim\` to claim it!`}) .setColor(rarity.color) //create the chest message - if (spawnChannel === channel) {return channel.send({embeds: [chestEmbed]}).catch(() => {});} + if (spawnChannel === channel) { + return channel.send({embeds: [chestEmbed]}) + .then(m => {client.misc.cache.chests.waiting.set(m.channel.id, {amount: amount, rarity: rarity, message: m});}) + .catch(() => {}); + } else { member.guild.channels.fetch(spawnChannel) - .then(ch => ch.send({embeds: [chestEmbed]}).catch(() => {})) + .then(ch => ch.send({embeds: [chestEmbed]}) + .then(m => {client.misc.cache.chests.waiting.set(m.channel.id, {amount: amount, rarity: rarity, message: m});}) + .catch(() => {})) .catch(() => {}) } return spawnChannel.send({embeds: [chestEmbed]}); //spawn the chest From bc8bf518d162793b80c70f2b6546d0b3672235d8 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Tue, 4 Jan 2022 16:37:28 -0700 Subject: [PATCH 04/96] wait for client fully started to respond to msgs --- bot.js | 3 ++- events/messageCreate.js | 2 ++ events/ready.js | 2 ++ util/lxp/spawnchest.js | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bot.js b/bot.js index 8bba88a..39a24e3 100644 --- a/bot.js +++ b/bot.js @@ -63,7 +63,8 @@ client.misc = { logs: 'normal', lightstartup: false, ignorecmds: [] - } + }, + fullyReady: false }; //const config = require('./config.js'); diff --git a/events/messageCreate.js b/events/messageCreate.js index 414ad27..5af311a 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -12,6 +12,8 @@ const Monners = require('../models/monners'); const channelTypes = ["GUILD_MESSAGE", "DM", "GUILD_NEWS_THREAD", "GUILD_PRIVATE_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_NEWS", "GROUP_DM", "GUILD_STORE", "GUILD_TEXT"]; module.exports = async (client, message) => { + if (!client.misc.fullyReady) {return;} + if (message.partial) {await message.fetch();} if (message.channel.partial) {await message.channel.fetch();} diff --git a/events/ready.js b/events/ready.js index 63de9f4..8defbdc 100644 --- a/events/ready.js +++ b/events/ready.js @@ -108,5 +108,7 @@ module.exports = async client => { await botData.save(); + client.misc.fullyReady = true; + require('../console')(client); }; \ No newline at end of file diff --git a/util/lxp/spawnchest.js b/util/lxp/spawnchest.js index 1324066..da54d7f 100644 --- a/util/lxp/spawnchest.js +++ b/util/lxp/spawnchest.js @@ -5,8 +5,8 @@ const Discord = require('discord.js'); module.exports = async (client, member, channel, prefix) => { if (client.misc.cache.chests.timeout.has(member.guild.id) && new Date().getTime() - client.misc.cache.chests.timeout.get(member.guild.id) < (1000 * 60 * 2)) {return;} - //let rand = Math.floor(Math.random() * 100); - //if (rand !== 69) {return;} //decide if it even continues + let rand = Math.floor(Math.random() * 100); + if (rand !== 69 && rand !== 42) {return;} //decide if it even continues let tm = await Monners.findOne({uid: member.id}); let streak = tm && tm.daily ? tm.daily.streak : 0; //get streak for bonus later From 12d74162d7b39247815e3afed382cc2936a8988e Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Tue, 4 Jan 2022 16:38:18 -0700 Subject: [PATCH 05/96] fix chest footer --- util/lxp/spawnchest.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/lxp/spawnchest.js b/util/lxp/spawnchest.js index da54d7f..38fc7d1 100644 --- a/util/lxp/spawnchest.js +++ b/util/lxp/spawnchest.js @@ -67,12 +67,12 @@ module.exports = async (client, member, channel, prefix) => { let chestEmbed = new Discord.MessageEmbed() .setTitle(`${client.utils.an(rarity.name, true)} Chest has spawned!`) .setDescription(`It has **${amount} Monners<:monners:926736756047495218>**`) - .setFooter({text: `Type \`${prefix}claim\` to claim it!`}) + .setFooter({text: `Type ${prefix}claim to claim it!`}) .setColor(rarity.color) //create the chest message if (spawnChannel === channel) { return channel.send({embeds: [chestEmbed]}) - .then(m => {client.misc.cache.chests.waiting.set(m.channel.id, {amount: amount, rarity: rarity, message: m});}) + .then(m => {client.misc.cache.chests.waiting.set(m.channel.id, {amount: amount, rarity: rarity, message: m});}) //place the chest in waiting to make it claimable .catch(() => {}); } else { From e2630e80f31880e1fef198a4ae0ba98f4415a9f4 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Wed, 5 Jan 2022 20:59:27 -0700 Subject: [PATCH 06/96] custom names for monners --- bot.js | 3 ++- commands/leveling/claim.js | 4 ++-- commands/leveling/daily.js | 2 +- commands/leveling/namemonners.js | 41 ++++++++++++++++++++++++++++++++ commands/leveling/stats.js | 2 +- events/messageCreate.js | 2 ++ events/ready.js | 4 ++++ models/monnersnames.js | 0 util/lxp/gainxp.js | 6 ++--- util/lxp/spawnchest.js | 2 +- 10 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 commands/leveling/namemonners.js create mode 100644 models/monnersnames.js diff --git a/bot.js b/bot.js index 39a24e3..124aeaf 100644 --- a/bot.js +++ b/bot.js @@ -52,7 +52,8 @@ client.misc = { animeID: new Discord.Collection(), charsNum: 0, charsLove: new Discord.Collection(), - monners: {} + monners: {}, + monnersNames: new Map() }, loggers: {}, rl: readline.createInterface({input: process.stdin, output: process.stdout}), diff --git a/commands/leveling/claim.js b/commands/leveling/claim.js index 18b6a91..a6d6f87 100644 --- a/commands/leveling/claim.js +++ b/commands/leveling/claim.js @@ -14,7 +14,7 @@ module.exports = { async execute(message, msg, args, cmd, prefix, mention, client) { if (!client.misc.cache.chests.enabled.includes(message.guild.id)) {return message.channel.send("Chests aren't enabled in this server!");} if (!client.misc.cache.chests.waiting.has(message.channel.id)) {return message.channel.send("There are no chests to claim in this channel.");} - if (!client.misc.cache.monners[message.author.id]) {return message.channel.send("There was an issue on my side with claiming your chest. This happened because I don't have your Monners info cached, so send a message anywhere and then try again. Sorry!");} + if (!client.misc.cache.monners[message.author.id]) {return message.channel.send(`There was an issue on my side with claiming your chest. This happened because I don't have your ${message.misc.mn} info cached, so send a message anywhere and then try again. Sorry!`);} let chest = client.misc.cache.chests.waiting.get(message.channel.id); client.misc.cache.monners[message.author.id] += chest.amount; @@ -22,7 +22,7 @@ module.exports = { chest.message.delete().catch(() => {}); return message.channel.send({embeds: [new Discord.MessageEmbed() .setAuthor({name: message.member.displayName, iconURL: message.member.displayAvatarURL()}) - .setDescription(`You've claimed ${client.utils.an(chest.rarity.name, true)} Chest with **${chest.amount} Monners<:monners:926736756047495218>**`) + .setDescription(`You've claimed ${client.utils.an(chest.rarity.name, true)} Chest with **${chest.amount} ${message.misc.mn}<:monners:926736756047495218>**`) .setColor(chest.rarity.color) ]}).catch(() => {}); } diff --git a/commands/leveling/daily.js b/commands/leveling/daily.js index 17888bb..3b105d6 100644 --- a/commands/leveling/daily.js +++ b/commands/leveling/daily.js @@ -44,7 +44,7 @@ module.exports = { .setAuthor({iconURL: message.guild ? message.member.displayAvatarURL() : message.author.iconURL(), name: message.guild ? message.member.displayName : message.author.username}) .setDescription(`You've claimed today's daily!`) .addField("Streak", streakIncrease ? `Your streak has **increased** to **${tm.daily.streak}**` : 'Your streak has **reset** to **1**.', true) - .addField("Bonus Monners", `<:monners:926736756047495218> ${bonus}`, true) + .addField(`Bonus ${message.misc.mn}`, `<:monners:926736756047495218> ${bonus}`, true) .addField("Total Dailies Claimed", `${tm.daily.total}`) .setColor('c375f0') ]}); diff --git a/commands/leveling/namemonners.js b/commands/leveling/namemonners.js new file mode 100644 index 0000000..1621217 --- /dev/null +++ b/commands/leveling/namemonners.js @@ -0,0 +1,41 @@ +const Discord = require('discord.js'); + +const Saves = require('../../models/saves'); + +module.exports = { + name: "namemonners", + aliases: ['namemon', 'nm'], + meta: { + category: 'Leveling', + description: "Rename the currency for your server", + syntax: '`namemonners `', + extra: null, + guildOnly: true + }, + help: new Discord.MessageEmbed() + .setTitle("Help -> Monners Naming") + .setDescription("Rename the Monners for your server. This merely a cosmetic effect. Monners gains will remain global regardless.") + .addField("Notice", "You must be an administrator in the server in order to edit these settings.") + .addField("Syntax", "`namemonners `"), + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!args.length) {return message.channel.send(`Syntax: \`${prefix}namemonners \``);} + if (!message.member.permissions.has("ADMINISTRATOR")) {return message.channel.send("You must be an administrator in this server in order to do that.");} + let name = args.join(" "); + const names = await Saves.findOne({name: 'monnersnames'}); + const nsaves = names.saves; + if (name.toLowerCase() === 'clear') { + nsaves.delete(message.guild.id); + client.misc.cache.monnersNames.delete(message.guild.id); + message.channel.send("I'll now refer to currency in this server as Monners again."); + } else { + if (name.length > 12) {return message.channel.send("That name is too long! Keep it short and simple.");} + if (name.match(//gm)) {return message.channel.send("You can't have an emoji in your monners name.");} + if (!name.match(/^[a-zA-Z0-9-]+$/gm)) {return message.channel.send("Your name must contain only alphanumeric characters.");} + nsaves.set(message.guild.id, name); + client.misc.cache.monnersNames.set(message.guild.id, name); + message.channel.send(`Cool. I'll refer to Monners in this server as "${name}" now.`); + } + names.saves = nsaves; + return await names.save(); + } +}; \ No newline at end of file diff --git a/commands/leveling/stats.js b/commands/leveling/stats.js index da059ca..aaa8890 100644 --- a/commands/leveling/stats.js +++ b/commands/leveling/stats.js @@ -71,7 +71,7 @@ module.exports = { .setDescription("Local leveling stats") .addField("Level", `${xp.level}`, true) .addField("XP", `**${xp.xp}** of **${Math.ceil(100 + (((xp.level / 3) ** 2) * 2))}** needed to level up`, true) - .addField("Monners", `<:monners:926736756047495218> ${tcur}`) + .addField(`${message.misc.mn}`, `<:monners:926736756047495218> ${tcur}`) .setThumbnail(client.users.cache.get(u.id).avatarURL({size: 2048})) .setColor("c375f0") .setFooter({text: "Natsuki"}) diff --git a/events/messageCreate.js b/events/messageCreate.js index 5af311a..fb1e8c2 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -35,6 +35,8 @@ module.exports = async (client, message) => { : message.content.slice(3 + client.user.id.length).trim().replace('\u200E', '').split(/\s+/g); let cmd = args.shift().toLowerCase().trim(); + message.misc = {mn: message.guild ? (client.misc.cache.monnersNames.get(message.guild.id) || 'Monners') : 'Monners'}; + if (message.content.includes("@everyone")) {return;} if ([`<@${client.user.id}>`, `<@!${client.user.id}>`].includes(msg)) { diff --git a/events/ready.js b/events/ready.js index 8defbdc..c87a803 100644 --- a/events/ready.js +++ b/events/ready.js @@ -5,6 +5,7 @@ const lastfm = require("lastfm"); const GuildSettings = require('../models/guild'); const BotDataSchema = require('../models/bot'); const LogData = require('../models/log'); +const Saves = require('../models/saves'); const siftStatuses = require('../util/siftstatuses'); const localXPCacheClean = require('../util/lxp/cacheloop'); @@ -82,6 +83,9 @@ module.exports = async client => { await require('../util/cache')(client); + let mnsaves = await Saves.findOne({name: 'monnersnames'}) || new Saves({name: 'monnersnames'}); + client.misc.cache.monnersNames = mnsaves.saves; + setInterval(() => localXPCacheClean(client), 150000); setInterval(() => monitorCacheClean(client), 150000); diff --git a/models/monnersnames.js b/models/monnersnames.js new file mode 100644 index 0000000..e69de29 diff --git a/util/lxp/gainxp.js b/util/lxp/gainxp.js index c43ccd3..ccf4d93 100644 --- a/util/lxp/gainxp.js +++ b/util/lxp/gainxp.js @@ -38,7 +38,7 @@ module.exports = async (client, member, channel) => { client.misc.cache.monners[member] += cur; if (ch && ch.permissionsFor(ch.guild.me.id).has('SEND_MESSAGES')) { - if (!ch.permissionsFor(ch.guild.me.id).has('ATTACH_FILES')) {ch.send(`<:awoo:560193779764559896> <@${member}> has reached **Level ${x + 1}**, and gained **${cur}** bonus Monners<:monners:926736756047495218>! `).catch((e) => {/*console.error(e)*/});} + if (!ch.permissionsFor(ch.guild.me.id).has('ATTACH_FILES')) {ch.send(`<:awoo:560193779764559896> <@${member}> has reached **Level ${x + 1}**, and gained **${cur}** bonus ${client.misc.cache.monnersNames.get(channel.guild.id) || 'Monners'}<:monners:926736756047495218>! `).catch((e) => {/*console.error(e)*/});} else { const canvas = Canvas.createCanvas(1193, 411); const context = canvas.getContext('2d'); @@ -55,7 +55,7 @@ module.exports = async (client, member, channel) => { const monnersImage = await Canvas.loadImage('https://cdn.discordapp.com/emojis/926736756047495218'); context.drawImage(monnersImage, canvas.width / 2.8, canvas.height / 1.5, 58, 60); - context.fillText(`${oldMonners} + ${cur} Bonus Monners`, (canvas.width / 2.8) + 70, (canvas.height / 1.55) + 57); + context.fillText(`${oldMonners} + ${cur} Bonus ${client.misc.cache.monnersNames.get(channel.guild.id) || 'Monners'}`, (canvas.width / 2.8) + 70, (canvas.height / 1.55) + 57); context.font = applyText(canvas, `${ch.guild.members.cache.get(member).displayName}`); //center text context.fillText(`${ch.guild.members.cache.get(member).displayName}`, canvas.width / 2.8, canvas.height / 2.7); @@ -64,7 +64,7 @@ module.exports = async (client, member, channel) => { context.drawImage(avatar, 40, 40, canvas.height - 80, canvas.height - 80); ch.send({ - content: `<:awoo:560193779764559896> <@${member}> has reached **Level ${x + 1}**, and gained **${cur}** bonus Monners<:monners:926736756047495218>! `, + content: `<:awoo:560193779764559896> <@${member}> has reached **Level ${x + 1}**, and gained **${cur}** bonus ${client.misc.cache.monnersNames.get(channel.guild.id) || 'Monners'}<:monners:926736756047495218>! `, files: [new Discord.MessageAttachment(canvas.toBuffer(), 'level-up.png')] }); } diff --git a/util/lxp/spawnchest.js b/util/lxp/spawnchest.js index 38fc7d1..65f94ef 100644 --- a/util/lxp/spawnchest.js +++ b/util/lxp/spawnchest.js @@ -66,7 +66,7 @@ module.exports = async (client, member, channel, prefix) => { let chestEmbed = new Discord.MessageEmbed() .setTitle(`${client.utils.an(rarity.name, true)} Chest has spawned!`) - .setDescription(`It has **${amount} Monners<:monners:926736756047495218>**`) + .setDescription(`It has **${amount} ${client.misc.cache.monnersNames.get(member.guild.id) || 'Monners'}<:monners:926736756047495218>**`) .setFooter({text: `Type ${prefix}claim to claim it!`}) .setColor(rarity.color) //create the chest message From 8253e9a6522d7d695b76edbc694c189635d10348 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Mon, 10 Jan 2022 13:05:54 -0700 Subject: [PATCH 07/96] higher ani name for natsuki staff --- .idea/workspace.xml | 7 ++++++- commands/anime/anime.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8cf679b..80b0f15 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,7 +6,7 @@ - + + + @@ -79,6 +82,8 @@ + + 1640148826800 diff --git a/commands/anime/anime.js b/commands/anime/anime.js index 772c3ac..b46434b 100644 --- a/commands/anime/anime.js +++ b/commands/anime/anime.js @@ -78,7 +78,7 @@ module.exports = { dmch = mesg.channel; options.name = await ask(mesg, "What is the anime's name? Make sure to use proper capitalization and spelling. This applies to the rest of the questions I'll ask you.", 60000, true); if (!options.name) {return;} - if (options.name.length > 75) {clearDM(); return dmch.send("The anime name can't be more than 75 characters!");} + if (options.name.length > (queue ? 75 : 250)) {clearDM(); return dmch.send(`The anime name can't be more than ${queue ? 75 : 250} characters!`);} options.plot = await ask(mesg, "How would you describe the anime? Give a very brief description of things like its plot, main characters, and setting.", 240000, true); if (!options.plot) {return clearDM();} if (options.plot.length > 500) {clearDM(); return dmch.send("Oi! I said give a \"very brief\" description of the anime!");} From c04936c1e7acbfe614b796836107517e6fc892fd Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Mon, 10 Jan 2022 18:09:05 -0700 Subject: [PATCH 08/96] fix images not showing in charsearch --- .idea/workspace.xml | 24 +++++++++++- package-lock.json | 79 +++++++++++++++++++++++++++++++++++++--- package.json | 2 + util/anime/charsearch.js | 2 +- 4 files changed, 99 insertions(+), 8 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8cf679b..1d58157 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,8 +5,11 @@ + - + + + + + + @@ -57,8 +65,19 @@ + + + + +