From 3aafaff5f420d2217140f19b711422d11e52e5eb Mon Sep 17 00:00:00 2001 From: LunaUrsa <1836049+LunaUrsa@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:58:39 -0500 Subject: [PATCH] Hipperooni branch (#688) * many changes Added /message Added roleAudits for donor colours in onboarding Added typing status to /say * Team Mindset Roles BETA It works, but is kinda slow sometimes, probably some inefficient looping * Update tents to use new voice category Tents are now in their own category * I forgot 2 roles I am silly * Important Fixes Make AFK channel immune to deletion Make TTS role count as donor for donor colours * Add "Busy" role to TTS mindsets * Update futon ID Silly bot keeps deleting it * Change how deleting tents works Changed from checking explicit IDs to not delete to simply checking if a voice channel includes a tent emoji or not * Add bot typing status to announcements * Fix TTS access to donor colours * Make typing status 3 seconds * Small fixes / updates Add 'busy' role to TTS mindsets Make tripbot typing 3 seconds instead of 1.5 Add typing to announcements Change how tent deletion works Update IDs in env * Merge and lint * Update tents permission overwrites * belly button linting * Bug in knex * Add /voice radio First pass, needs work and add function of changing the tent name to signify the bot is being borrowed * Add /voice bitrate Allows editing of bitrate * Lint that shit * One more lint * Finish up * Possible /voice radio fix No way to test in dev. Incorporated what was originally a separate function (checking if there is already a radio bot in the channel before moving a new one in), into the same part of the code that checks if the radio is available and pulls it in * Make "user" entry for /timezone and /birthday required to speed up command entry * Trivia, small fixes Re-enabled Trivia Stopped Verified role from being removed during tripsit session (stops welcome messages) Added code for /voice add (disabled) Removed /voice radio (just way too buggy) Small edit to welcome message * Undo required * Linting * Fixing actions * New donator system Becoming a patron sub now also gives the "Premium Member" role. This new role is what activates all the donator benefits. Supporter role now only acts as a cosmetic with as a hoisted role with gem icon. Premium Member is permanent for Patreon or Kofi donations. Booster is unchanged and all donator perks for boosters is removed once they stop boosting. * Update env.config.ts * Add kofi link * Ignore donor roles in tripsit mode To prevent duplicate donation announcement messages * Update d.donate and a few minor things * Add premium role add --------- Co-authored-by: Hipperooni --- src/discord/commands/global/d.donate.ts | 37 +++++++++--- src/discord/events/guildMemberUpdate.ts | 79 ++++++++++++++++++------- src/discord/utils/tripsitme.ts | 3 + src/global/commands/g.donate.ts | 10 ++-- src/global/utils/env.config.ts | 6 +- 5 files changed, 96 insertions(+), 39 deletions(-) diff --git a/src/discord/commands/global/d.donate.ts b/src/discord/commands/global/d.donate.ts index 5fad2b502..892ca3e01 100644 --- a/src/discord/commands/global/d.donate.ts +++ b/src/discord/commands/global/d.donate.ts @@ -25,14 +25,37 @@ export const dDonate: SlashCommand = { const donateInfo = await donate(); const embed = embedTemplate() .setColor(Colors.Purple) - .setTitle('Donate to keep TripSit running and fund our future projects!') + .setTitle('🚀 **TripSit\'s Donation Info!** 🚀') .setURL('https://tripsit.me/donate/') - .setDescription( - stripIndents`The best way to support us is to join the discord and help out people! - We run on volunteers and need your help to keep the org going - If you can donate, our preferred method is Patreon, and we're happy for all donation sizes! - You can get supporter benefits for as little as $1 a month!`, - ); + .setDescription(stripIndents` + At TripSit, we're all about harm reduction, and we'll never charge for our services or hide information behind paywalls or annoying ads. Our mission is to help anyone who needs it, no strings attached. 🌟 + + But we can't pay for servers with good intentions alone, so your support means the world to us. + + There are two awesome ways to contribute: + + 1️⃣ **Patreon Subscription** + For as little as $1 a month, you can become a patron and keep supporting the good cause. 🌈 + + 2️⃣ **Ko-Fi Donation** + If that isn't your style, you can give a one-time boost to our cause through Ko-Fi. ☕ + + 🎁 What's in it for you? Well, we've got some fantastic benefits for our supporters: + + - 📣 **Announcement**: We'll tell the guild you've made a difference in #vip-lounge. + - 🪙 **Gold Lounge Access**: Gain entry to our exclusive donor space, #gold-lounge. + - 🌈 **Special Donor Colors**: Deck out your Discord persona with unique colors. + - 💎 **Supporter Role (Patreon)**: Be shown at the top of the member list with a unique icon. + - 🎉 More surprises are in the works! Your suggestions are welcome. + + These are **permanent** benefits, excluding the Supporter role, which is only for active Patreons. + + No spare change? Boosting our server will also give you donor perks while your boost is active! + + Your donations directly fuel our server costs, ensuring TripSit keeps doing what we do best. 🌐 With enough support, we can even expand and provide new services – who's up for a Minecraft server? 😎 + + Thank you for being a part of our journey, and for helping make the world a safer place! 💕 + `); // for (const entry of donateInfo) { donateInfo.forEach(entry => { if (entry.value.length > 0) { diff --git a/src/discord/events/guildMemberUpdate.ts b/src/discord/events/guildMemberUpdate.ts index 5db5488f8..7dc0bac30 100644 --- a/src/discord/events/guildMemberUpdate.ts +++ b/src/discord/events/guildMemberUpdate.ts @@ -106,18 +106,36 @@ const donorColorRoles = { [key in DonorColorNames]: string; }; -type DonorNames = -| 'ROLE_BOOSTER' -| 'ROLE_PATRON' -| 'ROLE_TEAMTRIPSIT'; - -const donorRoles = { - ROLE_BOOSTER: env.ROLE_BOOSTER, - ROLE_PATRON: env.ROLE_PATRON, - ROLE_TEAMTRIPSIT: env.ROLE_TEAMTRIPSIT, -} as { - [key in DonorNames]: string; -}; +// type DonorNames = +// | 'ROLE_BOOSTER' +// | 'ROLE_PATRON' +// | 'ROLE_TEAMTRIPSIT'; + +// const donorRoles = { +// ROLE_BOOSTER: env.ROLE_BOOSTER, +// ROLE_PATRON: env.ROLE_PATRON, +// ROLE_TEAMTRIPSIT: env.ROLE_TEAMTRIPSIT, +// } as { +// [key in DonorNames]: string; +// }; + +const thankYouPhrases = [ + 'A heartfelt thanks for their generous contribution. Your support is invaluable!', + "Big shout out for their donation. We couldn't do it without you!", + 'Thank you for your incredible support. Your contribution makes a world of difference.', + 'Our gratitude knows no bounds. Thank you for helping us grow and thrive.', + "We're over the moon with your donation. Your generosity warms our hearts.", + 'A round of applause! Your donation keeps our mission alive and thriving.', + 'A standing ovation! Your support illuminates our path forward.', + "With your donation, you've become a crucial part of our journey. Thank you!", + 'Thank you for being a beacon of support. You light up our endeavors.', + "Our deepest gratitude for their contribution. Together, we'll reach new heights.", +]; + +const donationTagline = '*`/donate` to TripSit to access special username colors and the snazzy Gold Lounge!*'; + +const boostEmoji = env.NODE_ENV === 'production' ? '<:ts_boost:981799280396353596>' : '<:ts_boost:1168968973082185800>'; +const donorEmoji = env.NODE_ENV === 'production' ? '<:ts_donor:1121625178774966272>' : '<:ts_donor:1168969578836144233>'; const F = f(__filename); @@ -131,7 +149,7 @@ async function donorColorCheck( // log.debug(F, `donor color role added: ${roleId}`); // If it does, check if the user also has a donor role if (oldMember.roles.cache.has(env.ROLE_BOOSTER) - || oldMember.roles.cache.has(env.ROLE_PATRON) + || oldMember.roles.cache.has(env.ROLE_PREMIUM) || oldMember.roles.cache.has(env.ROLE_TEAMTRIPSIT)) { log.debug(F, 'Donor added a color role!'); } else { @@ -153,8 +171,9 @@ async function donorColorRemove( ) { // log.debug(F, `donor color role removed: ${roleId}`); // log.debug(F, `${Object.keys(donorRoles)}`); - // Check if it's a donor role - if (Object.values(donorRoles).includes(roleId)) { + // Check if it's the booster role, if it is, remove colour role if they don't also have the premium role + if ((roleId === env.ROLE_BOOSTER && !newMember.roles.cache.has(env.ROLE_PREMIUM)) + || (roleId === env.ROLE_PREMIUM && !newMember.roles.cache.has(env.ROLE_BOOSTER))) { // log.debug(F, `donor role removed: ${roleId}`); // If it does, check if the user also has a role id matching a donorColorRole and if so, remove it const donorColorRole = newMember.roles.cache.find(role => Object.values(donorColorRoles).includes(role.id)); @@ -354,8 +373,13 @@ async function addedBooster( // Check if the role added was a donator role if (roleId === env.ROLE_BOOSTER) { // log.debug(F, `${newMember.displayName} boosted the server!`); - const channelGoldlounge = await discordClient.channels.fetch(env.CHANNEL_GOLDLOUNGE) as TextChannel; - await channelGoldlounge.send(`Hey @here, ${newMember} just boosted the server, give them a big thank you for helping to keep this place awesome!`); // eslint-disable-line max-len + const channelviplounge = await discordClient.channels.fetch(env.CHANNEL_VIPLOUNGE) as TextChannel; + await channelviplounge.send(stripIndents` + ** ${boostEmoji} ${newMember.toString()} just boosted the server! ${boostEmoji} ** + + ${thankYouPhrases[Math.floor(Math.random() * thankYouPhrases.length)]} + + ${donationTagline}`); } } @@ -363,12 +387,21 @@ async function addedPatreon( newMember: GuildMember, roleId: string, ) { - // Check if the role added was a donator role - if (roleId === env.ROLE_PATRON) { - // log.debug(F, `${newMember.displayName} became a patron!`); - const channelGoldlounge = await discordClient.channels.fetch(env.CHANNEL_GOLDLOUNGE) as TextChannel; - const isProd = env.NODE_ENV === 'production'; - await channelGoldlounge.send(`Hey ${isProd ? '@here' : 'here'}, ${newMember} just became a patron, give them a big thank you for helping us keep the lights on and expand!`); // eslint-disable-line max-len + if (roleId === env.ROLE_PATRON && !newMember.roles.cache.has(env.ROLE_PREMIUM)) { + // Check if the user already has the premium role + // If they don't add it, and send the message, remove the patreon role + const role = await newMember.guild.roles.fetch(env.ROLE_PREMIUM) as Role; + // log.debug(F, `Adding ${role.name} from ${newMember.displayName}`); + await newMember.roles.add(role); + // log.debug(F, `Added ${role.name} from ${newMember.displayName}`); + + const channelviplounge = await discordClient.channels.fetch(env.CHANNEL_VIPLOUNGE) as TextChannel; + await channelviplounge.send(stripIndents` + ** ${donorEmoji} ${newMember} just became a Premium Member by donating via [Patreon]() or [KoFi]()! ${donorEmoji} ** + + ${thankYouPhrases[Math.floor(Math.random() * thankYouPhrases.length)]} + + ${donationTagline}`); } } diff --git a/src/discord/utils/tripsitme.ts b/src/discord/utils/tripsitme.ts index cafe624f0..8fb5fde5c 100644 --- a/src/discord/utils/tripsitme.ts +++ b/src/discord/utils/tripsitme.ts @@ -96,6 +96,9 @@ const mindsetRoles = [ const otherRoles = [ env.ROLE_VERIFIED, + env.ROLE_PREMIUM, + env.ROLE_BOOSTER, + env.ROLE_PATRON, ]; const ignoredRoles = `${teamRoles},${colorRoles},${mindsetRoles},${otherRoles}`; diff --git a/src/global/commands/g.donate.ts b/src/global/commands/g.donate.ts index 9ea91ad25..ab18b92ce 100644 --- a/src/global/commands/g.donate.ts +++ b/src/global/commands/g.donate.ts @@ -9,16 +9,16 @@ export default donate; export async function donate():Promise { const response = [ { - name: 'Patreon (Preferred)', + name: 'Patreon Subscription', value: 'https://patreon.com/tripsit', }, { - name: 'Discord Boosts', - value: 'http://discord.gg/TripSit', + name: 'KoFi Tips', + value: 'https://ko-fi.com/tripsit', }, { - name: '\u200B', - value: '\u200B', + name: 'Discord Boosts', + value: 'http://discord.gg/TripSit', }, { name: 'Spreadshop', diff --git a/src/global/utils/env.config.ts b/src/global/utils/env.config.ts index b755bbde7..d4cb3c4cd 100644 --- a/src/global/utils/env.config.ts +++ b/src/global/utils/env.config.ts @@ -266,10 +266,8 @@ export const env = { ROLE_VUTEUNDERBAN: isProd ? '991811318464139416' : '989287082222579792', ROLE_PATRON: isProd ? '954133862601089095' : '1052644652349665310', - ROLE_TREE: isProd ? '954133862601089095' : '960606558050480148', - ROLE_SPROUT: isProd ? '955618510631993414' : '960606557622657033', - ROLE_SEEDLING: isProd ? '955618661274644491' : '960606557622657032', - ROLE_BOOSTER: isProd ? '853082033224024135' : '980116577846431774', + ROLE_BOOSTER: isProd ? '853082033224024135' : '1167725202302574642', + ROLE_PREMIUM: isProd ? '1139454371613122640' : '1167714206418735144', ROLE_DRUNK: isProd ? '955485069294854154' : '1052644628639252500', ROLE_HIGH: isProd ? '955482289335320626' : '1052644630912577586',