Skip to content

Commit cced83a

Browse files
committed
feat: multiple bug fixes, performance improvements and new commands
1 parent ef62c85 commit cced83a

39 files changed

Lines changed: 814 additions & 185 deletions

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ PROJECT_MAX_MEMORY=2048 # 2GB
88
PROJECT_AUTO_DOWNLOAD_MEDIA=true
99
PROJECT_MAX_DOWNLOAD_MEDIA=25 # 25MB
1010

11+
P_QUEUE_CONCURRENCY_COUNT=2
12+
1113
PHISHTANK_ENABLE=true
1214
PHISHTANK_UPDATE_HOUR=3 # default run at 03:00 UTC
1315
PHISHTANK_AUTO_UPDATE=true

package-lock.json

Lines changed: 174 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"ai": "^4.3.19",
3333
"axios": "^1.10.0",
3434
"cli-progress": "^3.12.0",
35+
"countries-and-timezones": "^3.8.0",
3536
"dotenv": "^17.2.0",
3637
"emoji-regex": "^10.5.0",
3738
"fb-downloader-scrapper": "^3.0.1",
@@ -40,10 +41,13 @@
4041
"groq-sdk": "^0.27.0",
4142
"is-spaghetti-code": "^1.0.1",
4243
"libphonenumber-js": "^1.12.24",
44+
"mathjs": "^15.0.0",
45+
"moment-timezone": "^0.6.0",
4346
"node-cron": "^4.2.1",
4447
"npmlog": "^7.0.1",
4548
"ollama": "^0.5.16",
4649
"openai": "^5.10.2",
50+
"p-queue": "^9.0.0",
4751
"qrcode-terminal": "^0.12.0",
4852
"redis": "^5.6.0",
4953
"semver": "^7.7.2",
@@ -57,6 +61,7 @@
5761
"devDependencies": {
5862
"@types/cli-progress": "^3.11.6",
5963
"@types/dotenv": "^6.1.1",
64+
"@types/he": "^1.2.3",
6065
"@types/node": "^24.0.14",
6166
"@types/npmlog": "^7.0.0",
6267
"@types/semver": "^7.7.1",

src/commands/block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Message } from "../../types/message";
22
import log from "../components/utils/log";
33
import { exec } from "child_process";
44
import util from "util";
5-
import { prisma } from "../components/prisma";
5+
import prisma from "../components/prisma";
66
import redis from "../components/redis";
77
import { addBlockUser } from "../components/services/user";
88

src/commands/calc.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { Message } from "../../types/message";
2+
import log from "../components/utils/log";
3+
import { create, all } from "mathjs";
4+
5+
const math = create(all, {});
6+
7+
export const info = {
8+
command: "calc",
9+
description: "Evaluate a mathematical expression.",
10+
usage: "calc <expression>",
11+
example: "calc 5 * (2 + 3)",
12+
role: "user",
13+
cooldown: 5000,
14+
};
15+
16+
export default async function (msg: Message) {
17+
const prefix = /^calc\s+/i;
18+
if (!prefix.test(msg.body)) return;
19+
20+
const expression = msg.body.replace(prefix, "").trim();
21+
22+
if (!expression) {
23+
await msg.reply(
24+
"Please provide an expression to calculate.\nExample: `calc 5 * (2 + 3)`",
25+
);
26+
return;
27+
}
28+
29+
try {
30+
const result = math.evaluate(expression);
31+
await msg.reply(result);
32+
} catch (err) {
33+
log.error("Calc", err);
34+
await msg.reply("Invalid expression. Please check your syntax.");
35+
}
36+
}

0 commit comments

Comments
 (0)