Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.

Commit 72bcae9

Browse files
authored
release(v1.1.0) (#372)
* chore: initial commit * chore: update .gitignore * chore: update README.md * chore(deps): add required dependencies * chore(config): update swcrc config * chore(config): update tsconfig * chore(.vscode/settings): vscode settings * chore(src/listeners): remove dircetory and file * chore(utils/structures): remove Logger and ProjectUtils * chore(src/commands/developer): remove directory * chore(src/commands/general): remove AvatarCommand * chore(src/types): remove enum * chore(types): update typings * chore(config): update environment file * chore(BaseCommand): update BaseCommand * chore(BaseListener): update BaseListener * chore(Whatsappbot): update WhatsappBot * chore(DefaultCommandComponent): update default property * chore(utils/constants): add index.ts * chore(utils/decorators): update ApplyMetadata * chore(utils/decorators): add index.ts * chore(utils/functions): add impotClass * chore(utils/functions): add mergeDefault * chore(utils/functions): add readdirRecursive * chore(utils/functions): add index.ts * chore(utils/structures): update CommandHandler * chore(utils/structures): update ListenerHandler * chore(utils/structures): add index.ts * chore(events): addd connectionUpdateEvent.ts * chore(events): addd credsUpdateEvent.ts * chore(events): addd messageUpsertEvent.ts * chore(commands/general): add HelpCommand.ts * chore(commands/general): add PingCommand.ts * chore(commands/general): add StickerCommand.ts * chore: add directory's root file * fix(mergeDefault): eslint error * fix(StickerCommand): eslint error * chore(config): update default config * chore(env): updata env example * chore(PingCommand): update usage example * chore(StickerCommand): update usage example * chore(WhatsappBot): wrong Logger Level condition
1 parent de79aca commit 72bcae9

36 files changed

+3702
-16977
lines changed

.env_example

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@
22
# IMPORTANT - What is the name of your bot?
33
# Example: BOT_NAME="Clytage Bot"
44
# Default: Clytage Bot
5-
BOT_NAME=""
5+
BOT_NAME="Clytage Bot"
66

77
#==============================================================================
88
# IMPORTANT - What should be the main prefix of your bot?
99
# Example: PREFIX="/"
1010
# Default: /
11-
PREFIX=""
11+
PREFIX="/"
1212

1313
#==============================================================================
1414
# MULTIPLE - What are the IDs (phone number) of the bot developers?
1515
# Example: DEVS="6281234567890, 62813312394852"
1616
DEVS=""
17+
18+
#==============================================================================
19+
# IMPORTANT - What mode should the bot run in?
20+
# Example: MODE="dev"
21+
# Default: dev
22+
# Options: dev, prod
23+
MODE="prod"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,5 @@ dist
104104
**.node-persist**
105105
**_IGNORE_**
106106
# end managed
107+
108+
auth_state

.swcrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"tsx": false,
66
"decorators": true
77
},
8-
"target": "es2021"
8+
"target": "es5"
99
},
1010
"module": {
11-
"type": "es6"
11+
"type": "commonjs"
1212
}
1313
}

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"typescript.tsdk": "node_modules/typescript/lib",
33
"npm.packageManager": "npm",
4-
"files.eol": "\n",
5-
"rpc.enabled": true
4+
"files.eol": "\n"
65
}

package-lock.json

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

