From b8c2b6766bde7a018915b37a0036cad88cd7faa8 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Thu, 14 Sep 2023 23:16:49 -0600 Subject: [PATCH] utility.linvite: guild feature icons --- src/modules/utility.js | 144 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 128 insertions(+), 16 deletions(-) diff --git a/src/modules/utility.js b/src/modules/utility.js index c3fe7f5..52ddec1 100644 --- a/src/modules/utility.js +++ b/src/modules/utility.js @@ -84,7 +84,7 @@ const PRESENCE_TYPES = [ "Streaming", "Listening to", "Watching", - "", + "Custom Status", "Competing in", ]; @@ -143,6 +143,102 @@ const USER_FLAGS = [ "RESTRICTED_COLLABORATOR", ]; +// https://discord-userdoccers.vercel.app/resources/guild#guild-features +const GUILD_FEATURES = { + ACTIVITIES_ALPHA: {icon: "\u{1f680}"}, + ACTIVITIES_EMPLOYEE: {icon: "\u{1f680}"}, + ACTIVITIES_INTERNAL_DEV: {icon: "\u{1f680}"}, + ANIMATED_BANNER: {icon: "\u{1f39e}"}, + ANIMATED_ICON: {icon: "\u{1f39e}"}, + APPLICATION_COMMAND_PERMISSIONS_V2: {icon: "\u2699\ufe0f"}, + AUTO_MODERATION: {icon: "\u{1f6e1}"}, + AUTOMOD_TRIGGER_USER_PROFILE: {icon: "\u{1faaa}"}, + BANNER: {icon: "\u{1f5bc}"}, + BFG: {icon: "\u{1f388}", name: "BFG"}, + BOT_DEVELOPER_EARLY_ACCESS: {icon: "\u{1f9ea}"}, + BURST_REACTIONS: {icon: "\u2728", name: "Super Reactions"}, + CHANNEL_ICON_EMOJIS_GENERATED: {icon: "\u{1f603}"}, + CHANNEL_HIGHLIGHTS: {icon: "\u{1f5c3}"}, + CHANNEL_HIGHLIGHTS_DISABLED: {icon: "\u{1f6ab}"}, + CLYDE_DISABLED: {icon: "\u{1f6ab}"}, + CLYDE_ENABLED: {icon: "\u{1f916}"}, + CLYDE_EXPERIMENT_ENABLED: {icon: "\u{1f9ea}"}, + COMMUNITY: {icon: "\u{1f3d8}"}, + COMMUNITY_CANARY: {icon: "\u{1f9ea}"}, + COMMUNITY_EXP_LARGE_GATED: {icon: "\u{1f3d8}"}, + COMMUNITY_EXP_LARGE_UNGATED: {icon: "\u{1f3d8}"}, + COMMUNITY_EXP_MEDIUM: {icon: "\u{1f3d8}"}, + CREATOR_ACCEPTED_NEW_TERMS: {icon: "\u2611\ufe0f"}, + CREATOR_MONETIZABLE: {icon: "\u{1f4b0}"}, + CREATOR_MONETIZABLE_DISABLED: {icon: "\u{1f6ab}"}, + CREATOR_MONETIZABLE_PENDING_NEW_OWNER_ONBOARDING: {icon: "\u{1f4b1}"}, + CREATOR_MONETIZABLE_PROVISIONAL: {icon: "\u{1f4b0}"}, + CREATOR_MONETIZABLE_RESTRICTED: {icon: "\u26d4"}, + CREATOR_MONETIZABLE_WHITEGLOVE: {icon: "\u{1f9ea}"}, + CREATOR_MONETIZATION_APPLICATION_ALLOWLIST: {icon: "\u{1f4dc}"}, + CREATOR_STORE_PAGE: {icon: "\u{1f6d2}"}, + DEVELOPER_SUPPORT_SERVER: {icon: "\u2754"}, + DISCOVERABLE: {icon: "\u{1f9ed}"}, + DISCOVERABLE_DISABLED: {icon: "\u{1f6ab}"}, + ENABLED_DISCOVERABLE_BEFORE: {icon: "\u{1f9ed}"}, + EXPOSED_TO_ACTIVITIES_WTP_EXPERIMENT: {icon: "\u{1f9ea}"}, + GUESTS_ENABLED: {icon: "\u{1f465}"}, + GUILD_HOME_DEPRECATION_OVERRIDE: {icon: "\u{1f3da}"}, + GUILD_HOME_OVERRIDE: {icon: "\u{1f3e0}"}, + GUILD_HOME_TEST: {icon: "\u{1f9ea}"}, + GUILD_MEMBER_VERIFICATION_EXPERIMENT: {icon: "\u{1f9ea}"}, + GUILD_ONBOARDING: {icon: "\u{1f5f3}"}, + GUILD_ONBOARDING_EVER_ENABLED: {icon: "\u{1f5f3}"}, + GUILD_ONBOARDING_HAS_PROMPTS: {icon: "\u{1f5f3}"}, + GUILD_PRODUCTS: {icon: "\u{1f6cd}"}, + GUILD_SERVER_GUIDE: {icon: "\u{1f9ae}"}, + GUILD_WEB_PAGE_VANITY_URL: {icon: "\u{1f4c4}"}, + HAD_EARLY_ACTIVITIES_ACCESS: {icon: "\u{1f680}"}, + HAS_DIRECTORY_ENTRY: {icon: "\u{1faa7}"}, + HIDE_FROM_EXPERIMENT_UI: {icon: "\u{1f9ea}"}, + HUB: {icon: "\u{1f3eb}"}, + INCREASED_THREAD_LIMIT: {icon: "\u{1f9f5}"}, + INTERNAL_EMPLOYEE_ONLY: {icon: "\u{1f6e0}"}, + INVITE_SPLASH: {icon: "\u{1f5bc}"}, + INVITES_DISABLED: {icon: "\u26d4"}, + LINKED_TO_HUB: {icon: "\u{1f3eb}"}, + MEMBER_SAFETY_PAGE_ROLLOUT: {icon: "\u{1f6e1}"}, + MEMBER_VERIFICATION_GATE_ENABLED: {icon: "\u{1f6e1}"}, + MEMBER_VERIFICATION_MANUAL_APPROVAL: {icon: "\u2705"}, + MORE_EMOJI: {icon: "\u{1f603}"}, + MORE_STICKERS: {icon: "\u{1f5bc}"}, + NEWS: {icon: "\u{1f4f0}"}, + NON_COMMUNITY_RAID_ALERTS: {icon: "\u{1f6a8}"}, + PARTNERED: {icon: "\u267e\ufe0f"}, + PREMIUM_TIER_3_OVERRIDE: {icon: "\u{1f48e}"}, + PREVIEW_ENABLED: {icon: "\u{1f441}"}, + PRODUCTS_AVAILABLE_FOR_PURCHASE: {icon: "\u{1f6cd}"}, + RAID_ALERTS_DISABLED: {icon: "\u{1f6ab}"}, + RELAY_ENABLED: {icon: "\u{1f4fb}"}, + ROLE_ICONS: {icon: "\u{1f3f7}"}, + ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE: {icon: "\u{1f4b3}"}, + ROLE_SUBSCRIPTIONS_ENABLED: {icon: "\u{1f4b3}"}, + SHARD: {icon: "\u{1f4a0}"}, + SHARED_CANVAS_FRIENDS_AND_FAMILY_TEST: {icon: "\u{1f58c}"}, + SOUNDBOARD: {icon: "\u{1f50a}"}, + SUMMARIES_ENABLED: {icon: "\u{1f4da}"}, + SUMMARIES_ENABLED_GA: { + icon: "\u{1f4da}", + name: "Summaries Enabled (General Access)", + }, + SUMMARIES_DISABLED_BY_USER: {icon: "\u26d4"}, + SUMMARIES_ENABLED_BY_USER: {icon: "\u{1f4da}"}, + SUMMARIES_LONG_LOOKBACK: {icon: "\u{1f5c2}"}, + STAFF_LEVEL_COLLABORATOR_REQUIRED: {icon: "\u{1f6e0}"}, + STAFF_LEVEL_RESTRICTED_COLLABORATOR_REQUIRED: {icon: "\u{1f6e0}"}, + THREAD_DEFAULT_AUTO_ARCHIVE_DURATION: {icon: "\u{1f9f5}"}, + VANITY_URL: {icon: "\u{1f517}"}, + VERIFIED: {icon: "\u2b50"}, + VIP_REGIONS: {icon: "\u{1f399}"}, + VOICE_IN_THREADS: {icon: "\u{1f399}"}, + WELCOME_SCREEN_ENABLED: {icon: "\u{1f44b}"}, +}; + const EMOJI_SETS = { blobs: { prefix: @@ -455,6 +551,19 @@ lookupinvite.callback = async function (msg, line) { } : null; + const features = invite.guild.features + .map( + (feature) => + (GUILD_FEATURES[feature]?.icon ?? "\u2753") + + " " + + (GUILD_FEATURES[feature]?.name ?? + feature + .split("_") + .map((x) => x[0] + x.substring(1).toLowerCase()) + .join(" ")) + ) + .join(", "); + if (invite.type == 0) { embed.fields.push( ...[ @@ -468,17 +577,17 @@ lookupinvite.callback = async function (msg, line) { value: `**${invite.channel.name}** (${invite.channel.id})`, inline: true, }, - { - name: "Member Count", - value: `${STATUS_ICONS.online}${invite.approximate_presence_count} online\t\t${STATUS_ICONS.offline}${invite.approximate_member_count} members`, - inline: false, - }, { name: "Boosts", value: invite.guild.premium_subscription_count ?? 0, inline: true, }, expires, + { + name: "Member Count", + value: `${STATUS_ICONS.online}${invite.approximate_presence_count} online\t\t${STATUS_ICONS.offline}${invite.approximate_member_count} members`, + inline: false, + }, inviter, invite.guild.welcome_screen && { name: "Welcome Screen", @@ -499,18 +608,21 @@ lookupinvite.callback = async function (msg, line) { { name: "Features", value: - invite.guild.features.length > 0 - ? invite.guild.features - .map((feature) => - feature - .split("_") - .map((x) => x[0] + x.substring(1).toLowerCase()) - .join(" ") - ) - .join(", ") + features.length > 0 + ? features.slice(0, Math.floor(features.length / 2)) : "None", - inline: false, + inline: true, }, + features.length > 1 + ? { + name: "\u200b", + value: features.slice( + Math.floor(features.length / 2), + features.length + ), + inline: true, + } + : null, ].filter((x) => !!x) ); embed.thumbnail = {