Zeid Bot là một chatbot Zalo được phát triển bằng Node.js, dựa trên thư viện ZCA-JS
Nhóm Zalo giao lưu, hỗ trợ: https://zalo.me/g/xwxdtp685
Important
🚧 Zeid Bot hiện đang trong quá trình phát triển.
Nếu bạn gặp bất kỳ sự cố, lỗi hoặc vấn đề nào trong quá trình sử dụng,
hãy đóng góp bằng cách báo lỗi hoặc gửi pull request.
💡 Chúng tôi luôn hoan nghênh mọi sự hỗ trợ từ cộng đồng!
📚 Xem tài liệu API tại: https://tdung.gitbook.io/zca-js
📚 Tải liệu Plugins
📁 Sự kiện mẫu
module.exports.config = {
name: "example", // Tên của sự kiện
event_type: ["message"], // Loại event, có thể nhận nhiều event 1 lúc
version: "1.0.0", // Phiên bản của sự kiện
author: "ShinTHL09 ", // Tác giả của sự kiện
description: "Sự kiện mẫu", // Thông tin sự kiện
dependencies: {} // Các thư viện cần thiết (Bot sẽ tự cài khi load sự kiện)
};
module.exports.onLoad = async function({ api, Users, Threads }) {
console.log("Sự kiện example đã được load");
}
// Bot nhại tin nhắn
module.exports.run = async function({ api, event, eventType, Users, Threads, replyData }) {
const { threaId, type, data } = event;
const msg = data.content;
return api.sendMessage(msg, threaId, type);
};
// Bot nhại tin nhắn có reply
module.exports.run = async function({ api, event, eventType, Users, Threads, replyData }) {
const { threaId, type, data } = event;
const msg = data.content;
return api.sendMessage({ msg, quote: replyData }, threaId, type);
};📁 Lệnh mẫu mẫu
module.exports.config = {
name: 'example', // Tên của lệnh
version: '1.0.0', // Phiên bản của lệnh
role: 0, // Quyền hạn 0: thành viên, 1: support bot, 2: admin bot
author: 'ShinTHL09', // Tác giả của lệnh
description: 'Lệnh mẫu', // Thông tin lệnh
category: 'Tiện ích', // Mục của lệnh
usage: 'restart', // Cách dùng lệnh
cooldowns: 2, // Thời gian hồi lệnh
dependencies: {} // Các thư viện cần thiết (Bot sẽ tự cài khi load lệnh)
};
module.exports.onLoad = async ({ api, Users, Threads }) => {
console.log("Lệnh example đã được load")
}
module.exports.handleEvent = async ({ api, event, eventType, Users, Threads, replyData }) => {
console.log("đã có event xảy ra");
}
// lệnh mẫu
module.exports.run = async ({ args, event, api, Users, Thread }) => {
const { threadId, type } = event;
return api.sendMessage("Đây là lệnh mẫu", threadId, type);
};
// lệnh mẫu có reply tin nhắn
module.exports.run = async ({ args, event, api, Users, Thread }) => {
const { threadId, type } = event;
return api.sendMessage({ msg: "Đây là lệnh mẫu", quote: replyData }, threadId, type);
};📁 Các hàm để xử lí media
const { processVideo, processAudio } = require("../../utils/index");
processVideo(videoPath, threadId, type); // Xử lí video
processAudio(audioPath, threadId, type); // Xử lí audio📁 Các biến global
global.client.config // Config bot
global.client.config.prefix // Prefix hiện tại
global.client.commands // Tất cả command
global.client.commands.get("example").config.author // lấy author của lệnh example
global.client.events // Tất cả event
global.client.events.get("example").config.author // lấy author của lệnh example
global.users.admin[0] // ID admin đầu tiên
global.users.support[0] // ID support đầu tiên📁 Các hàm để cập nhật config
const { updateConfigArray, updateConfigValue, reloadConfig } = require("../../utils/index");
updateConfigArray(key, newArray); // Sửa array trong config
// Example: updateConfigArray("admin_bot", ["1", "2"])
updateConfigValue(key, newValue); // Sửa giá trị trong config
// Example: updateConfigValue("prefix", "!")
reloadConfig();
// Reload lại file config🗃️ Database (Users & Threads)
🧵 Threads
await Thread.getData("id_box"); // Lấy dữ liệu
await Thread.setData("id_box", data_json); // Lưu dữ liệu
await Thread.getAll(); // Lấy tất cả dữ liệu
// Ví dụ
const databox = (await Thread.getData("id_box")).data;
databox.prefix = "!";
await Thread.setData("id_box", databox);👤 Users
await Users.getData("user_id"); // Lấy dữ liệu
await Users.setData("user_id", data_json); // Lưu dữ liệu
await Users.getAll(); // Lấy tất cả dữ liệu
// Ví dụ
const datauser = (await Users.getData("user_id")).data;
datauser.money = 1000;
await Users.setData("user_id", datauser);-
Node.js phiên bản v20 trở lên
-
Khi sử dụng hệ điều hành Windowns bạn cần phải cài các font trong plugins/cache/... để có font chữ cho canvas
git clone https://github.com/Shinchan0911/Zeid_Bot
cd zeid-bot
npm install- Chạy bot bằng lệnh:
npm start
- Mở file
qr.pngđược tạo trong thư mục bot và quét mã bằng ứng dụng Zalo - Sau khi đăng nhập thành công, bot sẽ tự động lưu cookie cho những lần đăng nhập tiếp theo
📘 Xem tài liệu chi tiết tại:
👉 https://tdung.gitbook.io/zca-js/dang-nhap/dang-nhap-voi-qrcode
-
Tạo file
account.jsonvới nội dung:{ "imei": "Imei_Cua_Ban", "userAgent": "userAgent_Cua_Ban", "cookie": "cookie.json" } -
Thay thế các giá trị
imei,userAgent -
Tạo file
cookie.jsonvà dán nội dung cookie Zalo vào -
Chạy bot bằng lệnh:
npm start
📘 Có thể dùng công cụ ZaloDataExtractor để lấy imei userAgent cookie:
👉 https://github.com/JustKemForFun/ZaloDataExtractor/
📘 Xem hướng dẫn chi tiết cách lấy cookie tại:
👉 https://tdung.gitbook.io/zca-js/dang-nhap/dang-nhap-voi-cookie
Phát hành theo giấy phép MIT License