From 00b5effeb8adfbe2f9dafdece409b59fefe2a839 Mon Sep 17 00:00:00 2001 From: 0-don Date: Tue, 10 Dec 2024 23:16:56 +0100 Subject: [PATCH] test --- src/lib/constants.ts | 38 ++++++++++++++++++++++++++++ src/lib/messages/Messages.service.ts | 16 +++++++++--- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 8afcd842..d21f5865 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -84,3 +84,41 @@ export const LEVEL_LIST = [ { count: 2500, role: GIGA_ACTIVE }, { count: 5000, role: ULTRA_ACTIVE }, ]; + +export const LEVEL_MESSAGES = { + ACTIVE: [ + "🚀 `DEBUG: ${user} has compiled their first 10 messages!` Your code now runs with the ${role} badge!", + "💡 `console.log('New Developer Alert!')` ${user} has unlocked ${role} after 10 quality commits!", + "🔧 `try { ${user}.sendCongrats() }` Your first 10 messages earned you ${role} status!", + "🌱 `npm install ${user}-achievement` Successfully added ${role} package to your profile!", + "⚡ `Hello, World!` ${user} has completed their first programming milestone as ${role}!", + ], + SUPER_ACTIVE: [ + "⚡ `SYSTEM.OUT.PRINTLN('${user} hit 100 messages!')` You've been promoted to ${role}!", + "🔥 `function levelUp() { return '${user} is now ${role}!' }` 100 messages of pure genius!", + "💻 `SELECT * FROM users WHERE awesome = true` Found: ${user} as new ${role}!", + "🚀 `git push origin ${user}-promotion` Successfully deployed to ${role} branch!", + "⭐ `${user}.experience += 100` Achievement unlocked: ${role}!", + ], + MEGA_ACTIVE: [ + "💻 `while(true) { praise(${user}); }` Infinite props for reaching ${role} with 1000 messages!", + "🎯 `docker run congratulate ${user}` Container launched with ${role} privileges!", + "🔥 `chmod 777 ${user}` Full permissions granted for reaching ${role}!", + "⚡ `${user} instanceof ${role} === true` 1000 messages of pure coding excellence!", + "🚀 `sudo apt-get upgrade ${user}` Successfully upgraded to ${role}!", + ], + GIGA_ACTIVE: [ + "🔥 `git commit -m '${user} reached 2500 messages'` Merged into ${role} branch!", + "💫 `async function celebrate() { return '${user} is ${role}!' }` 2500 messages await resolved!", + "⚡ `for(let i=0; i<2500; i++) { respect++ }` ${user} has achieved ${role} status!", + "🎮 `${user}.setRole('${role}')` Level 2500 achievement unlocked!", + "🌟 `pip install ${user}-supremacy` Successfully installed ${role} package!", + ], + ULTRA_ACTIVE: [ + "⚔️ `sudo chmod 777 ${user}` Ultimate permissions granted! You've ascended to ${role} with 5000 messages!", + "🎯 `CREATE USER ${user} WITH SUPERUSER` Access granted to ${role} privileges!", + "🔱 `${user}.rank = Number.MAX_VALUE` Congratulations on reaching ${role}!", + "💫 `deployment.yaml: ${user} scaled to ${role}` 5000 messages of legendary status!", + "🌟 `ALTER USER ${user} WITH ROLE = '${role}'` Maximum power level achieved!", + ], +}; diff --git a/src/lib/messages/Messages.service.ts b/src/lib/messages/Messages.service.ts index 63f14277..077a7199 100644 --- a/src/lib/messages/Messages.service.ts +++ b/src/lib/messages/Messages.service.ts @@ -9,6 +9,7 @@ import { prisma } from "../../prisma.js"; import { JAIL, LEVEL_LIST, + LEVEL_MESSAGES, SHOULD_USER_LEVEL_UP, VERIFY_CHANNELS, } from "../constants.js"; @@ -138,9 +139,18 @@ export class MessagesService { ) { await message.member?.roles.add(role); - await (message.channel as TextChannel).send( - `<@${message.member?.id}>, you just advanced to ${role.name}! 🎉🎉🎉` - ); + const messages = + LEVEL_MESSAGES[role.name as keyof typeof LEVEL_MESSAGES]; + const randomMessage = messages[ + Math.floor(Math.random() * messages.length) + ] + .replace("${user}", message.member?.toString() ?? "") + .replace("${role}", role.toString()); + + await (message.channel as TextChannel).send({ + content: randomMessage, + allowedMentions: { users: [] }, + }); } } }