Skip to content

Commit

Permalink
Member icons in profile and levels (#691)
Browse files Browse the repository at this point in the history
* 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

* Add 4 new backgrounds, remove multipliers

* Add premium and legacy icon to /profile and /levels

* Oops

* Better implementation

* Better implementation v2

* Update background URLs

* lint that belly button

---------

Co-authored-by: Moonbear <[email protected]>
  • Loading branch information
Hipperooni and LunaUrsa authored Nov 5, 2023
1 parent 1895110 commit 08f7b84
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 44 deletions.
53 changes: 42 additions & 11 deletions src/discord/commands/guild/d.levels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ export const dLevels: SlashCommand = {
// await Canvas.loadImage(await imageGet(`icon_${target.presence?.status ?? 'offline'}`)),
// Get the avatar image
await Canvas.loadImage(target.user.displayAvatarURL({ extension: 'jpg' })),
await Canvas.loadImage(await imageGet('premiumIcon')),
await Canvas.loadImage(await imageGet('legacyIcon')),
]);

const profileData = values[1].status === 'fulfilled' ? values[1].value : {} as ProfileData;
Expand All @@ -250,6 +252,8 @@ export const dLevels: SlashCommand = {
const Icons = values[4].status === 'fulfilled' ? values[4].value : {} as Canvas.Image;
// const StatusIcon = values[5].status === 'fulfilled' ? values[5].value : {} as Canvas.Image;
const avatar = values[5].status === 'fulfilled' ? values[5].value : {} as Canvas.Image;
const premiumIcon = values[6].status === 'fulfilled' ? values[6].value : {} as Canvas.Image;
const legacyIcon = values[7].status === 'fulfilled' ? values[7].value : {} as Canvas.Image;

// log.debug(F, `levelData: ${JSON.stringify(levelData, null, 2)}`);

Expand All @@ -258,6 +262,8 @@ export const dLevels: SlashCommand = {
// const layout = 4;
let layoutHeight = 386;
let layout = 1;
let isPremium = false;
let isLegacy = false;
if (target.roles.cache.has(env.ROLE_TEAMTRIPSIT)) {
layoutHeight = 566;
layout = 4;
Expand All @@ -272,6 +278,13 @@ export const dLevels: SlashCommand = {
// log.debug(F, 'is helper');
}

if (target.roles.cache.has(env.ROLE_PREMIUM)) {
isPremium = true;
}
if (target.roles.cache.has(env.ROLE_LEGACY)) {
isLegacy = true;
}

// Create Canvas and Context
const canvasWidth = 921;
const canvasHeight = layoutHeight;
Expand Down Expand Up @@ -301,7 +314,6 @@ export const dLevels: SlashCommand = {
// Top Right Chips
context.fillStyle = chipColor;
context.beginPath();
// context.arc(612, 73, 54, 0, Math.PI * 2, true); // CAMP ICON CHIP
context.roundRect(702, 18, 201, 51, [19]);
context.roundRect(702, 78, 201, 51, [19]);
// Label Chips
Expand Down Expand Up @@ -353,23 +365,42 @@ export const dLevels: SlashCommand = {
context.restore();
}
}
// Overly complicated avatar clip (STATUS CLIP COMMENTED OUT)
// Overly complicated avatar clip
context.save();
// context.beginPath();
// context.arc(110, 112, 21, 0, Math.PI * 2);
// context.arc(73, 73, 55, 0, Math.PI * 2, true);
// context.closePath();
// context.clip();
// If user is rather premium or legacy, draw the hole for the icon
if (isPremium === true || isLegacy === true) {
context.beginPath();
context.arc(110, 112, 21, 0, Math.PI * 2);
context.arc(73, 73, 55, 0, Math.PI * 2, true);
context.closePath();
context.clip();
}
// If user is both premium and legacy, draw the extra left hand hole
if (isPremium === true && isLegacy === true) {
context.beginPath();
context.arc(36, 112, 21, 0, Math.PI * 2);
context.arc(73, 73, 55, 0, Math.PI * 2, true);
context.closePath();
context.clip();
}
context.beginPath();
context.arc(73, 73, 54, 0, Math.PI * 2, true);
// context.closePath();
context.clip();

context.drawImage(avatar, 18, 18, 109, 109);
context.restore();
// context.drawImage(StatusIcon, 90, 92);

// context.drawImage(CampIcon, 556, 17);
if (isPremium === true) {
context.drawImage(premiumIcon, 94, 97, 32, 32);
}
if (isLegacy === true && isPremium === false) {
context.drawImage(legacyIcon, 94, 97, 32, 32);
}
// If both premium and legacy, move the legacy icon to the second slot, on the left
if (isLegacy === true && isPremium === true) {
context.drawImage(legacyIcon, 20, 97, 32, 32);
}

// WIP: Check to see if a user has bought a title in the shop
// If so, move Username Text up so the title can fit underneath
Expand All @@ -381,7 +412,7 @@ export const dLevels: SlashCommand = {
do {
fontSize -= 2;
usernameContext.font = `${fontSize}px futura`;
} while (usernameContext.measureText(text).width > 530);// LARGER LENGTH WHILE CAMP ISN'T ENABLED (DEFAULT IS 380)
} while (usernameContext.measureText(text).width > 530);
return usernameContext.font;
};

Expand Down Expand Up @@ -471,7 +502,7 @@ export const dLevels: SlashCommand = {
do {
fontSize -= 1;
rankContext.font = `${fontSize}px futura`;
} while (rankContext.measureText(text).width > 114);// LARGER LENGTH WHILE CAMP ISN'T ENABLED (DEFAULT IS 380)
} while (rankContext.measureText(text).width > 114);
return rankContext.font;
};
context.font = '40px futura';
Expand Down
52 changes: 43 additions & 9 deletions src/discord/commands/guild/d.profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ export const dProfile: SlashCommand = {
await Canvas.loadImage(target.user.displayAvatarURL({ extension: 'jpg' })),
// Get the birthday card overlay
await Canvas.loadImage(await imageGet('cardBirthday')),
await Canvas.loadImage(await imageGet('premiumIcon')),
await Canvas.loadImage(await imageGet('legacyIcon')),
]);

