diff --git a/commands/emotecount.js b/commands/emotecount.js index 0fe6635d1..1ef53bea3 100644 --- a/commands/emotecount.js +++ b/commands/emotecount.js @@ -21,17 +21,22 @@ module.exports = { let data4 = ""; for (const [key, value] of Object.entries(GuildEmoteCount)) { const Emote = message.guild.emojis.cache.get(key); - if (data.length < 2000 && Emote) { + if (!Emote) { continue; } + if (data.length <= 2000) { data += `${Emote} \`${Object.values(value)}\` `; + continue; } - if (data.length > 2000 && data2.length < 2000 && Emote) { + if (data.length >= 2000 && data2.length <= 2000) { data2 += `${Emote} \`${Object.values(value)}\` `; + continue; } - if (data2.length > 2000 && data3.length < 2000 && Emote) { + if (data2.length >= 2000 && data3.length <= 2000) { data3 += `${Emote} \`${Object.values(value)}\` `; + continue; } - if (data3.length > 2000 && data4.length < 2000 && Emote) { + if (data3.length >= 2000 && data4.length <= 2000) { data4 += `${Emote} \`${Object.values(value)}\` `; + continue; } } embed.setDescription(data); diff --git a/commands/tinder.js b/commands/tinder.js index 56ee78685..05ac80047 100644 --- a/commands/tinder.js +++ b/commands/tinder.js @@ -1,7 +1,7 @@ const Discord = require("discord.js"); const db = require("quick.db"); const Tinder = new db.table("Tinder"); -const { getUserFromMention, ResetRolls } = require("../functions/functions.js"); +const { getUserFromMention, ResetRolls, timeToMidnight, msToTime } = require("../functions/functions.js"); const embeds = require("../functions/embeds.js"); const { TinderStartup, TinderDBService, NoLikes, NoRolls } = require("../functions/tinder.js"); const { poems } = require("../functions/poems.js"); @@ -20,7 +20,7 @@ module.exports = { TinderDBService(message.author); } switch (args[0]) { - case "refill": { + case "reset": { try { if (message.member.hasPermission("ADMINISTRATOR")) { ResetRolls(message); return message.react("✅"); } @@ -32,7 +32,9 @@ module.exports = { } case "marry": { return marry(); } - case "help": { return message.channel.send(embeds.TinderHelp); + case "help": { + embeds.TinderHelp.fields[3] = { name: "Reset", value: "Rolls and likes reset every day. Currently resets in: " + msToTime(timeToMidnight()), inline: true }; + return message.channel.send(embeds.TinderHelp); } case "test": { // remove try { if (message.member.hasPermission("ADMINISTRATOR")) { return; } diff --git a/functions/embeds.js b/functions/embeds.js index 4d69b792d..5966d41fd 100644 --- a/functions/embeds.js +++ b/functions/embeds.js @@ -1,9 +1,5 @@ const { MessageEmbed } = require("discord.js"); const { prefix } = require("../config.js"); -const { timeToMidnight, msToTime } = require("./functions"); - -const time2mid = timeToMidnight(); -const time2midHrs = msToTime(time2mid); const TinderHelp = new MessageEmbed() .setTitle("Tinder help page") @@ -11,7 +7,6 @@ const TinderHelp = new MessageEmbed() { name: "Rolls and likes", value: "Using the main command (`" + prefix + "tinder`), costs a roll!\nIf you decide to react with a 💚, you spend 1 like.\nIf you react with a 🌟, you spend all your rolls and likes.", inline: true }, { name: "How to marry", value: "You can only marry someone you are dating.\nMarrying is simple, type `" + prefix + "tinder marry @someone`\nThey will have to react with a ❤️, to complete the process!", inline: true }, { name: "Check status", value: "You can check who you have liked, disliked and who you are currently dating as well as who you have married.\n`" + prefix + "tinder list`", inline: true }, - { name: "Reset", value: "Rolls and likes reset every day. Currently resets in: " + time2midHrs, inline: true }, ) .setColor("#31e387") .setImage(); diff --git a/functions/functions.js b/functions/functions.js index 151fb52e1..d00b0cc6d 100644 --- a/functions/functions.js +++ b/functions/functions.js @@ -120,7 +120,7 @@ function DailyResetTimer() { }, timeToMidnight()); } function timeToMidnight(){ - var d = new Date(); + const d = new Date(); return (-d + d.setHours(24,0,0,0)); } function EmoteDBStartup(client) { @@ -149,7 +149,7 @@ function countEmotes(message) { } function msToTime(duration) { - var milliseconds = parseInt((duration % 1000) / 100), + let milliseconds = parseInt((duration % 1000) / 100), seconds = Math.floor((duration / 1000) % 60), minutes = Math.floor((duration / (1000 * 60)) % 60), hours = Math.floor((duration / (1000 * 60 * 60)) % 24); diff --git a/functions/tinder.js b/functions/tinder.js index fc0d9aec4..effdd52d0 100644 --- a/functions/tinder.js +++ b/functions/tinder.js @@ -3,9 +3,6 @@ const Tinder = new db.table("Tinder"); const Discord = require("discord.js"); const { timeToMidnight, msToTime } = require("./functions"); -const time2mid = timeToMidnight(); -const time2midHrs = msToTime(time2mid); - function tinderprofile(message) { //... } @@ -26,11 +23,13 @@ function TinderDBService(user) { // This is the peak of JS console.log("Tinder Database Service | Ran " + i + " changes."); } function NoLikes() { - + const time2mid = timeToMidnight(); + const time2midHrs = msToTime(time2mid); return "You don't have any more likes!\nLikes and rolls reset in: " + time2midHrs; } function NoRolls() { - + const time2mid = timeToMidnight(); + const time2midHrs = msToTime(time2mid); return "You don't have any more rolls!\nLikes and rolls reset in: " + time2midHrs; }