bot whatsapp #111
ramapoltek
started this conversation in
My Projects
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
const express = require('express');
const qrcode = require('qrcode-terminal');
const { Client, LocalAuth } = require('whatsapp-web.js');
const axios = require('axios');
require("dotenv").config();
const app = express();
const port = process.env.PORT || 3000;
const client = new Client({
authStrategy: new LocalAuth({ clientId: 'Rcode-ai' }),
});
client.on('qr', qr => qrcode.generate(qr, { small: true }));
client.on('authenticated', () => console.log('Client is authenticated!'));
client.on('ready', () => console.log('Client is ready!'));
const getOllamaChatCompletion = async (messageFromUser ) => {
try {
const response = await axios.post('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', {
model: "deepseek-r1:1.5b",
messages: [
{ role: "user", content: messageFromUser },
],
stream: false,
});
};
client.on('message', async message => {
const messageBody = message.body.trim().toLowerCase();
console.log(messageBody);
});
client.initialize();
app.listen(port, () => console.log(
Server Started Port ${port}
));bang gua ngalamin problem di sini kenapa saya ketik ai: di whatsapp ainya gak bales iya bang?
Beta Was this translation helpful? Give feedback.
All reactions