Skip to content

Commit 001422f

Browse files
committed
bug fixes and improvements
1 parent e35bf61 commit 001422f

13 files changed

Lines changed: 159 additions & 93 deletions

File tree

src/commands/docker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ export default async function (msg: Message) {
5252
}
5353
const repo = response.data;
5454
const info = `
55-
*${repo.name}*
55+
\`${repo.name}\`
5656
${repo.description || ""}
5757
58-
- Stars: ${repo.star_count}
59-
- Pulls: ${repo.pull_count}
60-
- Last Updated: ${new Date(repo.last_updated).toLocaleDateString()}
61-
- Link: https://hub.docker.com/r/${repo.namespace}/${repo.name}
58+
Stars: ${repo.star_count}
59+
Pulls: ${repo.pull_count}
60+
Last Updated: ${new Date(repo.last_updated).toLocaleDateString()}
61+
Link: https://hub.docker.com/r/${repo.namespace}/${repo.name}
6262
`;
6363
await msg.reply(info);
6464
})

src/commands/github.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ export default async function (msg: Message) {
3030
.then(async (response) => {
3131
const user = response.data;
3232
const info = `
33-
*${user.name || user.login}*
33+
\`${user.name || user.login}\
3434
${user.bio || ""}
3535
36-
- Place: ${user.location || "N/A"}
37-
- Followers: ${user.followers}
38-
- Following: ${user.following}
39-
- Gists: ${user.public_gists}
40-
- Repo: ${user.public_repos}
41-
- X: ${
36+
Place: ${user.location || "N/A"}
37+
Followers: ${user.followers}
38+
Following: ${user.following}
39+
Gists: ${user.public_gists}
40+
Repo: ${user.public_repos}
41+
X: ${
4242
user.twitter_username
4343
? `https://twitter.com/${user.twitter_username}`
4444
: "N/A"
4545
}
46-
- Link: ${user.blog || "N/A"}
46+
Link: ${user.blog || "N/A"}
4747
`;
4848

4949
await msg.reply(info);

src/commands/huggingface.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ export default async function (msg: Message) {
2727
}
2828
const models = response.data[0];
2929
const info = `
30-
*${models.modelId}*
30+
\`${models.modelId}\`
3131
${models.tags.splice(0, 5).join(", ") || "N/A"}
3232
33-
*Library:* ${models.library_name}
34-
*Pipeline:* ${models.pipeline_tag}
35-
*Likes:* ${models.likes}
36-
*Downloads:* ${models.downloads}
37-
*Created At:* ${new Date(models.createdAt).toLocaleString()}
38-
*Private:* ${models.private ? "Yes" : "No"}
39-
*Model URL:* https://huggingface.co/${models.modelId}
33+
Library: ${models.library_name}
34+
Pipeline: ${models.pipeline_tag}
35+
Likes: ${models.likes}
36+
Downloads: ${models.downloads}
37+
Created At: ${new Date(models.createdAt).toLocaleString()}
38+
Private: ${models.private ? "Yes" : "No"}
39+
Model URL: https://huggingface.co/${models.modelId}
4040
`;
4141
await msg.reply(info);
4242
})

src/commands/npm.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ export default async function (msg: Message) {
6363
}
6464

6565
const repo = `
66-
*${name}* (v${version})
66+
\`${name}* (v${version})\`
6767
${description}
6868
69-
- Author: ${author}
70-
- License: ${license}
71-
- Homepage: ${homepage}
72-
- Repository: ${repository}
73-
- Last Published: ${formattedPublished}
69+
Author: ${author}
70+
License: ${license}
71+
Homepage: ${homepage}
72+
Repository: ${repository}
73+
Last Published: ${formattedPublished}
7474
`;
7575

7676
await msg.reply(repo);

src/commands/quiz.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ export default async function (msg: Message) {
1616
const response = quiz[Math.floor(Math.random() * quiz.length)];
1717
if (response.length === 0)
1818
return await msg.reply("I don't have any quiz questions right now...");
19-
const text = `
20-
${response.question}
19+
let text = `
20+
\`${response.question}\`
21+
`;
2122

23+
if (response.choices && response.choices.length > 0) {
24+
text += `
2225
*Options:*
2326
${response.choices
2427
.map((choice: string, index: number) => `${index + 1}. ${choice}`)
2528
.join("\n ")}
26-
`;
29+
`;
30+
}
31+
2732
await msg.reply(text);
2833
}

src/commands/randomcolor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export default async function (msg: Message) {
2222
const image = response.data.image;
2323

2424
const color = `
25-
*${name}*
26-
\`${hex}\`
25+
\`${name}\`
26+
${hex}
2727
`;
2828
await msg.reply(color);
2929
})

