Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaUrsa committed Nov 2, 2023
2 parents 649ffbc + 3aafaff commit 7aa37da
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 39 deletions.
37 changes: 30 additions & 7 deletions src/discord/commands/global/d.donate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. 🌟

Check warning on line 31 in src/discord/commands/global/d.donate.ts

View workflow job for this annotation

GitHub Actions / Lint

This line has a length of 209. Maximum allowed is 120
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? 😎

Check warning on line 55 in src/discord/commands/global/d.donate.ts

View workflow job for this annotation

GitHub Actions / Lint

This line has a length of 202. Maximum allowed is 120
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) {
Expand Down
79 changes: 56 additions & 23 deletions src/discord/events/guildMemberUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 {
Expand All @@ -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));
Expand Down Expand Up @@ -354,21 +373,35 @@ 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}`);
}
}

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](<https://www.patreon.com/TripSit>) or [KoFi](<https://ko-fi.com/tripsit>)! ${donorEmoji} **
${thankYouPhrases[Math.floor(Math.random() * thankYouPhrases.length)]}
${donationTagline}`);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/discord/utils/tripsitme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down
10 changes: 5 additions & 5 deletions src/global/commands/g.donate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ export default donate;
export async function donate():Promise<DonateResource[]> {
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',
Expand Down
6 changes: 2 additions & 4 deletions src/global/utils/env.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 7aa37da

Please sign in to comment.