Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit a178594

Browse files
committed
feat(holidays): added new holidays
1 parent d5e408a commit a178594

File tree

5 files changed

+68
-18
lines changed

5 files changed

+68
-18
lines changed

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
88

99
---
1010

11+
## [**5.0.4**] - 29.01.2025
12+
13+
- Added: More holidays
14+
- Updated: All dependencies
15+
- Added: Commitizen (for dev)
16+
1117
## [**5.0.3**] - 04.11.2024
1218

1319
- Changed: Halloween end date from 6.11 to 4.11

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<br/>
33

44
<p align="center">
5-
<h1 align="center">Evilbot 5.0.2</h1>
5+
<h1 align="center">Evilbot 5.0.4</h1>
66

77
<p align="center">
88
Official discord bot for Eviloma server

β€Žbun.lockbβ€Ž

50.6 KB
Binary file not shown.

β€Žpackage.jsonβ€Ž

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://json.schemastore.org/package.json",
33
"name": "evilbot",
4-
"version": "5.0.3",
4+
"version": "5.0.4",
55
"description": "Official discord bot for Eviloma discord server",
66
"homepage": "https://github.com/Eviloma/evilbot",
77
"bugs": {
@@ -33,9 +33,10 @@
3333
"devDependencies": {
3434
"@biomejs/biome": "1.9.4",
3535
"@types/bun": "latest",
36-
"@types/react": "^18.3.12",
37-
"husky": "^9.1.6",
38-
"lint-staged": "^15.2.10"
36+
"@types/react": "18",
37+
"cz-conventional-changelog": "^3.3.0",
38+
"husky": "^9.1.7",
39+
"lint-staged": "^15.4.3"
3940
},
4041
"peerDependencies": {
4142
"typescript": "^5.0.0"
@@ -44,9 +45,14 @@
4445
"dependencies": {
4546
"canvacord": "^6.0.2",
4647
"dayjs": "^1.11.13",
47-
"discord.js": "^14.16.3",
48+
"discord.js": "^14.17.3",
4849
"easy-discord-components": "^1.1.2",
4950
"envalid": "^8.0.0",
50-
"rainlink": "^1.2.5"
51+
"rainlink": "^1.2.7"
52+
},
53+
"config": {
54+
"commitizen": {
55+
"path": "./node_modules/cz-conventional-changelog"
56+
}
5157
}
5258
}

β€Žsrc/utils/holiday.tsβ€Ž

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,66 @@
11
import dayjs from "dayjs";
22

3-
type Holiday = "halloween" | "christmas" | null;
3+
const letters = "abcdefghijklmnopqrstuvwxyz".split("");
4+
const symbols = "@#$%^&*()_+=-".split("");
5+
6+
type Holiday = "halloween" | "christmas" | "valentine" | "woman" | "programmer" | "april-fools" | "ukraine" | null;
47

58
export function getHolidayStatus(): Holiday {
69
const now = dayjs().set("year", 2000);
710

8-
if (now.isAfter("2000-10-25") && now.isBefore("2000-11-4")) {
9-
return "halloween";
10-
}
11-
12-
if (now.isAfter("2000-12-19") || now.isBefore("2000-01-15")) {
13-
return "christmas";
14-
}
11+
if (now.isAfter("2000-10-24", "day") && now.isBefore("2000-11-5", "day")) return "halloween";
12+
if (now.isSame("2000-02-14", "day")) return "valentine";
13+
if (now.isSame("2000-03-08", "day")) return "woman";
14+
if (now.isSame("2000-01-07", "day")) return "programmer";
15+
if (now.isSame("2000-04-01", "day")) return "april-fools";
16+
if (now.isSame("2000-08-24")) return "ukraine";
17+
if (now.isAfter("2000-12-19") || now.isBefore("2000-01-15")) return "christmas";
1518

1619
return null;
1720
}
1821

22+
function getAprilFoolsName(displayName: string): string {
23+
return displayName
24+
.split("")
25+
.map((char) => {
26+
// Keep spaces
27+
if (char === " ") return char;
28+
let newChar = "";
29+
30+
// Replace on symbols with 7.5% chance
31+
if (Math.random() < 0.075) newChar = symbols[Math.floor(Math.random() * symbols.length)];
32+
else {
33+
// Generate random letters
34+
const charID = letters.indexOf(char.toLowerCase());
35+
if (charID === -1) newChar = char[Math.floor(Math.random() * char.length)];
36+
else newChar = letters[Math.min(Math.max(0, charID + Math.floor(Math.random() * 5) - 2), letters.length - 1)];
37+
38+
// Random uppercase
39+
if (Math.random() > 0.5) newChar = newChar.toUpperCase();
40+
}
41+
42+
return newChar;
43+
})
44+
.join("");
45+
}
46+
1947
export function getTempVoiceName(displayName: string): string {
2048
switch (getHolidayStatus()) {
2149
case "halloween":
22-
return `πŸ¦‡${displayName}`;
50+
return `πŸ¦‡γƒ»${displayName}`;
2351
case "christmas":
24-
return `β›„${displayName}`;
52+
return `⛄・${displayName}`;
53+
case "valentine":
54+
return `❀️・${displayName}`;
55+
case "woman":
56+
return `♀️・${displayName}`;
57+
case "programmer":
58+
return `πŸ‘¨β€πŸ’»γƒ»${displayName}`;
59+
case "april-fools":
60+
return `πŸ€‘γƒ»${getAprilFoolsName(displayName)}`;
61+
case "ukraine":
62+
return `πŸ‡ΊπŸ‡¦γƒ»${displayName}`;
2563
default:
26-
return `πŸ”Š${displayName}`;
64+
return `πŸ”Šγƒ»${displayName}`;
2765
}
2866
}

0 commit comments

Comments
Β (0)