Skip to content

Commit

Permalink
Update 1.2.0
Browse files Browse the repository at this point in the history
Update 1.2.0
  • Loading branch information
resahdevv committed Oct 31, 2023
1 parent b8f7784 commit 0576527
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 22 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#table-of-contents)
# Push Kontak

***Push Kontak dibuat dengan nodejs menggunakan library [Bailyes](https://github.com/adiwajshing/Baileys)***
***Push Kontak dibuat dengan nodejs menggunakan library [Bailyes](https://github.com/WhiskeySockets/Baileys)***

<p align="center">
<img width="" src="https://img.shields.io/github/repo-size/resahdevv/Push-Kontak?color=green&label=Repo%20Size&style=for-the-badge&logo=appveyor">
</p>

## Baca Dulu Mas Mba
Hanya terdapat dua feature yakni ```.pushkontak [text]``` & ```.pushid idgc|pesannya```<br>
Example: ```.pushkontak save rezadevv``` | ```.pushid idgc|pesannya``` Sangat cocok digunakan untuk keperluan JB
╭──❒ <b>All MENU BOT</b><br>
├• 📌 #pushkontak [text]<br>
├• 📌 #pushid [idgroup]|[text]<br>
├• 📌 #savekontak [idgroup]<br>
├• 📌 #getidgc<br>
└────────────><br>
> Untuk mendapatkan <b>idgroup</b> kirim pesan <b>#getidgc</b> pastikan anda telah masuk ke group target agar anda dapat mengirim pesan keseluruh member group. Import file yang dihasilkan dari <b>#savekontak [idgroup]</b> untuk menyimpan kontak.



## Catatan
> **Warning**: Script ini open source serta gratis. Dilarang memperjual belikan!
Expand Down Expand Up @@ -37,7 +45,7 @@ global.versionbot = "1.0.0";
```bash
$ git clone https://github.com/resahdevv/Push-Kontak.git
$ cd Push-Kontak
$ yarn
$ npm install
$ npm start
```

Expand All @@ -47,7 +55,7 @@ $ npm start
* Kontak Pembelian [`Klik Disini`](https://wa.me/+6285742632270)

```bash
$ yarn
$ npm install
$ npm start
```
## FOR TERMUX/UBUNTU/SSH USER
Expand All @@ -56,20 +64,12 @@ $ npm start
$ apt update && apt upgrade
$ apt install git -y
$ apt install nodejs -y
$ apt install ffmpeg -y
$ git clone https://github.com/resahdevv/WhatsApp-Ai.git
$ cd WhatsApp-Ai
$ yarn
$ git clone https://github.com/resahdevv/Push-Kontak.git
$ cd Push-Kontak
$ npm install
$ npm start
```

## RECOMMENDED INSTALL ON TERMUX

```bash
$ pkg install yarn
$ yarn
```

## Thanks To
* [`ResahDevv`](https://github.com/resahdevv)

Expand Down
1 change: 1 addition & 0 deletions data/kontak.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Empty file added data/kontak.vcf
Empty file.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const {
jidDecode,
proto,
getContentType,
Browsers,
} = require("@adiwajshing/baileys");
const pino = require("pino");
const { Boom } = require("@hapi/boom");
Expand Down Expand Up @@ -156,7 +157,7 @@ async function startEza() {
const client = EzaConnect({
logger: pino({ level: "silent" }),
printQRInTerminal: true,
browser: ["Push-Kontak", "Chrome", "1.0.0"],
browser: Browsers.macOS('Desktop'),
patchMessageBeforeSending: (message) => {
const requiresPatch = !!(
message.buttonsMessage
Expand Down Expand Up @@ -303,10 +304,11 @@ async function startEza() {
startEza();
}
} else if (connection === "open") {
const botNumber = await client.decodeJid(client.user.id);
console.log(color("Created By RezaDevv", "green"));
console.log(color("Don't Forget Smile :)", "yellow"));
console.log(color("Type .pushkontak for kontak in group"));
client.sendMessage(owner + "@s.whatsapp.net", { text: `*── 「 DETAIL CONFIGURASI 」 ──*\n\n*_Owner:_* _${owner}_\n*_Author:_* _${author}_\n*_Session:_* _${sessionName}_\n*_Version:_* _${versionbot}_` });
client.sendMessage(`${owner}@s.whatsapp.net`, { text: `*── 「 DETAIL CONFIGURASI 」 ──*\n\n*_Owner:_* _${owner}_\n*_Author:_* _${author}_\n*_Session:_* _${sessionName}_\n*_Version:_* _${versionbot}_\n\n*_${botNumber}_*` });
}
// console.log('Connected...', update)
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Push-Kontak",
"version": "1.0.0",
"version": "1.2.0",
"description": "WhatsApp Bot Push Kontak Using Lib Baileys Multi Device",
"main": "index.js",
"type": "commonjs",
Expand All @@ -22,7 +22,7 @@
"author": "RezaDevv",
"license": "MIT",
"dependencies": {
"@adiwajshing/baileys": "npm:baileys-md@^5.0.5",
"@adiwajshing/baileys": "github:WhiskeySockets/Baileys",
"@adiwajshing/keyed-db": "^0.2.4",
"@hapi/boom": "^10.0.0",
"awesome-phonenumber": "^2.64.0",
Expand Down
2 changes: 2 additions & 0 deletions setting/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ global.sessionName = "Bot-Session";
global.versionbot = "1.0.0";
global.mess = {
wait: "Loading...",
success: "Operation Sucessfull!",
owner: "Fitur Khusus Owner Bot",
waitdata: "Melihat Data Terkini...",
admin: "Fitur Khusus Admin Group!",
private: "Fitur Khusus Private Chat!",
group: "Fitur Digunakan Hanya Untuk Group!",
botAdmin: "Bot Harus Menjadi Admin Terlebih Dahulu!",
};
Expand Down
65 changes: 63 additions & 2 deletions setting/mechaine.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const { BufferJSON, WA_DEFAULT_EPHEMERAL, generateWAMessageFromContent, proto, g
const fs = require("fs");
const util = require("util");
const chalk = require("chalk");
const crypto = require("crypto")
const { platform } = require("process");

const getGroupAdmins = (participants) => {
Expand All @@ -17,6 +18,11 @@ const getGroupAdmins = (participants) => {
}
return admins || []
}
const contacts = JSON.parse(fs.readFileSync("./data/kontak.json"))

const createSerial = (size) => {
return crypto.randomBytes(size).toString('hex').slice(0, size)
}

require("./config");
module.exports = rezadevv = async (client, m, chatUpdate, store) => {
Expand Down Expand Up @@ -57,6 +63,7 @@ module.exports = rezadevv = async (client, m, chatUpdate, store) => {
const reply = m.reply;
const sender = m.sender;
const mek = chatUpdate.messages[0];
const isContacts = contacts.includes(sender)

const color = (text, color) => {
return !color ? chalk.green(text) : chalk.keyword(color)(text);
Expand Down Expand Up @@ -89,8 +96,20 @@ module.exports = rezadevv = async (client, m, chatUpdate, store) => {

if (isCmd2) {
switch (command) {
case "menu" : case "help" : {
const reactionMessage = {
react: {
text: "🕓", // use an empty string to remove the reaction
key: m.key
}
}
await client.sendMessage(sender, reactionMessage);
text = `╭──❒ *All MENU BOT*\n├• 📌 ${prefix}pushkontak [text]\n├• 📌 ${prefix}pushid [idgroup]|[text]\n├• 📌 ${prefix}savekontak [idgroup]\n├• 📌 ${prefix}getidgc\n└────────────>`
client.sendText(from, text, m)
}
break;
case "pushkontak" : {
if (!text) return m.reply(`Example ${prefix}${command} Hi Semuanya`)
if (!text) return m.reply(`Example ${prefix}${command} Hello`)
if (!isCreator) return m.reply(mess.owner)
if (!m.isGroup) return m.reply(mess.group)
if (!isBotAdmins) return m.reply(mess.botAdmin)
Expand Down Expand Up @@ -131,7 +150,49 @@ module.exports = rezadevv = async (client, m, chatUpdate, store) => {
}
}, i * 6000);
}
}
}
break;
case "savekontak" : {
if (!isCreator) return m.reply(mess.owner)
if (m.isGroup) return reply(mess.private)
if (!text) return reply(`Exampale: ${prefix + command} idgroup`)
const groupMetadataa = !m.isGroup? await client.groupMetadata(`${text}`).catch(e => {reply(e)}) : ""
const participants = !m.isGroup? await groupMetadataa.participants : ""
const getdata = await participants.filter(v => v.id.endsWith('.net')).map(v => v.id)
reply(mess.wait)
for (let member of getdata) {
if (isContacts) return
contacts.push(member)
fs.writeFileSync('./data/kontak.json', JSON.stringify(contacts))
} try {
const uniqueContacts = [...new Set(contacts)];
const vcardContent = uniqueContacts.map((contact) => {
const vcard = [
"BEGIN:VCARD",
"VERSION:3.0",
`FN:WA[${createSerial(2)}] ${contact.split("@")[0]}`,
`TEL;type=CELL;type=VOICE;waid=${contact.split("@")[0]}:+${contact.split("@")[0]}`,
"END:VCARD",
"",
].join("\n");
return vcard;
}).join("");
fs.writeFileSync("./data/kontak.vcf", vcardContent, "utf8");
} catch (err) {
reply(util.format(err))
} finally {
await client.sendMessage(from, { document: fs.readFileSync("./data/kontak.vcf"), fileName: "contacts.vcf", caption: `_*${mess.success}*_\n\n_Group:_ *_${groupMetadataa.subject}_*`, mimetype: "text/vcard", }, { quoted: m })
fs.writeFileSync("./data/kontak.vcf", "");
contacts.splice(0, contacts.length)
fs.writeFileSync("./data/kontak.json", JSON.stringify(contacts))
}
}
break;
case "getidgc" : {
if (!isCreator) return reply(mess.owner)
if (!m.isGroup) return reply(mess.group)
reply(from)
}
break;
default: {
if (isCmd2 && budy.toLowerCase() != undefined) {
Expand Down

3 comments on commit 0576527

@Tegar12309
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#19

@Tegar12309
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#18

@izz4you
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ git clone https://github.com/resahdevv/Push-Kontak.git$ cd Push-Kontak$ yarn$ npm install$ npm start```

Please sign in to comment.