Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Dec 10, 2024
1 parent 34b1119 commit 00b5eff
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
38 changes: 38 additions & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!",
],
};
16 changes: 13 additions & 3 deletions src/lib/messages/Messages.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { prisma } from "../../prisma.js";
import {
JAIL,
LEVEL_LIST,
LEVEL_MESSAGES,
SHOULD_USER_LEVEL_UP,
VERIFY_CHANNELS,
} from "../constants.js";
Expand Down Expand Up @@ -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: [] },
});
}
}
}
Expand Down

0 comments on commit 00b5eff

Please sign in to comment.