From a22d9aad1e2981fc25d476d7f9d9cd0790078536 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Tue, 13 Aug 2024 21:36:16 -0600 Subject: [PATCH] move to app emotes, add badge emotes, change some feature icons around, remove poll/vote command --- src/modules/misc/poll.js | 50 ------- src/modules/misc/wolfram.js | 3 +- src/modules/utility/flagdump.js | 7 +- src/modules/utility/guildinfo.js | 8 +- src/modules/utility/lookupinvite.js | 2 +- src/util/constants.js | 199 +++++++++++++++++----------- src/util/dconstants.js | 26 ++++ 7 files changed, 158 insertions(+), 137 deletions(-) delete mode 100644 src/modules/misc/poll.js diff --git a/src/modules/misc/poll.js b/src/modules/misc/poll.js deleted file mode 100644 index a2a78c1..0000000 --- a/src/modules/misc/poll.js +++ /dev/null @@ -1,50 +0,0 @@ -const Command = require("@lib/command.js"); - -const {formatUsername} = require("@util/misc.js"); - -const poll = new Command("poll"); -poll.category = "misc"; -poll.helpText = "Start a poll"; -poll.usage = "[topic] [option 1] [option 2] [...option 3-10]"; -poll.callback = async function (msg, line, [topic, ...options]) { - if (!line || !topic) return 'Usage: hf!poll "topic" "option 1" "option 2" "...options 3-10"'; - - const arrOptions = [...options].slice(0, 10); - if (arrOptions.length < 2) return "A minimum of two options are required."; - - const reactions = []; - let displayString = `**${formatUsername(msg.author)}** has started a poll:\n## __${topic}__\n`; - for (let i = 0; i < arrOptions.length; i++) { - displayString += (i === 9 ? "\ud83d\udd1f" : `${i + 1}\u20e3`) + ": " + arrOptions[i] + "\n"; - reactions[i] = i === 9 ? "\ud83d\udd1f" : `${i + 1}\u20e3`; - } - - return { - content: displayString, - addReactions: reactions, - }; -}; -hf.registerCommand(poll); - -const vote = new Command("vote"); -vote.category = "misc"; -vote.helpText = "Start a yes/no vote"; -vote.usage = "[topic]"; -vote.callback = async function (msg, line, topic, {maybe}) { - if (!topic) return "No topic given."; - topic = topic.join(" "); - - return { - content: `**${formatUsername( - msg.author - )}** has started a vote:\n## __${topic}__\n<:ms_tick:503341995348066313>: Yes\n<:ms_cross:503341994974773250>: No${ - maybe ? "\n<:ms_tilda:581268710925271095>: Maybe/Uncertain" : "" - }`, - addReactions: [ - ":ms_tick:503341995348066313", - ":ms_cross:503341994974773250", - maybe && ":ms_tilda:581268710925271095", - ].filter((x) => x != null), - }; -}; -hf.registerCommand(vote); diff --git a/src/modules/misc/wolfram.js b/src/modules/misc/wolfram.js index 6c85d3e..33a7900 100644 --- a/src/modules/misc/wolfram.js +++ b/src/modules/misc/wolfram.js @@ -2,10 +2,11 @@ const Command = require("@lib/command.js"); const InteractionCommand = require("@lib/interactionCommand.js"); const {ApplicationCommandOptionTypes} = require("@util/dconstants.js"); +const {Icons} = require("@util/constants.js"); const {safeString} = require("@util/misc.js"); -const WA_NO_ANSWER = "<:ms_cross:503341994974773250> No answer."; +const WA_NO_ANSWER = `${Icons.silk.cross} No answer.`; const wolfram = new Command("wolfram"); wolfram.category = "misc"; diff --git a/src/modules/utility/flagdump.js b/src/modules/utility/flagdump.js index 845484e..a4d315b 100644 --- a/src/modules/utility/flagdump.js +++ b/src/modules/utility/flagdump.js @@ -21,7 +21,12 @@ flagdump.usage = "[flags or user mention]"; flagdump.callback = async function (msg, line, [numOrMention], {id, list}) { if (!line || line == "") numOrMention = `<@${msg.author.id}>`; - const num = BigInt(numOrMention); + let num; + try { + num = BigInt(numOrMention); + } catch { + // noop + } let out = ""; if (list) { let allFlags = 0n; diff --git a/src/modules/utility/guildinfo.js b/src/modules/utility/guildinfo.js index 81f11dd..9b557a9 100644 --- a/src/modules/utility/guildinfo.js +++ b/src/modules/utility/guildinfo.js @@ -329,7 +329,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { const verfifiedBots = members.filter((member) => member.bot && (member.user.publicFlags & 65536) != 0).length; embed.fields.push({ name: "Member Count", - value: `${Icons.online}${online} online${Icons.blank}${Icons.blank}${Icons.offline}${guild.memberCount} members\n${Icons.silk.cog} ${bots}${Icons.blank}${Icons.silk.tick} ${verfifiedBots}`, + value: `${Icons.online}${online} online\u3000\u3000${Icons.offline}${guild.memberCount} members\n${Icons.silk.cog} ${bots}\u3000\u3000${Icons.silk.tick} ${verfifiedBots}`, inline: false, }); @@ -421,7 +421,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { embed.fields.push({ name: "Member Count", - value: `${Icons.online}${guild.approximate_presence_count} online${Icons.blank}${Icons.blank}${Icons.offline}${guild.approximate_member_count} members`, + value: `${Icons.online}${guild.approximate_presence_count} online\u3000\u3000${Icons.offline}${guild.approximate_member_count} members`, inline: false, }); @@ -516,7 +516,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { embed.fields.push({ name: "Member Count", - value: `${Icons.online}${guildObj.approximate_presence_count} online\t\t<:offline:1152111682886316042>${guildObj.approximate_member_count} members`, + value: `${Icons.online}${guildObj.approximate_presence_count} online\t\t${Icons.offline}${guildObj.approximate_member_count} members`, inline: false, }); @@ -597,7 +597,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { embed.fields.push({ name: "Member Count", - value: `<:online:1152111668856361010>${invite.approximate_presence_count} online\t\t<:offline:1152111682886316042>${invite.approximate_member_count} members`, + value: `${Icons.online}${invite.approximate_presence_count} online\t\t${Icons.offline}${invite.approximate_member_count} members`, inline: false, }); diff --git a/src/modules/utility/lookupinvite.js b/src/modules/utility/lookupinvite.js index ed326d9..6621da7 100644 --- a/src/modules/utility/lookupinvite.js +++ b/src/modules/utility/lookupinvite.js @@ -179,7 +179,7 @@ lookupinvite.callback = async function (msg, line) { }, { name: "Member Count", - value: `<:offline:1152111682886316042>${invite.approximate_member_count} members`, + value: `${Icons.offline}${invite.approximate_member_count} members`, inline: true, }, expires, diff --git a/src/util/constants.js b/src/util/constants.js index 901354a..113989f 100644 --- a/src/util/constants.js +++ b/src/util/constants.js @@ -2,64 +2,71 @@ module.exports = {}; const SILK_ICONS = Object.fromEntries( Object.entries({ - joystick: "1250544500246577172", - film: "1250544523730223277", - shield: "1250543253472673875", - vcard: "1250544496765308948", - photo: "1250543277267222639", - world_add: "1250544495435452547", - ruby: "1250544494739325001", - emoticon_smile: "1250543500471046288", - bug: "1250544574104080507", - comments_star: "1250544493841616988", - comments_delete: "1250544492709412946", - flag_blue: "1250544491471831131", - flag_red: "1250544490507141312", - controller: "1250544489156710541", - cog_delete: "1250544595666997288", - cog: "1250543252747321468", - basket: "1250544573088923722", - group: "1250543273726967900", - check_checked_green: "1250544572203929815", - world: "1250543499489706195", - world_delete: "1250544571180515408", - transmit_blue: "1250544569448136857", - comments: "1250543256052301924", - status_away: "1250544568772853801", - page_link: "1250544567665561631", - book_open_mark: "1250544632064901240", - house: "1250543270342426644", - lock: "1250543498470359121", - sitemap: "1250544630907535361", - eye: "1250544630043381872", - link: "1250543266806628412", - time: "1250544629053522030", - delete: "1250543248909406248", - money: "1250544627665211404", - money_delete: "1250544627178803313", - emoticon_smile_add: "1250544626054594560", - image_add: "1250544625068806215", - newspaper: "1250543497010872485", - bell: "1250544670178803722", - application_view_tile: "1250544666080837703", - star: "1250543254869381170", - compress: "1250544665091113080", - bell_delete: "1250544686121095289", - stop: "1250544664000467056", - creditcards: "1250544663014936798", - tag_blue: "1250543263656574996", - calendar: "1250543496255897660", - book_go: "1250544662037528717", - palette: "1250544661035225189", - sound: "1250543260196147323", - key: "1250543495286882375", - book_tabs: "1250544659940380672", - book_tabs_delete: "1250555962364919808", - wand: "1250544659038601266", - tick: "1250543251375653007", - microphone: "1250543257398542436", - user_add: "1250544566503739412", - controller_delete: "1262137043417563256", + application_view_tile: "1273119065329631294", + basket: "1273119074947174430", + bell: "1273119087664304169", + bell_delete: "1273119098775146628", + book_tabs: "1273119114017378314", + book_tabs_delete: "1273119122669961339", + bookmark: "1273119132719644733", + bookmark_delete: "1273119141078896722", + bug: "1273119149425561632", + calendar: "1273119158803894363", + chart_organisation: "1273119178550935552", + check_checked_green: "1273119189141422140", + cog: "1273119202395291760", + cog_delete: "1273119211220238407", + comment: "1273119233487929405", + comments: "1273119243805921323", + compass: "1273119254954250302", + compress: "1273119265876217907", + controller: "1273119275724570654", + controller_delete: "1273119284125630585", + creditcards: "1273119294225649694", + cross: "1273119303972946001", + delete: "1273119315159289896", + emoticon_smile: "1273119327901454336", + emoticon_smile_add: "1273119339570139157", + error: "1273119353000165460", + eye: "1273119369261486121", + film: "1273119412693631010", + flag_blue: "1273119425675132999", + flag_red: "1273119438635536385", + group: "1273119451780354139", + house: "1273119469987696754", + image_add: "1273119484474818570", + joystick: "1273119500627349534", + key: "1273119517353967616", + link: "1273119531916853269", + lock: "1273119546068176956", + magnifier: "1273119565349392444", + microphone: "1273119582785372160", + money: "1273119599033843836", + money_delete: "1273119611122094170", + newspaper: "1273119623633436785", + outline: "1273119642084315308", + page_link: "1273119659205595207", + palette: "1273119683075244052", + photo: "1273119700103991328", + ruby: "1273119720756740106", + shield: "1273119737043222589", + snowflake: "1268434236839559219", + sound: "1273119755376529418", + star: "1273119776415289377", + status_away: "1273119793733701715", + stop: "1273119816181350461", + tag_blue: "1273119832711237663", + tick: "1273119852168740884", + time: "1273119868031467662", + transmit_blue: "1273119883202269225", + user_add: "1273119924675416064", + vcard: "1273119947341561856", + wand: "1273119971442036746", + world: "1273119983907639338", + world_add: "1273119996305997844", + world_delete: "1273120009593425940", + world_link: "1273122514675044457", + world_night_magnify: "1273120024189734943", }).map(([key, val]) => [key, `<:i:${val}>`]) ); @@ -120,8 +127,8 @@ module.exports.GuildFeaturesFormatted = { icon: SILK_ICONS.emoticon_smile, name: "Channel Icon Emojis", }, - CHANNEL_HIGHLIGHTS: {icon: SILK_ICONS.comments_star}, - CHANNEL_HIGHLIGHTS_DISABLED: {icon: SILK_ICONS.comments_delete}, + CHANNEL_HIGHLIGHTS: {icon: SILK_ICONS.bookmark}, + CHANNEL_HIGHLIGHTS_DISABLED: {icon: SILK_ICONS.bookmark_delete}, CLAN: {icon: SILK_ICONS.flag_blue}, CLAN_DISCOVERY_DISABLED: {icon: SILK_ICONS.flag_red}, CLAN_PILOT_GENSHIN: { @@ -185,7 +192,7 @@ module.exports.GuildFeaturesFormatted = { DEVELOPER_SUPPORT_SERVER: {icon: SILK_ICONS.cog}, DISCOVERABLE: {icon: SILK_ICONS.world}, DISCOVERABLE_DISABLED: {icon: SILK_ICONS.world_delete}, - ENABLED_DISCOVERABLE_BEFORE: {icon: SILK_ICONS.world}, + ENABLED_DISCOVERABLE_BEFORE: {icon: SILK_ICONS.world_night_magnify}, EXPOSED_TO_ACTIVITIES_WTP_EXPERIMENT: { icon: SILK_ICONS.bug, name: "Activities: WTP Experiment", @@ -258,7 +265,7 @@ module.exports.GuildFeaturesFormatted = { name: "Role Subscriptions: Trials", deprecated: true, }, - GUILD_SERVER_GUIDE: {icon: SILK_ICONS.book_go, name: "Server Guide"}, + GUILD_SERVER_GUIDE: {icon: SILK_ICONS.compass, name: "Server Guide"}, GUILD_WEB_PAGE_VANITY_URL: { icon: SILK_ICONS.page_link, name: "Guild Web Page Vanity URL", @@ -267,12 +274,12 @@ module.exports.GuildFeaturesFormatted = { icon: SILK_ICONS.joystick, name: "Activities: Had Early Access", }, - HAS_DIRECTORY_ENTRY: {icon: SILK_ICONS.book_open_mark}, + HAS_DIRECTORY_ENTRY: {icon: SILK_ICONS.magnifier}, HIDE_FROM_EXPERIMENT_UI: { icon: SILK_ICONS.bug, name: "Hidden from Experiment UI", }, - HUB: {icon: SILK_ICONS.sitemap, name: "Student Hub"}, + HUB: {icon: SILK_ICONS.chart_organisation, name: "Student Hub"}, INCREASED_THREAD_LIMIT: { icon: SILK_ICONS.comments, name: "Threads: Increased Limit", @@ -405,7 +412,7 @@ module.exports.GuildFeaturesFormatted = { deprecated: true, }, VALORANT_L30: {icon: SILK_ICONS.controller, name: "Clans: Valorant L30"}, - VANITY_URL: {icon: SILK_ICONS.link, name: "Vanity URL"}, + VANITY_URL: {icon: SILK_ICONS.world_link, name: "Vanity URL"}, VERIFIED: {icon: SILK_ICONS.tick}, VIP_REGIONS: {icon: SILK_ICONS.microphone, name: "VIP Voice Regions"}, VOICE_CHANNEL_EFFECTS: {icon: SILK_ICONS.wand, deprecated: true}, @@ -418,24 +425,24 @@ module.exports.GuildFeaturesFormatted = { const PRESENCE_ICONS = { desktop: { - online: "<:i:1028887024670871552>", - idle: "<:i:1028887022938624033>", - dnd: "<:i:1028887021848121364>", + online: "<:i:1263597847744352397>", + idle: "<:i:1263597864089555037>", + dnd: "<:i:1263597872268705802>", }, mobile: { - online: "<:i:1028887017637036043>", - idle: "<:i:1028887019226669116>", - dnd: "<:i:1028887020560449637>", + online: "<:i:1263597896549400647>", + idle: "<:i:1263597887518937160>", + dnd: "<:i:1263597880556654672>", }, web: { - online: "<:i:1104972136730345552>", - idle: "<:i:1104972138735218729>", - dnd: "<:i:1104972140685570150>", + online: "<:i:1263597918841999361>", + idle: "<:i:1263597912571645983>", + dnd: "<:i:1263597905776742470>", }, embedded: { - online: "<:i:1104972131265167411>", - idle: "<:i:1104972132687024189>", - dnd: "<:i:1104972134964543518>", + online: "<:i:1263597941051101186>", + idle: "<:i:1263597934252134462>", + dnd: "<:i:1263597927310299208>", }, }; const OS_ICONS = { @@ -444,13 +451,45 @@ const OS_ICONS = { linux: "\u{1f427}", }; +const BADGE_ICONS = { + staff: "<:Staff:1273105535708696656>", + partner: "<:Partner:1273105523973165078>", + certified_moderator_old: "<:CertifiedModerator:1273105504259932281>", + certified_moderator: "<:ModeratorAlumni:1273105513818624031>", + hypesquad: "<:HypesquadEvents:1273105667254910976>", + hypesquad_house_1: "<:HypesquadBravery:1273105648384479253>", + hypesquad_house_2: "<:HypesquadBrilliance:1273105657771462727>", + hypesquad_house_3: "<:HypesquadBalance:1273105639358599222>", + bug_hunter_level_1: "<:BugHunterLevel1:1273105482898472980>", + bug_hunter_level_2: "<:BugHunterLevel2:1273105492381667328>", + active_developer: "<:ActiveBotDeveloper:1273105474174058558>", + verified_developer: "<:EarlyVerifiedBotDeveloper:1273105594542194762>", + early_supporter: "<:EarlySupporter:1273105584765407289>", + premium: "<:Nitro:1273105677107335178>", + guild_booster_lvl1: "<:BoostLevel1:1273107923693731850>", + guild_booster_lvl2: "<:BoostLevel2:1273107931575095377>", + guild_booster_lvl3: "<:BoostLevel3:1273107940177346610>", + guild_booster_lvl4: "<:BoostLevel4:1273107949358813288>", + guild_booster_lvl5: "<:BoostLevel5:1273107958909243483>", + guild_booster_lvl6: "<:BoostLevel6:1273107966865965056>", + guild_booster_lvl7: "<:BoostLevel7:1273107976722452510>", + guild_booster_lvl8: "<:BoostLevel8:1273107984611934322>", + guild_booster_lvl9: "<:BoostLevel9:1273107994543919105>", + bot_commands: "<:HasSlashCommands:1273108807798755400>", + automod: "<:UsesAutoMod:1273105734862770221>", + application_guild_subscription: "<:HasPremium:1273105604067721258>", + legacy_username: "<:PreviouslyKnownAs:1273105685760049297>", + quest_completed: "<:CompletedAQuest:1273105700645502987>", +}; + module.exports.Icons = { silk: SILK_ICONS, presence: PRESENCE_ICONS, os: OS_ICONS, - online: "<:i:1152111668856361010>", - offline: "<:i:1152111682886316042>", - blank: "<:i:1250561747476152460>", + badges: BADGE_ICONS, + online: "<:i:1273105436807139438>", + offline: "<:i:1273105449318875228>", + boat: "<:i:1273105457661087755>", }; module.exports.ChannelTypeNames = { diff --git a/src/util/dconstants.js b/src/util/dconstants.js index 1f3bd21..57d7888 100644 --- a/src/util/dconstants.js +++ b/src/util/dconstants.js @@ -66,6 +66,32 @@ module.exports.ApplicationFlags.SOCIAL_LAYER_INTEGRATION = 1 << 27; // module.exports.ApplicationTypes = ["Normal", "Game", "Music", "Ticketed Event", "Creator Monetization"]; +module.exports.BadgeURLs = { + staff: "https://discord.com/company", + partner: "https://discord.com/partners", + certified_moderator: "https://discord.com/safety", + hypesquad: "https://discord.com/hypesquad", // dead link but idc, saves characters; new link: https://support.discord.com/hc/en-us/articles/360035962891-Profile-Badges-101#h_01GM67K5EJ16ZHYZQ5MPRW3JT3 + hypesquad_house_1: "https://discord.com/settings/hypesquad-online", + hypesquad_house_2: "https://discord.com/settings/hypesquad-online", + hypesquad_house_3: "https://discord.com/settings/hypesquad-online", + bug_hunter_level_1: "https://support.discord.com/hc/en-us/articles/360046057772-Discord-Bugs", + bug_hunter_level_2: "https://support.discord.com/hc/en-us/articles/360046057772-Discord-Bugs", + active_developer: "https://support-dev.discord.com/hc/en-us/articles/10113997751447?ref=badge", + early_supporter: "https://discord.com/settings/premium", + premium: "https://discord.com/settings/premium", + guild_booster_lvl1: "https://discord.com/settings/premium", + guild_booster_lvl2: "https://discord.com/settings/premium", + guild_booster_lvl3: "https://discord.com/settings/premium", + guild_booster_lvl4: "https://discord.com/settings/premium", + guild_booster_lvl5: "https://discord.com/settings/premium", + guild_booster_lvl6: "https://discord.com/settings/premium", + guild_booster_lvl7: "https://discord.com/settings/premium", + guild_booster_lvl8: "https://discord.com/settings/premium", + guild_booster_lvl9: "https://discord.com/settings/premium", + bot_commands: "https://discord.com/blog/welcome-to-the-new-era-of-discord-apps?ref=badge", + quest_completed: "https://discord.com/settings/inventory", +}; + module.exports.BASE_URL = Endpoints.BASE_URL; const CDNEndpoints = {};