From 8b7bdce6d65aecf7ff23a204de10cf8864337d22 Mon Sep 17 00:00:00 2001 From: eYuM-coder Date: Thu, 5 Dec 2024 13:53:30 -0800 Subject: [PATCH] a --- .gitignore | 1 + config.json | 2 +- index.js | 7 +- src/commands/information/dashboard.js | 2 +- src/commands/moderation/ban.js | 3 +- src/commands/moderation/clear.js | 3 +- src/commands/moderation/kick.js | 5 +- src/commands/moderation/lock.js | 5 +- src/commands/moderation/mute.js | 6 +- src/commands/moderation/removerole.js | 5 +- src/commands/moderation/removewarn.js | 7 +- src/commands/moderation/resetwarn.js | 5 +- src/commands/moderation/setnickname.js | 5 +- src/commands/moderation/slowmode.js | 5 +- src/commands/moderation/softban.js | 7 +- src/commands/moderation/unban.js | 8 +- src/commands/moderation/unlock.js | 5 +- src/commands/moderation/warn.js | 96 +++++++++++----------- src/commands/moderation/warnpurge.js | 7 +- src/commands/owner/maintenance.js | 4 +- src/events/channels/channelCreate.js | 11 +-- src/events/channels/channelDelete.js | 7 +- src/events/channels/channelUpdate.js | 7 +- src/events/emojis/emojiCreate.js | 3 +- src/events/emojis/emojiDelete.js | 3 +- src/events/emojis/emojiUpdate.js | 3 +- src/events/errors/commandError.js | 2 +- src/events/guild/guildUpdate.js | 3 +- src/events/members/guildMemberAdd.js | 5 +- src/events/members/guildMemberRemove.js | 3 +- src/events/members/guildMemberUpdate.js | 20 +---- src/events/message/messageCreate.js | 8 +- src/events/message/messageDelete.js | 3 +- src/events/message/messageDeleteBulk.js | 3 +- src/events/message/messageUpdate.js | 3 +- src/events/roles/roleCreate.js | 3 +- src/events/roles/roleDelete.js | 3 +- src/events/roles/roleUpdate.js | 3 +- src/slashCommands/moderation/ban.js | 5 +- src/slashCommands/moderation/clear.js | 3 +- src/slashCommands/moderation/kick.js | 14 +++- src/slashCommands/moderation/lock.js | 5 +- src/slashCommands/moderation/removewarn.js | 1 + src/slashCommands/moderation/softban.js | 2 +- 44 files changed, 167 insertions(+), 144 deletions(-) diff --git a/.gitignore b/.gitignore index 2eaffc8..5a79d97 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ src/data/users.json package-lock.json config.json json.sqlite +mee8.log diff --git a/config.json b/config.json index 699a488..2bd65f6 100644 --- a/config.json +++ b/config.json @@ -25,7 +25,7 @@ "leavesPublic": "https://discord.com/api/webhooks/1313641714459607141/hiDTTsg6U91g3Tefz8FWs8YQYjqxc1rjmb9HjfbhdSl_jDxRrdr3azC1CNpjCAXymHB1", "leavesPrivate": "https://discord.com/api/webhooks/1313641714459607141/hiDTTsg6U91g3Tefz8FWs8YQYjqxc1rjmb9HjfbhdSl_jDxRrdr3azC1CNpjCAXymHB1" }, - "maintenance": "false", + "maintenance": "true", "maintenance_threshold": "5", "invite_link": "https://discord.com/oauth2/authorize?client_id=1290139203023142962&permissions=1759218604441599&integration_type=0&scope=bot+applications.commands", "seo": { diff --git a/index.js b/index.js index f50fd3d..4b8d94e 100644 --- a/index.js +++ b/index.js @@ -121,6 +121,7 @@ async function updateUserLevel(guildId, userId, xpGain) { let xpNeededForNextLevel = user.level * nextLevelXP; let previousLevel = user.level; let currentLevel = user.level; + let currentXP = user.xp; user.messageTimeout = Date.now(); @@ -133,7 +134,7 @@ async function updateUserLevel(guildId, userId, xpGain) { await guild.save(); - return { xpNeededForNextLevel, previousLevel, currentLevel }; + return { xpNeededForNextLevel, previousLevel, currentLevel, currentXP }; } client.on("messageCreate", async (message) => { @@ -149,7 +150,7 @@ client.on("messageCreate", async (message) => { if (Date.now() - user.messageTimeout >= 60000 && guild.levelingEnabled) { const xpGain = Math.floor(Math.random() * 15) + 10; - const { previousLevel, xpNeededForNextLevel, currentLevel } = await updateUserLevel( + const { previousLevel, xpNeededForNextLevel, currentLevel, currentXP } = await updateUserLevel( guildId, userId, xpGain, @@ -164,7 +165,7 @@ client.on("messageCreate", async (message) => { message.author.displayAvatarURL({ dynamic: true }), ) .setDescription(`You have reached level ${currentLevel}`) - .setFooter(`XP: ${user.xp}/${xpNeededForNextLevel}`); + .setFooter(`XP: ${currentXP}/${xpNeededForNextLevel}`); message.channel.send({ embeds: [levelbed] }); } diff --git a/src/commands/information/dashboard.js b/src/commands/information/dashboard.js index 0f7337d..12546d8 100644 --- a/src/commands/information/dashboard.js +++ b/src/commands/information/dashboard.js @@ -18,7 +18,7 @@ module.exports = class extends Command { new MessageButton() .setLabel("Dashboard") .setStyle("LINK") - .setURL("https://v2.pogy.xyz") + .setURL(`${process.env.AUTH_DOMAIN}/dashboard`) ); const dashembed = new MessageEmbed() diff --git a/src/commands/moderation/ban.js b/src/commands/moderation/ban.js index 98c956d..23bea72 100644 --- a/src/commands/moderation/ban.js +++ b/src/commands/moderation/ban.js @@ -2,6 +2,7 @@ const Command = require("../../structures/Command"); const { MessageEmbed } = require("discord.js"); const Guild = require("../../database/schemas/Guild.js"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { @@ -112,7 +113,7 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch((e) => { + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { console.log(e); }); diff --git a/src/commands/moderation/clear.js b/src/commands/moderation/clear.js index 186dfb0..daf3b18 100644 --- a/src/commands/moderation/clear.js +++ b/src/commands/moderation/clear.js @@ -2,6 +2,7 @@ const Command = require("../../structures/Command"); const { MessageEmbed } = require("discord.js"); const Logging = require("../../database/schemas/logging.js"); const logger = require("../../utils/logger.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { @@ -165,7 +166,7 @@ module.exports = class extends Command { .setFooter({ text: `Responsible ID: ${message.author.id}` }) .setColor(color); - channel.send({ embeds: [logEmbed] }).catch(() => {}); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch(() => {}); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/kick.js b/src/commands/moderation/kick.js index 7e62059..b8a76f3 100644 --- a/src/commands/moderation/kick.js +++ b/src/commands/moderation/kick.js @@ -2,6 +2,7 @@ const Command = require("../../structures/Command"); const { MessageEmbed } = require("discord.js"); const Guild = require("../../database/schemas/Guild.js"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { @@ -179,7 +180,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch(() => {}); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/lock.js b/src/commands/moderation/lock.js index f6a4234..3e4e7d0 100644 --- a/src/commands/moderation/lock.js +++ b/src/commands/moderation/lock.js @@ -2,6 +2,7 @@ const Command = require("../../structures/Command"); const { MessageEmbed } = require("discord.js"); const Guild = require("../../database/schemas/Guild.js"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { @@ -127,7 +128,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch(() => {}); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/mute.js b/src/commands/moderation/mute.js index 8e94fca..7af3ce2 100644 --- a/src/commands/moderation/mute.js +++ b/src/commands/moderation/mute.js @@ -127,9 +127,9 @@ module.exports = class extends Command { .setColor("RED") .setDescription( `You have been muted in **${ - interaction.guild.name - }**.\n\n__**Moderator:**__ ${interaction.author} **(${ - interaction.author.tag + message.guild.name + }**.\n\n__**Moderator:**__ ${message.author} **(${ + message.author.tag })**\n__**Reason:**__ ${reason || "No Reason Provided"}` ) .setTimestamp(); diff --git a/src/commands/moderation/removerole.js b/src/commands/moderation/removerole.js index ff65e5e..a8924e0 100644 --- a/src/commands/moderation/removerole.js +++ b/src/commands/moderation/removerole.js @@ -1,6 +1,7 @@ const Command = require("../../structures/Command"); const { MessageEmbed } = require("discord.js"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { @@ -162,7 +163,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch(() => {}); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/removewarn.js b/src/commands/moderation/removewarn.js index 91d03a6..1bbce4e 100644 --- a/src/commands/moderation/removewarn.js +++ b/src/commands/moderation/removewarn.js @@ -4,6 +4,7 @@ const Guild = require("../../database/schemas/Guild.js"); const warnModel = require("../../database/models/moderation.js"); const Logging = require("../../database/schemas/logging.js"); const discord = require("discord.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { super(...args, { @@ -229,9 +230,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch((e) => { - console.log(e); - }); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/resetwarn.js b/src/commands/moderation/resetwarn.js index c816548..06b4871 100644 --- a/src/commands/moderation/resetwarn.js +++ b/src/commands/moderation/resetwarn.js @@ -4,6 +4,7 @@ const Guild = require("../../database/schemas/Guild.js"); const warnModel = require("../../database/models/moderation.js"); const discord = require("discord.js"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { super(...args, { @@ -161,7 +162,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch(() => {}); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/setnickname.js b/src/commands/moderation/setnickname.js index 4e52fa8..111349f 100644 --- a/src/commands/moderation/setnickname.js +++ b/src/commands/moderation/setnickname.js @@ -1,6 +1,7 @@ const Command = require("../../structures/Command"); const { MessageEmbed } = require("discord.js"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { @@ -228,7 +229,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch(() => {}); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/slowmode.js b/src/commands/moderation/slowmode.js index 9891cfd..d17930d 100644 --- a/src/commands/moderation/slowmode.js +++ b/src/commands/moderation/slowmode.js @@ -2,6 +2,7 @@ const Command = require("../../structures/Command"); const { MessageEmbed } = require("discord.js"); const Guild = require("../../database/schemas/Guild.js"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { @@ -210,7 +211,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch(() => {}); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/softban.js b/src/commands/moderation/softban.js index 0bb7444..5e3255b 100644 --- a/src/commands/moderation/softban.js +++ b/src/commands/moderation/softban.js @@ -2,6 +2,7 @@ const Command = require("../../structures/Command"); const { MessageEmbed } = require("discord.js"); const Guild = require("../../database/schemas/Guild.js"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { @@ -158,9 +159,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch((e) => { - console.log(e); - }); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/unban.js b/src/commands/moderation/unban.js index 27a381b..6715edc 100644 --- a/src/commands/moderation/unban.js +++ b/src/commands/moderation/unban.js @@ -1,7 +1,7 @@ const Command = require("../../structures/Command"); const { MessageEmbed } = require("discord.js"); const Guild = require("../../database/schemas/Guild.js"); - +const send = require("../../packages/logs/index.js"); const Logging = require("../../database/schemas/logging.js"); module.exports = class extends Command { constructor(...args) { @@ -360,9 +360,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch((e) => { - console.log(e); - }); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/unlock.js b/src/commands/moderation/unlock.js index 732004b..b1f5b13 100644 --- a/src/commands/moderation/unlock.js +++ b/src/commands/moderation/unlock.js @@ -2,6 +2,7 @@ const Command = require("../../structures/Command"); const { MessageEmbed } = require("discord.js"); const Guild = require("../../database/schemas/Guild.js"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { @@ -131,7 +132,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch(() => {}); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/moderation/warn.js b/src/commands/moderation/warn.js index d20cd3d..24c1e6b 100644 --- a/src/commands/moderation/warn.js +++ b/src/commands/moderation/warn.js @@ -7,6 +7,7 @@ const randoStrings = require("../../packages/randostrings.js"); const random = new randoStrings(); const Logging = require("../../database/schemas/logging.js"); const ms = require("ms"); +const send = require("../../packages/logs/index.js"); async function usePrettyMs(ms) { const { default: prettyMilliseconds } = await import("pretty-ms"); const time = prettyMilliseconds(ms); @@ -68,24 +69,18 @@ module.exports = class extends Command { } // Combine all arguments after the mention into one string - const allArgs = args.slice(1).join(" "); + const fullCommand = args.slice(1).join(" "); + let match = fullCommand.match(/"([^"]+)"|(\S+)/g); - // Regular expression to detect valid time formats (like "2w", "6d", "1h", "30m", etc.) - const timeRegex = /\d+\s*[a-z]+/g; - - // Extract all potential time parts from the combined string - const timeMatches = allArgs.match(timeRegex).join(" "); - - console.log(timeMatches); - - // If there are time parts, parse them; otherwise, default to "1d" - let time = timeMatches ? ms(timeMatches) : ms("1d"); - console.log(time); - let warnTime = time / 1000; - let formattedTime = await usePrettyMs(time); + const parsedArgs = match.map((arg) => arg.replace(/^"|"$/g, "")) || ["1d"]; + let time = ms(parsedArgs[0]) || ms("1d"); + // If there are time parts, parse them; otherwise, set time to null (infinite) + let formattedTime = time ? await usePrettyMs(time) : "Infinity"; + // Remove the parsed time from the reason - let reason = allArgs.replace(timeMatches ? timeMatches : "", "").trim(); + let reason = parsedArgs.slice(time ? 1 : 0).join(" "); + reason = reason || "Not Specified"; // Default reason if none provided let warnID = random.password({ @@ -93,8 +88,10 @@ module.exports = class extends Command { string: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", }); - const expirationTime = new Date(); - expirationTime.setSeconds(expirationTime.getSeconds() + warnTime); + // Set expiration time only if a duration is provided + const expirationTime = time + ? new Date(Date.now() + time) + : null; let warnDoc = await warnModel .findOne({ @@ -122,14 +119,22 @@ module.exports = class extends Command { memberID: mentionedMember.id, }); } + warnDoc.modType.push("warn"); warnDoc.warnings.push(reason); warnDoc.warningID.push(warnID); warnDoc.moderator.push(message.member.id); warnDoc.date.push(Date.now()); - warnDoc.expiresAt.push(expirationTime); + + // Only add expiration time if it's not infinite + if (expirationTime) { + warnDoc.expiresAt.push(expirationTime); + } else { + warnDoc.expiresAt.push(null); // Represent infinite expiration + } await warnDoc.save().catch((err) => console.log(err)); + let dmEmbed; if ( logging && @@ -137,25 +142,17 @@ module.exports = class extends Command { logging.moderation.warn_action !== "1" ) { if (logging.moderation.warn_action === "2") { - dmEmbed = `${message.client.emoji.fail} | You were warned in **${ - message.guild.name - }**.\n\n**Expires** `; + dmEmbed = `${message.client.emoji.fail} | You were warned in **${message.guild.name + }**.\n\n**Expires** `; } else if (logging.moderation.warn_action === "3") { - dmEmbed = `${message.client.emoji.fail} | You were warned in **${ - message.guild.name - }** for ${reason}.\n\n**Expires** `; + dmEmbed = `${message.client.emoji.fail} | You were warned in **${message.guild.name + }** for ${reason}.\n\n**Duration:** ${formattedTime}`; } else if (logging.moderation.warn_action === "4") { - dmEmbed = `${message.client.emoji.fail} | You were warned in **${ - message.guild.name - }** by **${message.author} (${ - message.author.tag - })** for ${reason}.\n\n**Expires** `; + dmEmbed = `${message.client.emoji.fail} | You were warned in **${message.guild.name + }** by **${message.author} (${message.author.tag + })** for ${reason}.\n\n**Duration:** ${formattedTime}`; } mentionedMember @@ -166,7 +163,7 @@ module.exports = class extends Command { .setDescription(dmEmbed), ], }) - .catch(() => {}); + .catch(() => { }); } message.channel .sendCustom({ @@ -174,23 +171,22 @@ module.exports = class extends Command { new discord.MessageEmbed().setColor(client.color.green) .setDescription(`${language.warnSuccessful - .replace("{emoji}", client.emoji.success) - .replace("{user}", `**${mentionedMember.user.tag}** `)} - ${ - logging && logging.moderation.include_reason === "true" - ? `\n\n**Reason:** ${reason}` - : `` - }\n\n**Expires in ${formattedTime}**`), + .replace("{emoji}", client.emoji.success) + .replace("{user}", `**${mentionedMember.user.tag}** `)} + ${logging && logging.moderation.include_reason === "true" + ? `\n\n**Reason:** ${reason}` + : `` + }\n\n**Duration: ${formattedTime}**`), ], }) .then(async (s) => { if (logging && logging.moderation.delete_reply === "true") { setTimeout(() => { - s.delete().catch(() => {}); + s.delete().catch(() => { }); }, 5000); } }) - .catch(() => {}); + .catch(() => { }); if (logging && logging.moderation.auto_punish.toggle === "true") { if ( @@ -207,7 +203,7 @@ module.exports = class extends Command { .ban({ reason: `Auto Punish / Responsible user: ${message.author.tag}`, }) - .catch(() => {}); + .catch(() => { }); } else if (punishment === "2") { action = `kicked`; @@ -215,7 +211,7 @@ module.exports = class extends Command { .kick({ reason: `Auto Punish / Responsible user: ${message.author.tag}`, }) - .catch(() => {}); + .catch(() => { }); } else if (punishment === "3") { action = `softbanned`; @@ -260,7 +256,7 @@ module.exports = class extends Command { } if (logging) { if (logging.moderation.delete_after_executed === "true") { - message.delete().catch(() => {}); + message.delete().catch(() => { }); } const role = message.guild.roles.cache.get( @@ -301,12 +297,12 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch((e) => { + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { console.log(e); }); logging.moderation.caseN = logcase + 1; - await logging.save().catch(() => {}); + await logging.save().catch(() => { }); } } } diff --git a/src/commands/moderation/warnpurge.js b/src/commands/moderation/warnpurge.js index 791ce65..4a28979 100644 --- a/src/commands/moderation/warnpurge.js +++ b/src/commands/moderation/warnpurge.js @@ -6,6 +6,7 @@ const discord = require("discord.js"); const randoStrings = require("../../packages/randostrings.js"); const random = new randoStrings(); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Command { constructor(...args) { super(...args, { @@ -280,9 +281,9 @@ module.exports = class extends Command { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch((e) => { - console.log(e); - }); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch((e) => { + console.log(e); + }); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/commands/owner/maintenance.js b/src/commands/owner/maintenance.js index d3969dd..0c790a9 100644 --- a/src/commands/owner/maintenance.js +++ b/src/commands/owner/maintenance.js @@ -3,11 +3,9 @@ const Maintenance = require("../../database/schemas/maintenance"); module.exports = class extends Command { constructor(...args) { super(...args, { - name: "maintenance", - aliases: ["maintenance"], + name: "maintenancemode", description: "Sets the bot to maintenance", category: "Owner", - ownerOnly: true, }); } diff --git a/src/events/channels/channelCreate.js b/src/events/channels/channelCreate.js index 37fb4d8..2ac7deb 100644 --- a/src/events/channels/channelCreate.js +++ b/src/events/channels/channelCreate.js @@ -1,13 +1,14 @@ const Event = require("../../structures/Event"); const Logging = require("../../database/schemas/logging"); const discord = require("discord.js"); +const send = require("../../packages/logs/index.js"); const cooldown = new Set(); const Maintenance = require("../../database/schemas/maintenance"); module.exports = class extends Event { - async run(message, channel) { - if (!message || !channel) return; + async run(message) { + if (!message) return; const logging = await Logging.findOne({ guildId: message.guild.id }); @@ -52,11 +53,7 @@ module.exports = class extends Event { .permissionsFor(message.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); - cooldown.add(message.guild.id); - setTimeout(() => { - cooldown.delete(message.guild.id); - }, 3000); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } else { const embed = new discord.MessageEmbed() diff --git a/src/events/channels/channelDelete.js b/src/events/channels/channelDelete.js index cfde7ad..1bbd661 100644 --- a/src/events/channels/channelDelete.js +++ b/src/events/channels/channelDelete.js @@ -1,6 +1,7 @@ const Event = require("../../structures/Event"); const Logging = require("../../database/schemas/logging"); const discord = require("discord.js"); +const send = require("../../packages/logs/index.js"); const cooldown = new Set(); const Maintenance = require("../../database/schemas/maintenance"); @@ -44,11 +45,7 @@ module.exports = class extends Event { .permissionsFor(message.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); - cooldown.add(message.guild.id); - setTimeout(() => { - cooldown.delete(message.guild.id); - }, 3000); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/channels/channelUpdate.js b/src/events/channels/channelUpdate.js index 30ad7d1..0d36f6f 100644 --- a/src/events/channels/channelUpdate.js +++ b/src/events/channels/channelUpdate.js @@ -2,6 +2,7 @@ const Event = require("../../structures/Event"); const Logging = require("../../database/schemas/logging"); const discord = require("discord.js"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index.js"); const cooldown = new Set(); module.exports = class extends Event { @@ -104,11 +105,7 @@ module.exports = class extends Event { .permissionsFor(newChannel.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); - cooldown.add(newChannel.guild.id); - setTimeout(() => { - cooldown.delete(newChannel.guild.id); - }, 3000); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/emojis/emojiCreate.js b/src/events/emojis/emojiCreate.js index 43915f5..ed38312 100644 --- a/src/events/emojis/emojiCreate.js +++ b/src/events/emojis/emojiCreate.js @@ -2,6 +2,7 @@ const Event = require("../../structures/Event"); const Logging = require("../../database/schemas/logging"); const discord = require("discord.js"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index"); module.exports = class extends Event { async run(emoji) { @@ -40,7 +41,7 @@ module.exports = class extends Event { .permissionsFor(emoji.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/emojis/emojiDelete.js b/src/events/emojis/emojiDelete.js index 85fa1b9..ef714b6 100644 --- a/src/events/emojis/emojiDelete.js +++ b/src/events/emojis/emojiDelete.js @@ -2,6 +2,7 @@ const Event = require("../../structures/Event"); const Logging = require("../../database/schemas/logging"); const discord = require("discord.js"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index"); module.exports = class extends Event { async run(emoji) { const maintenance = await Maintenance.findOne({ @@ -38,7 +39,7 @@ module.exports = class extends Event { .permissionsFor(emoji.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/emojis/emojiUpdate.js b/src/events/emojis/emojiUpdate.js index b08e205..781f1e8 100644 --- a/src/events/emojis/emojiUpdate.js +++ b/src/events/emojis/emojiUpdate.js @@ -2,6 +2,7 @@ const Event = require("../../structures/Event"); const Logging = require("../../database/schemas/logging"); const discord = require("discord.js"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index"); module.exports = class extends Event { async run(oldEmoji, newEmoji) { const logging = await Logging.findOne({ guildId: newEmoji.guild.id }); @@ -47,7 +48,7 @@ module.exports = class extends Event { .permissionsFor(newEmoji.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/errors/commandError.js b/src/events/errors/commandError.js index 3b491bb..efcfce0 100644 --- a/src/events/errors/commandError.js +++ b/src/events/errors/commandError.js @@ -16,7 +16,7 @@ module.exports = class extends Event { ) { message.channel .sendCustom( - `${message.client.emoji.fail} Hey pogger! An Error just occured, make sure to report it here ${config.discord}!` + `${message.client.emoji.fail} Hey pogger! An error just occured, make sure to report it here! ${config.discord}` ) .catch(() => {}); } diff --git a/src/events/guild/guildUpdate.js b/src/events/guild/guildUpdate.js index 4658433..8ca95f8 100644 --- a/src/events/guild/guildUpdate.js +++ b/src/events/guild/guildUpdate.js @@ -2,6 +2,7 @@ const Event = require("../../structures/Event"); const Logging = require("../../database/schemas/logging"); const discord = require("discord.js"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index"); module.exports = class extends Event { async run(oldGuild, newGuild) { const maintenance = await Maintenance.findOne({ @@ -108,7 +109,7 @@ module.exports = class extends Event { .permissionsFor(newGuild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/members/guildMemberAdd.js b/src/events/members/guildMemberAdd.js index e7fe26f..3037936 100644 --- a/src/events/members/guildMemberAdd.js +++ b/src/events/members/guildMemberAdd.js @@ -8,6 +8,7 @@ const alt = require("../../database/models/altdetector.js"); const StickyDB = require("../../database/schemas/stickyRole"); const Logging = require("../../database/schemas/logging"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Event { async run(member) { @@ -70,7 +71,7 @@ module.exports = class extends Event { .permissionsFor(member.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } @@ -121,7 +122,7 @@ module.exports = class extends Event { member.user.createdAt ).format("MMMM Do YYYY, h:mm:ss a")}` ); - altLog.send({ embeds: [embedAlt] }).catch(() => {}); + send(altLog, { username: `${this.client.user.username}`, embeds: [embedAlt] }).catch(() => {}); } } } diff --git a/src/events/members/guildMemberRemove.js b/src/events/members/guildMemberRemove.js index f1e7c58..69a40c8 100644 --- a/src/events/members/guildMemberRemove.js +++ b/src/events/members/guildMemberRemove.js @@ -6,6 +6,7 @@ const LeaveDB = require("../../database/schemas/leave"); const StickyDB = require("../../database/schemas/stickyRole"); const Logging = require("../../database/schemas/logging"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index"); module.exports = class extends Event { async run(member) { const logging = await Logging.findOne({ guildId: member.guild.id }); @@ -41,7 +42,7 @@ module.exports = class extends Event { ) .setTimestamp() .setColor(member.guild.me.displayHexColor); - channelEmbed.send({ embeds: [embed] }).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/members/guildMemberUpdate.js b/src/events/members/guildMemberUpdate.js index 26989bd..485b060 100644 --- a/src/events/members/guildMemberUpdate.js +++ b/src/events/members/guildMemberUpdate.js @@ -3,7 +3,7 @@ const Nickname = require("../../database/schemas/nicknames"); const discord = require("discord.js"); const Logging = require("../../database/schemas/logging"); const Maintenance = require("../../database/schemas/maintenance"); -const cooldown = new Set(); +const send = require("../../packages/logs/index"); module.exports = class extends Event { async run(oldMember, newMember) { @@ -52,11 +52,7 @@ module.exports = class extends Event { .permissionsFor(newMember.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [roleAddembed] }).catch(() => {}); - cooldown.add(newMember.guild.id); - setTimeout(() => { - cooldown.delete(newMember.guild.id); - }, 3000); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [roleAddembed] }).catch(() => {}); } } @@ -80,11 +76,7 @@ module.exports = class extends Event { .permissionsFor(newMember.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({embeds: [roleRemoveembed]}).catch(() => {}); - cooldown.add(newMember.guild.id); - setTimeout(() => { - cooldown.delete(newMember.guild.id); - }, 3000); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [roleRemoveembed] }).catch(() => {}); } } } @@ -117,11 +109,7 @@ module.exports = class extends Event { .permissionsFor(newMember.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [nicknameEmbed] }).catch(() => {}); - cooldown.add(newMember.guild.id); - setTimeout(() => { - cooldown.delete(newMember.guild.id); - }, 3000); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [nicknameEmbed] }).catch(() => {}); } } } diff --git a/src/events/message/messageCreate.js b/src/events/message/messageCreate.js index 55aa6e6..ea1e619 100644 --- a/src/events/message/messageCreate.js +++ b/src/events/message/messageCreate.js @@ -73,13 +73,13 @@ module.exports = class extends Event { settings.prefix || "!" }help ]\`\`\``; const embed = new MessageEmbed() - .setTitle("Hello, I'm Pogy. What's Up?") + .setTitle(`Hello, I'm ${config.botName}. What's Up?`) .addField(`Prefix`, proofita, true) .addField(`Usage`, proofitaa, true) .setDescription( - `\nIf you like Pogy, Consider [voting](https://top.gg/bot/767705905235099658), or [inviting](${config.invite_link}) it to your server! Thank you for using Pogy, we hope you enjoy it, as we always look forward to improve the bot`, + `\nIf you like ${config.botName}, Consider [voting](https://top.gg/bot/767705905235099658), or [inviting](${config.invite_link}) it to your server! Thank you for using Pogy, we hope you enjoy it, as we always look forward to improve the bot`, ) - .setFooter("Thank you for using Pogy!!") + .setFooter(`Thank you for using ${config.botName}!!`) .setColor("#FF2C98"); message.channel.sendCustom(embed); } @@ -117,7 +117,7 @@ module.exports = class extends Event { // maintenance mode - if (!this.client.config.developers.includes(message.author.id)) { + if (!this.client.config.developers.includes(message.author.id) && !this.client.config.owner.includes(message.author.id)) { if (maintenance && maintenance.toggle == "true") { if (maintenanceCooldown.has(message.author.id)) return; diff --git a/src/events/message/messageDelete.js b/src/events/message/messageDelete.js index ecd1d60..dbf0029 100644 --- a/src/events/message/messageDelete.js +++ b/src/events/message/messageDelete.js @@ -6,6 +6,7 @@ const reactionTicket = require("../../database/models/tickets.js"); const Logging = require("../../database/schemas/logging"); const Snipe = require("../../database/schemas/snipe"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index.js"); module.exports = class extends Event { async run(message) { if (!message.guild) return; @@ -150,7 +151,7 @@ module.exports = class extends Event { .permissionsFor(message.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/message/messageDeleteBulk.js b/src/events/message/messageDeleteBulk.js index e199a8f..3c94ce8 100644 --- a/src/events/message/messageDeleteBulk.js +++ b/src/events/message/messageDeleteBulk.js @@ -3,6 +3,7 @@ const { MessageEmbed } = require("discord.js"); require("moment-duration-format"); const Logging = require("../../database/schemas/logging"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index"); module.exports = class extends Event { async run(messages) { @@ -46,7 +47,7 @@ module.exports = class extends Event { .permissionsFor(message.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/message/messageUpdate.js b/src/events/message/messageUpdate.js index c7a9ca6..958476f 100644 --- a/src/events/message/messageUpdate.js +++ b/src/events/message/messageUpdate.js @@ -4,6 +4,7 @@ require("moment-duration-format"); const Logging = require("../../database/schemas/logging"); const Snipe = require("../../database/schemas/editsnipe"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index"); module.exports = class extends Event { async run(oldMessage, newMessage) { @@ -132,7 +133,7 @@ module.exports = class extends Event { .permissionsFor(newMessage.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/roles/roleCreate.js b/src/events/roles/roleCreate.js index 326be26..3b3959b 100644 --- a/src/events/roles/roleCreate.js +++ b/src/events/roles/roleCreate.js @@ -2,6 +2,7 @@ const Event = require("../../structures/Event"); const Logging = require("../../database/schemas/logging"); const discord = require("discord.js"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index"); module.exports = class extends Event { async run(role) { @@ -42,7 +43,7 @@ module.exports = class extends Event { .permissionsFor(role.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({ embeds: [embed] }).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/roles/roleDelete.js b/src/events/roles/roleDelete.js index 263a3e6..7b1f65d 100644 --- a/src/events/roles/roleDelete.js +++ b/src/events/roles/roleDelete.js @@ -2,6 +2,7 @@ const Event = require("../../structures/Event"); const Logging = require("../../database/schemas/logging"); const discord = require("discord.js"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index"); module.exports = class extends Event { async run(role) { @@ -40,7 +41,7 @@ module.exports = class extends Event { .permissionsFor(role.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({embeds: [embed]}).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/events/roles/roleUpdate.js b/src/events/roles/roleUpdate.js index bacf7da..937aebc 100644 --- a/src/events/roles/roleUpdate.js +++ b/src/events/roles/roleUpdate.js @@ -2,6 +2,7 @@ const Event = require("../../structures/Event"); const Logging = require("../../database/schemas/logging"); const discord = require("discord.js"); const Maintenance = require("../../database/schemas/maintenance"); +const send = require("../../packages/logs/index"); function makehex(rgb) { var hex = Number(rgb).toString(16); @@ -74,7 +75,7 @@ module.exports = class extends Event { .permissionsFor(newRole.guild.me) .has(["SEND_MESSAGES", "EMBED_LINKS"]) ) { - channelEmbed.send({embeds: [embed]}).catch(() => {}); + send(channelEmbed, { username: `${this.client.user.username}`, embeds: [embed] }).catch(() => {}); } } } diff --git a/src/slashCommands/moderation/ban.js b/src/slashCommands/moderation/ban.js index f3e9bcd..eb565b6 100644 --- a/src/slashCommands/moderation/ban.js +++ b/src/slashCommands/moderation/ban.js @@ -2,6 +2,7 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); const { MessageEmbed } = require("discord.js"); const ms = require("ms"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = { data: new SlashCommandBuilder() @@ -162,9 +163,7 @@ module.exports = { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch((e) => { - console.log(e); - }); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch(() => {}); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => { }); diff --git a/src/slashCommands/moderation/clear.js b/src/slashCommands/moderation/clear.js index 9c7285f..9d400b1 100644 --- a/src/slashCommands/moderation/clear.js +++ b/src/slashCommands/moderation/clear.js @@ -2,6 +2,7 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); const { MessageEmbed } = require("discord.js"); const Logging = require("../../database/schemas/logging.js"); const logger = require("../../utils/logger.js"); +const send = require("../../packages/logs/index.js"); module.exports = { data: new SlashCommandBuilder() @@ -151,7 +152,7 @@ module.exports = { }) .setColor(color); - loggingChannel.send({ embeds: [logEmbed] }).catch(() => {}); + send(loggingChannel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch(() => {}); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => {}); diff --git a/src/slashCommands/moderation/kick.js b/src/slashCommands/moderation/kick.js index fa664cc..cb34a92 100644 --- a/src/slashCommands/moderation/kick.js +++ b/src/slashCommands/moderation/kick.js @@ -2,6 +2,8 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); const { MessageEmbed } = require("discord.js"); const ms = require("ms"); const Logging = require("../../database/schemas/logging.js"); +const Guild = require("../../database/schemas/Guild.js"); +const send = require("../../packages/logs/index.js"); module.exports = { data: new SlashCommandBuilder() @@ -24,6 +26,12 @@ module.exports = { const logging = await Logging.findOne({ guildId: interaction.guild.id, }); + + const guildDB = await Guild.findOne({ + guildId: interaction.guild.id, + }); + + const language = require(`../../data/language/${guildDB.language}.json`) if (!interaction.member.permissions.has("KICK_MEMBERS")) return interaction.followUp({ content: "You do not have permission to use this command.", @@ -146,12 +154,12 @@ module.exports = { ) { if (logging.moderation.kick == "true") { let color = logging.moderation.color; - if (color == "#000000") color = message.client.color.red; + if (color == "#000000") color = interaction.client.color.red; let logcase = logging.moderation.caseN; if (!logcase) logcase = `1`; - let reason = args.slice(1).join(" "); + let reason = interaction.options.getString("reason"); if (!reason) reason = `${language.noReasonProvided}`; if (reason.length > 1024) reason = reason.slice(0, 1021) + "..."; @@ -168,7 +176,7 @@ module.exports = { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch(() => { }); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch(() => {}); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => { }); diff --git a/src/slashCommands/moderation/lock.js b/src/slashCommands/moderation/lock.js index ee6021a..0dc0d45 100644 --- a/src/slashCommands/moderation/lock.js +++ b/src/slashCommands/moderation/lock.js @@ -2,6 +2,7 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); const { MessageEmbed } = require("discord.js"); const Guild = require("../../database/schemas/Guild.js"); const Logging = require("../../database/schemas/logging.js"); +const send = require("../../packages/logs/index.js"); module.exports = { data: new SlashCommandBuilder() @@ -107,7 +108,7 @@ module.exports = { let logcase = logging.moderation.caseN; if (!logcase) logcase = `1`; - let reason = args.slice(1).join(" "); + let reason = interaction.options.getString("reason"); if (!reason) reason = `${language.noReasonProvided}`; if (reason.length > 1024) reason = reason.slice(0, 1021) + "..."; @@ -124,7 +125,7 @@ module.exports = { .setTimestamp() .setColor(color); - channel.send({ embeds: [logEmbed] }).catch(() => { }); + send(channel, { username: `${this.client.user.username}`, embeds: [logEmbed] }).catch(() => {}); logging.moderation.caseN = logcase + 1; await logging.save().catch(() => { }); diff --git a/src/slashCommands/moderation/removewarn.js b/src/slashCommands/moderation/removewarn.js index 7fd3d8b..cc1507b 100644 --- a/src/slashCommands/moderation/removewarn.js +++ b/src/slashCommands/moderation/removewarn.js @@ -3,6 +3,7 @@ const { MessageEmbed } = require("discord.js"); const warnModel = require("../../database/models/moderation"); const Logging = require("../../database/schemas/logging.js"); const Guild = require("../../database/schemas/Guild.js"); +const send = require("../../packages/logs/index.js"); module.exports = { data: new SlashCommandBuilder() diff --git a/src/slashCommands/moderation/softban.js b/src/slashCommands/moderation/softban.js index ccc067c..53bf7f4 100644 --- a/src/slashCommands/moderation/softban.js +++ b/src/slashCommands/moderation/softban.js @@ -30,7 +30,7 @@ module.exports = { const language = require(`../../data/language/${guildDB.language}.json`); const member = interaction.options.getMember("member"); - const reason = + let reason = interaction.options.getString("reason") || "No Reason Provided"; if (!interaction.member.permissions.has("BAN_MEMBERS"))