src/commands/repo.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ export default async function (msg: Message) {
2727
}
2828
const repo = response.data;
2929
const info = `
30-
*${repo.name}*
30+
\`${repo.name}\`
3131
${repo.description.substring(0, 100) || "No description available."}
3232
33-
*Stars:* ${repo.stargazers_count}
34-
*Forks:* ${repo.forks_count}
35-
*Open Issues:* ${repo.open_issues_count}
36-
*Watchers:* ${repo.watchers_count}
37-
*Stargazers:* ${repo.stargazers_count}
38-
*License:* ${repo.license ? repo.license.name : "N/A"}
39-
*Is Fork:* ${repo.fork ? "Yes" : "No"}
40-
*Allow Forking:* ${repo.allow_forking ? "Yes" : "No"}
41-
*Language:* ${repo.language || "N/A"}
42-
*Created At:* ${new Date(repo.created_at).toLocaleDateString()}
43-
*Updated At:* ${new Date(repo.updated_at).toLocaleDateString()}
33+
Stars: ${repo.stargazers_count}
34+
Forks: ${repo.forks_count}
35+
Open Issues: ${repo.open_issues_count}
36+
Watchers: ${repo.watchers_count}
37+
Stargazers: ${repo.stargazers_count}
38+
License: ${repo.license ? repo.license.name : "N/A"}
39+
Is Fork: ${repo.fork ? "Yes" : "No"}
40+
Allow Forking: ${repo.allow_forking ? "Yes" : "No"}
41+
Language: ${repo.language || "N/A"}
42+
Created At: ${new Date(repo.created_at).toLocaleDateString()}
43+
Updated At: ${new Date(repo.updated_at).toLocaleDateString()}
4444
`;
4545
await msg.reply(info);
4646
})

src/commands/stalk.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { Message } from "whatsapp-web.js";
2+
import { getUserbyLid } from "../components/services/user";
3+
4+
export const info = {
5+
command: "stalk",
6+
description: "Stalk a user (not allowed).",
7+
usage: "stalk",
8+
example: "stalk @user",
9+
role: "user",
10+
cooldown: 5000,
11+
};
12+
13+
export default async function (msg: Message) {
14+
if (msg.body.includes(" ") && msg.mentionedIds.length === 0) {
15+
await msg.reply("Please mention a user to stalk.");
16+
return;
17+
}
18+
19+
if (msg.mentionedIds.length === 0) {
20+
const contact = await msg.getContact();
21+
const countryCode = await contact.getCountryCode();
22+
const about = await contact.getAbout();
23+
const name = contact.pushname || contact.name || "Unknown";
24+
25+
const text = `
26+
\`${name}\`
27+
${about || "No about information available."}
28+
29+
ID: ${contact.id.user}
30+
Number: ${contact.number}
31+
Country Code: ${countryCode}
32+
Type: ${contact.isBusiness ? "Business" : "Personal"}
33+
Mode: ${msg.author ? "group" : "private"}
34+
`;
35+
await msg.reply(text);
36+
return;
37+
}
38+
39+
const user = await getUserbyLid(msg.mentionedIds[0].split("@")[0]);
40+
if (!user) return await msg.reply("User not found.");
41+
42+
const text = `
43+
\`${user.name}\`
44+
${user.about || "No about information available."}
45+
46+
ID: ${user.lid}
47+
Number: ${user.number}
48+
Country Code: ${user.countryCode}
49+
Type: ${user.type}
50+
Mode: ${user.mode}
51+
Command Count: ${user.commandCount}
52+
`;
53+
await msg.reply(text);
54+
}

src/commands/stats.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@ export default async function (msg: Message) {
3434
]);
3535

3636
const statsMessage = `
37-
*System Stats*
37+
\`System Monitor\`
3838
39-
- OS: ${osInfo.distro} ${osInfo.kernel}
40-
- CPU: ${stats.cpu[0].model}
41-
- GPU: ${gpuInfo.controllers.map((c) => c.model).join(", ")}
42-
- RAM: ${(stats.usedMemory / 1024 ** 3).toFixed(2)} GB / ${(
39+
OS: ${osInfo.distro} ${osInfo.kernel}
40+
CPU: ${stats.cpu[0].model}
41+
GPU: ${gpuInfo.controllers.map((c) => c.model).join(", ")}
42+
RAM: ${(stats.usedMemory / 1024 ** 3).toFixed(2)} GB / ${(
4343
stats.totalMemory /
4444
1024 ** 3
4545
).toFixed(2)} GB
46-
- VRam: ${gpuInfo.controllers.map((c) => c.vram).join(", ")} MB
47-
- Load Avg: ${os
46+
VRam: ${gpuInfo.controllers.map((c) => c.vram).join(", ")} MB
47+
Load Avg: ${os
4848
.loadavg()
4949
.map((n) => n.toFixed(2))
5050
.join(", ")}
51-
- Process: #${process.pid} ${process.title}
52-
- Shell: ${shell}
53-
- Network: ${networkInterfaces
51+
Process: #${process.pid} ${process.title}
52+
Shell: ${shell}
53+
Network: ${networkInterfaces
5454
.map((iface) => `${iface.iface} ${iface.speed} Mbps`)
5555
.join(", ")}
56-
- Node.js: ${process.version}
57-
- Users: ${userCount}
58-
- Blocked Users: ${blockUserCount}
56+
Node.js: ${process.version}
57+
Users: ${userCount}
58+
Blocked Users: ${blockUserCount}
5959
`;
6060

6161
await msg.reply(statsMessage);

src/commands/uptime.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ export const info = {
1414

1515
export default async function (msg: Message) {
1616
if (!/^uptime\b/i.test(msg.body)) return;
17-
17+
1818
const uptimeMinutes = Math.floor(process.uptime() / 60);
1919
const statsMessage = `
20-
*${uptimeMinutes} minutes*
21-
#${process.pid}
20+
\`${uptimeMinutes} minutes\`
21+
22+
Process ID:#${process.pid}
2223
`;
2324

2425
await msg.reply(statsMessage);

0 commit comments

Comments
 (0)