package.json

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
{
22
"name": "whatsapp-bot",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "A simple and easy-to-use WhatsApp bot project, written in TypeScript.",
5+
"homepage": "https://github.com/Clytage/whatsapp-bot#readme",
6+
"bugs": {
7+
"url": "https://github.com/Clytage/whatsapp-bot/issues"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/Clytage/whatsapp-bot.git"
12+
},
13+
"license": "BSD-3-Clause",
14+
"author": "Clytage <support@clytage.org>",
515
"main": "dist",
6-
"type": "module",
716
"scripts": {
817
"build": "npm run lint && npm run compile",
918
"compile": "swc src -d dist",
@@ -15,58 +24,48 @@
1524
"start": "node --es-module-specifier-resolution=node -r dotenv/config .",
1625
"start:dev": "rimraf ./dist && npm run build && npm start"
1726
},
18-
"repository": {
19-
"type": "git",
20-
"url": "git+https://github.com/Clytage/whatsapp-bot.git"
21-
},
22-
"author": "Clytage <support@clytage.org>",
23-
"license": "BSD-3-Clause",
24-
"bugs": {
25-
"url": "https://github.com/Clytage/whatsapp-bot/issues"
26-
},
27-
"homepage": "https://github.com/Clytage/whatsapp-bot#readme",
28-
"engines": {
29-
"node": ">=16",
30-
"npm": ">=7"
27+
"prettier": {
28+
"arrowParens": "avoid",
29+
"tabWidth": 4,
30+
"trailingComma": "none"
3131
},
3232
"eslintConfig": {
33-
"extends": [
34-
"@clytage-pkg/eslint-config/typescript",
33+
"parserOptions": {
34+
"project": "./tsconfig.json"
35+
},
36+
"plugins": [
3537
"prettier"
3638
],
37-
"plugins": [
39+
"extends": [
40+
"@clytage-pkg/eslint-config/typescript",
3841
"prettier"
3942
],
40-
"parserOptions": {
41-
"project": "./tsconfig.json"
42-
},
4343
"rules": {
4444
"class-methods-use-this": 0
4545
},
4646
"ignorePatterns": [
4747
"dist/*"
4848
]
4949
},
50-
"prettier": {
51-
"tabWidth": 4,
52-
"trailingComma": "none",
53-
"arrowParens": "avoid"
54-
},
5550
"dependencies": {
51+
"@adiwajshing/baileys": "^4.4.0",
5652
"@discordjs/collection": "1.3.0",
57-
"@sapphire/async-queue": "^1.5.0",
58-
"colorette": "2.0.19",
59-
"dayjs": "1.11.7",
53+
"@hapi/boom": "^10.0.0",
54+
"dayjs": "1.11.6",
6055
"dotenv": "16.0.3",
61-
"got": "^12.5.3",
62-
"tslib": "2.4.1"
56+
"ffmpeg-static": "^5.1.0",
57+
"pino": "^8.7.0",
58+
"pino-pretty": "^9.1.1",
59+
"qrcode-terminal": "^0.12.0",
60+
"sharp": "^0.30.5",
61+
"tslib": "2.4.1",
62+
"wa-sticker-formatter": "^4.3.2"
6363
},
6464
"devDependencies": {
6565
"@clytage-pkg/eslint-config": "1.5.0",
66-
"@open-wa/wa-automate": "^4.52.0",
6766
"@swc/cli": "0.1.57",
6867
"@swc/core": "^1.3.21",
69-
"@types/node": "18.11.11",
68+
"@types/node": "18.11.10",
7069
"@typescript-eslint/eslint-plugin": "5.44.0",
7170
"@typescript-eslint/parser": "5.44.0",
7271
"eslint": "^8.28.0",
@@ -76,5 +75,9 @@
7675
"rimraf": "3.0.2",
7776
"ts-node": "10.9.1",
7877
"typescript": "4.9.3"
78+
},
79+
"engines": {
80+
"node": ">=16",
81+
"npm": ">=7"
7982
}
8083
}

src/commands/developer/EvalCommand.ts

Lines changed: 0 additions & 83 deletions
This file was deleted.

src/commands/general/AvatarCommand.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
1-
import { ApplyMetadata } from "../../utils/decorators/ApplyMetadata";
1+
import { proto } from "@adiwajshing/baileys";
22
import { BaseCommand } from "../../structures/BaseCommand";
33
import { ICommandComponent } from "../../types";
4-
import { Message } from "@open-wa/wa-automate";
4+
import { ApplyMetadata } from "../../utils/decorators";
55

66
@ApplyMetadata<ICommandComponent>({
77
name: "help",
8-
description: "Display help message.",
9-
usage: "help [command]"
8+
aliases: ["h", "?"],
9+
description: "Get help with the bot",
10+
usage: "{PREFIX}help [command]"
1011
})
1112
export default class HelpCommand extends BaseCommand {
12-
public async execute(message: Message, args: string[]): Promise<void> {
13+
public async executeCommand(
14+
args: string[],
15+
data: proto.IWebMessageInfo
16+
): Promise<void> {
1317
if (args[0]) {
1418
const command =
15-
this.whatsappbot.commands.get(args[0]) ??
16-
this.whatsappbot.commands.get(
17-
this.whatsappbot.commands.aliases.get(args[0]) ?? ""
19+
this.client.commandHandler.get(args[0]) ??
20+
this.client.commandHandler.get(
21+
this.client.commandHandler.aliases.get(args[0]) ?? ""
1822
);
19-
2023
if (!command) {
21-
await this.whatsappbot.client.sendText(
22-
message.chatId,
23-
"Command not found."
24-
);
24+
await this.client.socket?.sendMessage(data.key.remoteJid!, {
25+
text: "Command not found"
26+
});
2527
return undefined;
2628
}
27-
28-
await this.whatsappbot.client.sendText(
29-
message.chatId,
30-
`*${this.whatsappbot.config.botName}* - ${
29+
await this.client.socket?.sendMessage(data.key.remoteJid!, {
30+
text: `*${this.client.config.botName}* - ${
3131
command.meta.name
32-
}\n\n${command.meta.description!}\nUsage: ${
33-
this.whatsappbot.config.prefix
34-
}${command.meta.usage!}`
35-
);
32+
}\n\n${command.meta
33+
.description!}\nUsage: ${command.meta.usage!.replace(
34+
"{PREFIX}",
35+
this.client.config.prefix
36+
)}`
37+
});
3638
} else {
3739
let commmandList = "";
38-
Object.values(this.whatsappbot.commands.categories)
40+
Object.values(this.client.commandHandler.categories)
3941
.map(commands => commands!.filter(Boolean))
4042
.sort((a, b) =>
4143
a[0].meta.category!.localeCompare(
@@ -49,12 +51,11 @@ export default class HelpCommand extends BaseCommand {
4951
.map(commands => {
5052
const category = commands[0].meta.category!;
5153
const cmds = commands.map(cmd => cmd.meta.name).join(", ");
52-
commmandList += `*${category.toUpperCase()}*\n${cmds}\n`;
54+
commmandList += `*${category.toUpperCase()}*\n\`\`\`${cmds}\`\`\`\n`;
5355
});
54-
await this.whatsappbot.client.sendText(
55-
message.chatId,
56-
`*${this.whatsappbot.config.botName}* - Command List\n\n${commmandList}`
57-
);
56+
await this.client.socket?.sendMessage(data.key.remoteJid!, {
57+
text: `*${this.client.config.botName}* - Command List\n\n${commmandList}`
58+
});
5859
}
5960
}
6061
}

0 commit comments

Comments
 (0)