Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

WhatsApp Web API - TypeScript/JavaScript. ditenagai oleh library: Baileys.

License

NotificationsYou must be signed in to change notification settings

danitechid/wa-web-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

WhatsApp Web API ini ditenagai oleh library: Baileys

Instalasi

Menggunakan Npm

npm i @danitech/wa-web-api

Atau Menggunakan Yarn

yarn add @danitech/wa-web-api

Contoh Kode

./package.json

{"name":"whatsapp-bot","version":"0.0.0","private":true,"main":"index.js","scripts": {"start":"node index.js","dev":"nodemon index.js"  },"dependencies": {"@danitech/wa-web-api":"latest"  },"devDependencies": {"nodemon":"~3.0.1"  }}

./nodemon.json

{"ignore": ["index.js"],"ext":"js"}

./index.js

constwwa=require('@danitech/wa-web-api');constfs=require('fs');constchalk=require('chalk');constconfig=require('./config/settings.js');constclient=require('./includes/client.js');const{  makeWASocket}=wwa;conststartServer=(config,client)=>{returnmakeWASocket(config,client);};startServer(config,client);

./config/settings.js

module.exports={pairing_mode:true,session_folder_name:'session',browser:["Chrome (Linux)"],public_mode:true,prefix:'.',bot:{name:'Bot Name'},owner:{name:'Owner Name',number:'628xxx'}};

./includes/client.js

constchalk=require('chalk');constconfig=require('../config/settings.js');module.exports=async({  client,  messages})=>{try{constbody=messages.mtype==='conversation' ?messages.message.conversation :messages.mtype==='extendedTextMessage' ?messages.message.extendedTextMessage.text :'';constbudy=typeofmessages.text==='string' ?messages.text :'';constcommand=body.startsWith(config.prefix) ?body.replace(config.prefix,'').trim().split(/+/).shift().toLowerCase() :'';constcleanCommand=command.replace(config.prefix,'');constargs=body.trim().split(/+/).slice(1);constquery=q=args.join(' ');constquery1=q1=query.split('|')[0]constquery2=q2=query.split('|')[1]constownerNumbers=config.owner.number;constsenderNumber=messages.sender.replace(/\D/g,'');constsenderName=messages.pushName||'Undefined';constisOwner=ownerNumbers.includes(messages.sender);if(!config.public_mode){if(!messages.key.fromMe){return;};};if(messages.message){client.readMessages([messages.key]);console.log(chalk.bgMagenta(' [New Message] '),chalk.cyanBright('Time: ')+chalk.greenBright(newDate())+'\n',chalk.cyanBright('Message: ')+chalk.greenBright(budy||messages.mtype)+'\n'+chalk.cyanBright('From:'),chalk.greenBright(senderName),chalk.yellow('- '+senderNumber)+'\n'+chalk.cyanBright('Chat Type:'),chalk.greenBright(!messages.isGroup ?'Private Chat' :'Group Chat - '+chalk.yellow(messages.chat)));};if(!body.startsWith(config.prefix)||body===config.prefix){return;};switch(cleanCommand){case'test':{messages.reply('Ok, Success!');break;};default:{messages.reply(`Command:${config.prefix}${cleanCommand}, tidak tersedia!`);};};}catch(error){messages.reply('Terjadi kesalahan pada server.');console.error(error);};};

Contoh kode/skrip bot WhatsApp lengkap

Klik disini untuk mengunduh proyek.

Informasi

  • Pembuat / Pengembang: Dani Ramdani (Dani Techno.) - FullStack Engineer
  • Kontak Pembuat / Pengembang: 0895 1254 5999 (WhatsApp),contact@danitechno.com (Email)

Terimakasih Kepada

  • Dani Techno. - FullStack Engineer (Pembuat / Pengembang)
  • @whiskeysockets/baileys (Penyedia Library "Baileys")

About

WhatsApp Web API - TypeScript/JavaScript. ditenagai oleh library: Baileys.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2026 Movatter.jp