const profileData = values[0].status === 'fulfilled' ? values[0].value : {} as ProfileData;
Expand All @@ -226,6 +228,18 @@ export const dProfile: SlashCommand = {
// const StatusIcon = values[3].status === 'fulfilled' ? values[3].value : {} as Canvas.Image;
const avatar = values[3].status === 'fulfilled' ? values[3].value : {} as Canvas.Image;
const birthdayOverlay = values[4].status === 'fulfilled' ? values[4].value : {} as Canvas.Image;
const premiumIcon = values[5].status === 'fulfilled' ? values[5].value : {} as Canvas.Image;
const legacyIcon = values[6].status === 'fulfilled' ? values[6].value : {} as Canvas.Image;

let isPremium = false;
let isLegacy = false;

if (target.roles.cache.has(env.ROLE_PREMIUM)) {
isPremium = true;
}
if (target.roles.cache.has(env.ROLE_LEGACY)) {
isLegacy = true;
}

// Create Canvas and Context
const canvasWidth = 921;
Expand Down Expand Up @@ -308,21 +322,41 @@ export const dProfile: SlashCommand = {
context.stroke();
context.restore(); */

// Overly complicated avatar clip (STATUS CLIP COMMENTED OUT)
// Overly complicated avatar clip
context.save();
// context.beginPath();
// context.arc(110, 112, 21, 0, Math.PI * 2);
// context.arc(73, 73, 55, 0, Math.PI * 2, true);
// context.closePath();
// context.clip();
if (isPremium === true || isLegacy === true) {
context.beginPath();
context.arc(110, 112, 21, 0, Math.PI * 2);
context.arc(73, 73, 55, 0, Math.PI * 2, true);
context.closePath();
context.clip();
}
// If user is both premium and legacy, draw the extra left hand hole
if (isPremium === true && isLegacy === true) {
context.beginPath();
context.arc(36, 112, 21, 0, Math.PI * 2);
context.arc(73, 73, 55, 0, Math.PI * 2, true);
context.closePath();
context.clip();
}
context.beginPath();
context.arc(73, 73, 54, 0, Math.PI * 2, true);
// context.closePath();
context.clip();
// Avatar Image

context.drawImage(avatar, 18, 18, 109, 109);
context.restore();
// context.drawImage(StatusIcon, 90, 92);

if (isPremium === true) {
context.drawImage(premiumIcon, 94, 97, 32, 32);
}
if (isLegacy === true && isPremium === false) {
context.drawImage(legacyIcon, 94, 97, 32, 32);
}
// If both premium and legacy, move the legacy icon to the second slot, on the left
if (isLegacy === true && isPremium === true) {
context.drawImage(legacyIcon, 20, 97, 32, 32);
}

// WIP: Camp Icon
// const CampIcon = await Canvas.loadImage(await imageGet('campIconA'));
Expand Down Expand Up @@ -392,7 +426,7 @@ export const dProfile: SlashCommand = {
context.fillText(`${numFormatter(profileData.karma_received)}`, 648, 190);

// Tokens Text
context.fillText(`${numFormatter(profileData.tokens)}`, 648, 250);
// context.fillText(`${numFormatter(profileData.tokens)}`, 648, 250);

// Level Text
const totalTextData = await getTotalLevel(profileData.totalTextExp + profileData.totalVoiceExp);
Expand Down
50 changes: 26 additions & 24 deletions src/discord/utils/imageGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const imageDef = {
icon_offline: { path: `${assetsDirectory}/img/icons/offline.png`, url: 'https://i.gyazo.com/b2b1bf7d91acdb4ccc72dfde3d7075fc.png' },
icon_dnd: { path: `${assetsDirectory}/img/icons/dnd.png`, url: 'https://i.gyazo.com/a98f0e9dd72f6fb59af388d719d01e64.png' },
icon_idle: { path: `${assetsDirectory}/img/icons/idle.png`, url: 'https://i.gyazo.com/df8f4a4ca2553d4d657ee82e4bf64a3a.png' },
premiumIcon: { path: `${assetsDirectory}/img/icons/premiumicon.png`, url: 'https://i.gyazo.com/22ac60fc2602759d3f43d9c028ddff68.png' },
legacyIcon: { path: `${assetsDirectory}/img/icons/legacyicon.png`, url: 'https://i.gyazo.com/0f3fc0132204e80ed5e697e0863cfad3.png' },
badgeVip0: { path: `${assetsDirectory}/img/badges/vip0.png`, url: 'https://i.gyazo.com/13daebdda4ca75ab59923396f255f7db.png' },
badgeVip1: { path: `${assetsDirectory}/img/badges/vip1.png`, url: 'https://i.gyazo.com/5d37a2d3193c4c7e8a033b6b2ed7cb7f.png' },
badgeVip2: { path: `${assetsDirectory}/img/badges/vip2.png`, url: 'https://i.gyazo.com/161506f23b1907ac1280db26ead5a0a4.png' },
Expand Down Expand Up @@ -48,30 +50,30 @@ const imageDef = {
// cardOrange: { path: `${assetsDirectory}/img/cards/orange.png`, url: 'https://i.gyazo.com/b7504ea55bd7935f97b286407a1bc259.png' },
// cardPink: { path: `${assetsDirectory}/img/cards/pink.png`, url: 'https://i.gyazo.com/b7504ea55bd7935f97b286407a1bc259.png' },
rules: { path: `${assetsDirectory}/img/RULES.png`, url: 'https://i.imgur.com/lDoNca1.png' },
Geolines: { path: `${assetsDirectory}/img/backgrounds/Geolines.png`, url: 'https://drive.google.com/uc?export=view&id=1-CpMlbe77hgdlh6thqwvMwXuUl_ozgEi' },
Waves: { path: `${assetsDirectory}/img/backgrounds/Waves.png`, url: 'https://drive.google.com/uc?export=view&id=1-OScueAsW13QcyjTs9UsX5LO3VR0hIn8' },
LiquidMaze: { path: `${assetsDirectory}/img/backgrounds/LiquidMaze.png`, url: 'https://drive.google.com/uc?export=view&id=1-RdKRSH1rrugei5VLHHjUdXceBhDPnPn' },
Flow: { path: `${assetsDirectory}/img/backgrounds/Flow.png`, url: 'https://drive.google.com/uc?export=view&id=1-ZkGk_lw2zEX1xVxXzwhjum7UOJBwDGb' },
DiamondChevron: { path: `${assetsDirectory}/img/backgrounds/DiamondChevron.png`, url: 'https://drive.google.com/uc?export=view&id=1-b2xFDrzpL6tVMvmY5pz-SO-czPnCMsO' },
Concentric: { path: `${assetsDirectory}/img/backgrounds/Concentric.png`, url: 'https://drive.google.com/uc?export=view&id=1-fe72RxbCLR24QOwomtsZcetTnsP1zNx' },
CubeTunnels: { path: `${assetsDirectory}/img/backgrounds/CubeTunnels.png`, url: 'https://drive.google.com/uc?export=view&id=1-fvG30yPMAK87d0JeKEND8CMB80xhP4_' },
Leaves: { path: `${assetsDirectory}/img/backgrounds/Leaves.png`, url: 'https://drive.google.com/uc?export=view&id=1-rQG0lQOfI30DOSZAOQGBoYi7FXxgqbg' },
SquareTwist: { path: `${assetsDirectory}/img/backgrounds/SquareTwist.png`, url: 'https://drive.google.com/uc?export=view&id=103ok01PPBQlpfeqQO30D8waE1db30nBY' },
Noise: { path: `${assetsDirectory}/img/backgrounds/Noise.png`, url: 'https://drive.google.com/uc?export=view&id=10Glmw04_aNLo0h-YsZcgmg5PUU_hQ5Yt' },
Squiggles: { path: `${assetsDirectory}/img/backgrounds/Squiggles.png`, url: 'https://drive.google.com/uc?export=view&id=10J5CZyaBq9zBO4GDsIg2wayw3aIPlkZC' },
TriangleOverlap: { path: `${assetsDirectory}/img/backgrounds/TriangleOverlap.png`, url: 'https://drive.google.com/uc?export=view&id=10LoWmB0HhGxzRlguftb0vwiqfM06BaVF' },
XandO: { path: `${assetsDirectory}/img/backgrounds/XandO.png`, url: 'https://drive.google.com/uc?export=view&id=10_MmlrVO5jEmrWWyt-voVFTrZ7YE0Vik' },
Safari: { path: `${assetsDirectory}/img/backgrounds/Safari.png`, url: 'https://drive.google.com/uc?export=view&id=10_P_iPx6sgljCycEA1qcNbK8mLdcAcf-' },
LineLeaves: { path: `${assetsDirectory}/img/backgrounds/LineLeaves.png`, url: 'https://drive.google.com/uc?export=view&id=10c7AWo3qseXKQLU6Iwd0h_xX4GfVWwiJ' },
ArcadeCarpet: { path: `${assetsDirectory}/img/backgrounds/ArcadeCarpet.png`, url: 'https://drive.google.com/uc?export=view&id=10i4iS2sJBxOSX6LDrx8bc3qeeJ30hGP9' },
Topography: { path: `${assetsDirectory}/img/backgrounds/Topography.png`, url: 'https://drive.google.com/uc?export=view&id=10nMZEZc5IQGbWiOVhThb1jt6BGjev_HO' },
CoffeeSwirl: { path: `${assetsDirectory}/img/backgrounds/CoffeeSwirl.png`, url: 'https://drive.google.com/uc?export=view&id=10pCnwM8aZXxVpXGN1LYNwSDNm3citRXP' },
SpaceIcons: { path: `${assetsDirectory}/img/backgrounds/SpaceIcons.png`, url: 'https://drive.google.com/uc?export=view&id=11-aqVuO-qGh1aFayml_tNQdZuVLF3lgj' },
Plaid: { path: `${assetsDirectory}/img/backgrounds/Plaid.png`, url: 'https://drive.google.com/uc?export=view&id=112ezKc-zpb0p3iwVYujw5lK2Cgp8uTzS' },
Paisley: { path: `${assetsDirectory}/img/backgrounds/Paisley.png`, url: 'https://drive.google.com/uc?export=view&id=114risNKm8Khc3uRqRlpB9MsT6qypt4ag' },
AbstractTriangles: { path: `${assetsDirectory}/img/backgrounds/AbstractTriangles.png`, url: 'https://drive.google.com/uc?export=view&id=116zugUVQJqTVEhSZTO8iXiiLUznrOjjc' },
Memphis: { path: `${assetsDirectory}/img/backgrounds/Memphis.png`, url: 'https://drive.google.com/uc?export=view&id=117XLPb59h6V9op7GG7A6FFSvh07Any7-' },
Connected: { path: `${assetsDirectory}/img/backgrounds/Connected.png`, url: 'https://drive.google.com/uc?export=view&id=11AVKT7xrjI2ZgIpxz7j0zstBkD6XOD4m' },
Geolines: { path: `${assetsDirectory}/img/backgrounds/Geolines.png`, url: 'https://i.gyazo.com/ac6676009174aed8d3448ca7f3fa9527.png' },
Waves: { path: `${assetsDirectory}/img/backgrounds/Waves.png`, url: 'https://i.gyazo.com/0ee1fcdf6bba0c56c1fc0183242ef1d2.png' },
LiquidMaze: { path: `${assetsDirectory}/img/backgrounds/LiquidMaze.png`, url: 'https://i.gyazo.com/53fef2a3554806d2a28690e0d03712a2.png' },
Flow: { path: `${assetsDirectory}/img/backgrounds/Flow.png`, url: 'https://i.gyazo.com/419d2747174841b24ae9ac1144a6883c.png' },
DiamondChevron: { path: `${assetsDirectory}/img/backgrounds/DiamondChevron.png`, url: 'https://i.gyazo.com/9be521230698f12838ecbc5935c5268e.png' },
Concentric: { path: `${assetsDirectory}/img/backgrounds/Concentric.png`, url: 'https://i.gyazo.com/d184006c216f7544c0c765c3a7e37271.png' },
CubeTunnels: { path: `${assetsDirectory}/img/backgrounds/CubeTunnels.png`, url: 'https://i.gyazo.com/61b6f4ed14553270e3c5435eae283b51.png' },
Leaves: { path: `${assetsDirectory}/img/backgrounds/Leaves.png`, url: 'https://i.gyazo.com/7527be8a5854b75caec7e1cdb794b300.png' },
SquareTwist: { path: `${assetsDirectory}/img/backgrounds/SquareTwist.png`, url: 'https://i.gyazo.com/7dcfdeb70b490caea8790a7fd7e782fc.png' },
Noise: { path: `${assetsDirectory}/img/backgrounds/Noise.png`, url: 'https://i.gyazo.com/1b35950d37b615f17db34125ade35032.png' },
Squiggles: { path: `${assetsDirectory}/img/backgrounds/Squiggles.png`, url: 'https://i.gyazo.com/6589c130fc34a9ad5c5a832c7363a239.png' },
TriangleOverlap: { path: `${assetsDirectory}/img/backgrounds/TriangleOverlap.png`, url: 'https://i.gyazo.com/29c2a9b3854400d506e1d9667cf6aacd.png' },
XandO: { path: `${assetsDirectory}/img/backgrounds/XandO.png`, url: 'https://i.gyazo.com/69d3fe4a19706c751379ee5adf921d86.png' },
Safari: { path: `${assetsDirectory}/img/backgrounds/Safari.png`, url: 'https://i.gyazo.com/227d02f04fb9c8d42d0360ac35f86760.png' },
LineLeaves: { path: `${assetsDirectory}/img/backgrounds/LineLeaves.png`, url: 'https://i.gyazo.com/bf935014d3cb15c9db49d79cb6b607a9.png' },
ArcadeCarpet: { path: `${assetsDirectory}/img/backgrounds/ArcadeCarpet.png`, url: 'https://i.gyazo.com/830242c2c3c3c7f82e36ac365713e9dd.png' },
Topography: { path: `${assetsDirectory}/img/backgrounds/Topography.png`, url: 'https://i.gyazo.com/9b56026718c39e0a85d1d7544128da35.png' },
CoffeeSwirl: { path: `${assetsDirectory}/img/backgrounds/CoffeeSwirl.png`, url: 'https://i.gyazo.com/98448b6fb548456d328900d6483938fe.png' },
SpaceIcons: { path: `${assetsDirectory}/img/backgrounds/SpaceIcons.png`, url: 'https://i.gyazo.com/42174b547ed80c906d84d861abc4230b.png' },
Plaid: { path: `${assetsDirectory}/img/backgrounds/Plaid.png`, url: 'https://i.gyazo.com/542d40ff3492a0b80f9ffdd7d610ad3e.png' },
Paisley: { path: `${assetsDirectory}/img/backgrounds/Paisley.png`, url: 'https://i.gyazo.com/83272fc39086a6ccf994d4e8a4f432b9.png' },
AbstractTriangles: { path: `${assetsDirectory}/img/backgrounds/AbstractTriangles.png`, url: 'https://i.gyazo.com/41194844db3ad5929f919b3b8f922f9c.png' },
Memphis: { path: `${assetsDirectory}/img/backgrounds/Memphis.png`, url: 'https://i.gyazo.com/6b08f0dad9dcf36c458071496d6052d3.png' },
Connected: { path: `${assetsDirectory}/img/backgrounds/Connected.png`, url: 'https://i.gyazo.com/8a948ed8bff1f7377dbbd12d3c467d78.png' },
mushroomInfoA: { path: `${assetsDirectory}/img/mushroomInfoA.png`, url: 'https://i.gyazo.com/233df47085a0ac5493d8378111512b3d.png' },
mushroomInfoB: { path: `${assetsDirectory}/img/mushroomInfoB.png`, url: 'https://i.gyazo.com/2aae45e843da99867b82e9b1ad07d22b.png' },
} as {
Expand Down
1 change: 1 addition & 0 deletions src/global/utils/env.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export const env = {

ROLE_COLLABORATOR: isProd ? '' : '1052644650017628161',

ROLE_LEGACY: isProd ? '943600905289334784' : '1169902575299084399',
ROLE_VIP: isProd ? '943600905289334784' : '1052644659870048316',
ROLE_VIP_0: isProd ? '1007115915734831185' : '1052644658565623848',
ROLE_VIP_10: isProd ? '955451412878331974' : '1052644657395421245',
Expand Down

0 comments on commit 08f7b84

Please sign in to comment.