From 83f091b0a636884c040ead4c161639c9539350c4 Mon Sep 17 00:00:00 2001 From: bignutty <3515180-bignutty@users.noreply.gitlab.com> Date: Tue, 28 Jan 2025 04:00:32 +0100 Subject: [PATCH] fix forum channel count --- commands/message/info/guild.js | 10 +++++----- labscore/utils/markdown.js | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/commands/message/info/guild.js b/commands/message/info/guild.js index e143089..d5148ea 100644 --- a/commands/message/info/guild.js +++ b/commands/message/info/guild.js @@ -3,9 +3,9 @@ const { PERMISSION_GROUPS } = require('#constants'); const { createEmbed, page, formatPaginationEmbeds } = require("#utils/embed"); const { guildFeaturesField } = require("#utils/fields"); -const { getAcronym, getGuildIcon } = require('#utils/guilds'); +const { getGuildIcon } = require('#utils/guilds'); const { acknowledge } = require('#utils/interactions'); -const { icon, highlight, timestamp, codeblock, smallIconPill, smallPill } = require("#utils/markdown"); +const { icon, timestamp, codeblock, smallIconPill, smallPill } = require("#utils/markdown"); const { editOrReply } = require("#utils/message"); module.exports = { @@ -32,7 +32,7 @@ module.exports = { const textChannels = channels.filter((channel) => channel.isGuildText).length; const voiceChannels = channels.filter((channel) => channel.isGuildVoice).length; const stageChannels = channels.filter((channel) => channel.isGuildStageVoice).length; - const forumChannels = channels.filter((channel) => channel.isGuildForumChannel).length; + const forumChannels = channels.filter((channel) => channel.isGuildForum).length; const g = context.guild // Guild Card @@ -77,7 +77,7 @@ module.exports = { inline: false }) - if((g.banner || g.splash || g.discoverySplash) != undefined){ + if((g.banner || g.splash || g.discoverySplash) !== undefined){ guildCard.image = { url: (g.bannerUrl || g.splashUrl || g.discoverySplashUrl) + "?size=4096" } @@ -94,7 +94,7 @@ module.exports = { let i = 0; let ic = Math.ceil(featureCards.length / 2); - if(ic == 1) featureCards[0].name = `${icon("list")} Server Features` + if(ic === 1) featureCards[0].name = `${icon("list")} Server Features` while(featureCards.length >= 1){ i++; const sub = featureCards.splice(0, 2) diff --git a/labscore/utils/markdown.js b/labscore/utils/markdown.js index 0801d95..5c8d114 100644 --- a/labscore/utils/markdown.js +++ b/labscore/utils/markdown.js @@ -49,7 +49,13 @@ module.exports.highlight = function(content = ""){ return "`" + content.toString().replace(/\`/g, 'ˋ') + "`" } -module.exports.codeblock = function(type, content = ""){ +/** + * Formats a Markdown Codeblock + * @param type Language Type + * @param {Array} content Lines + * @returns {string} Formatted Codeblock + */ +module.exports.codeblock = function(type, content = []){ if(!content.length) return "```" + type + "```" return "```" + type + "\n" + _escapeCodeblock(content.join('\n')) + "```" }