齐克科莫
用于与WhatsApp Web互动的 WebSockets 库, 维护在 齐克科莫 商标. 这个项目是一个叉子 建造在顶部 贝利 由WhiskeySockets所著.
最近报告: @cikikomo/[email protected] ——对接线从 1.0.3/1.0.9 (中文(简体) ) (未更改),USync / no SelfSync,LID摘录 DeviceJids, luxu no SelfSync (1.0.11语法修饰).
包括USync设备解析+ assertSessions 这样你就可以 发送而不进行先前的聊天, (中文(简体) ),
财务报告和审定财务报表 noSelfSync 改为 发送时未在您自己的设备上显示信件。 。 。 .
安装
从 npm( 建议):
npm install @cikikomo/[email protected]
或者在原包名上用别名来表示,这样现有的进口继续工作:
"dependencies": {
"@whiskeysockets/baileys": "npm:@cikikomo/[email protected]"
}
从 GitHub :
npm install github:aryoagung321-sudo/bilys
导入
const {
default: makeWASocket,
// other exports
} = require('@cikikomo/baileys');
正在连接到 WhatsApp
使用 QR 代码
const {
default: makeWASocket,
Browsers
} = require('@cikikomo/baileys');
const client = makeWASocket({
browser: Browsers.cikikomo('Chrome'),
printQRInTerminal: true
});
用对等码连接
const {
default: makeWASocket,
fetchLatestWAWebVersion,
Browsers
} = require('@cikikomo/baileys');
const client = makeWASocket({
browser: Browsers.cikikomo('Chrome'),
printQRInTerminal: false,
version: await fetchLatestWAWebVersion(),
aiLabel: false // set true to show an AI label on messages sent by the bot
// other options
});
const number = "628XXXXXXXXXX";
const code = await client.requestPairingCode(number.trim()); // or (number, "YYYYYYYY") for a custom pairing code
console.log("Your pairing code: " + code);
存储数据
const {
default: makeWASocket,
makeInMemoryStore
} = require('@cikikomo/baileys');
const pino = require('pino');
const store = makeInMemoryStore({
logger: pino().child({ level: 'silent', stream: 'store' })
});
const client = makeWASocket({
// options
});
store.bind(client.ev);
client.ev.on('contacts.upsert', () => {
console.log('New contact: ' + Object.values(store.contacts()));
});
发送信件
用 noSelfSync
noSelfSync 是用于 sendMessage 编号 : relayMessage (仅限私人/1-on-1聊天).
它控制信件是否同步到 您自己的链接设备 (电话/其他)
同一账户上的WhatsApp Web会话). 交付给接受方的货款不变.
noSelfSync: true——消息传递给接收者,但确实 没有 显示在您自己的设备上.noSelfSync: false(default)——正常行为;消息也被同步到自己的设备上.
// Cara pakai: kirim tanpa muncul di device lu
await client.sendMessage(m.chat, {
text: "Hello"
}, {
noSelfSync: true
})
// Default: muncul juga di device lu
await client.sendMessage(m.chat, {
text: "Hello"
}, {
noSelfSync: false
})
// Sama via relayMessage
await client.relayMessage(m.chat, {
conversation: "Hello"
}, {
noSelfSync: true
})
发送命令
const fs = require('fs');
const thumbnail = fs.readFileSync('./pouthumb.jpg');
await client.sendMessage(m.chat, {
thumbnail,
message: "Order summary",
orderTitle: "My Store",
totalAmount1000: 72502,
totalCurrencyCode: "IDR"
}, { quoted: m });
发送民意调查
await client.sendMessage(m.chat, {
pollResultMessage: {
name: "My Poll",
options: [
{ optionName: "Option 1" },
{ optionName: "Option 2" }
],
newsletter: {
newsletterName: "CikiKomo",
newsletterJid: "120363426628484388@newsletter"
}
}
});
发送产品信息
await client.relayMessage(m.chat, {
productMessage: {
title: "Product.pdf",
description: "Product description",
thumbnail: { url: "./pouthumb.jpg" },
productId: "EXAMPLE_TOKEN",
retailerId: "EXAMPLE_RETAILER_ID",
url: "https://example.com",
body: "Body text",
footer: "Footer",
buttons: [
{
name: "cta_url",
buttonParamsJson: "{\"display_text\":\"Visit\",\"url\":\"https://example.com\"}"
}
],
priceAmount1000: 72502,
currencyCode: "IDR"
}
});
发送交互式消息
await client.sendMessage(m.chat, {
image: { url: "./pouimg.jpg" },
text: "body",
title: "title", // required when sending media
footer: "footer",
interactiveButtons: [
{
name: "single_select",
buttonParamsJson: JSON.stringify({
title: "\0"
})
}
],
messageParams: JSON.stringify({
bottom_sheet: {
/** other params **/
}
})
});
发送成员标签
await client.sendMessage(m.chat, {
groupLabel: {
labelText: "Tagged members appear here"
}
});
向组成员发送消息
await client.sendMessageMembers(m.chat, {
extendedTextMessage: {
text: "Hello members"
}
}, {});
简单发送
发送文本
await client.sendText(m.chat, "Hello!", {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
发送图像
await client.sendImage(m.chat, { url: "./pouimg.jpg" }, "Caption", {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
发送视频
await client.sendVideo(m.chat, { url: "./video.mp4" }, "Caption", {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
发送音频
await client.sendAudio(m.chat, { url: "./pouaudio.mp3" }, {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
发送位置
await client.sendLocation(m.chat, "Caption", 90.0, 90.0, "https://example.com", "1234567890", {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
发送民意调查
await client.sendPoll(m.chat, "Pick one", ["1", "2", "3"], true, {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
发送问答
await client.sendQuiz(m.chat, "Quiz question", ["1", "2", "3"], "2", {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
发送状态
await client.statusMention(m.chat, {
extendedTextMessage: {
text: "Mentioned in status"
}
});
贷项
奇克科莫是一个叉子 贝利,最初由 阿迪拉吉·辛格 由惠克索克特社区负责维护. 执行基本协议的所有功劳都归功于原始作者和贡献者. 见 自由主义 对许可证全文和版权通知.
捐款
见 捐款额 关于报告问题和提交牵引请求的准则.
免责声明
这是 没有 一个官方WhatsApp产品。 使用此库发送批量或非请求发送的信息 可能会违反WhatsApp的服役条款,并可能导致你的号码被禁. 负责任地使用.