chore: default wa_gateway_type=gowa (baileys dilepas) + README
This commit is contained in:
1 parent
0f612df70f
commit
cb60ceec10
10 files changed
+19
-19
No files matched your search
@@ -62,7 +62,7 @@ async function runAutoBillingReminder() {
|
||||
const billingEnabled = getSetting('whatsapp_billing_to_customer_enabled', true);
|
||||
if (!enabled || !waEnabled || !billingEnabled) return { target: 0, sent: 0, failed: 0, skipped: 'disabled' };
|
||||
|
||||
const gatewayType = getSetting('wa_gateway_type', 'baileys');
|
||||
const gatewayType = getSetting('wa_gateway_type', 'gowa');
|
||||
const waSvc = require('./whatsappService');
|
||||
|
||||
if (gatewayType === 'meta') {
|
||||
|
||||
@@ -108,7 +108,7 @@ async function checkDependencies() {
|
||||
// 3. Check WhatsApp Gateway (GoWA / Baileys sesuai setting wa_gateway_type)
|
||||
try {
|
||||
const { getSetting } = require('../config/settingsManager');
|
||||
const gw = String(getSetting('wa_gateway_type', 'baileys') || 'baileys').toLowerCase();
|
||||
const gw = String(getSetting('wa_gateway_type', 'gowa') || 'baileys').toLowerCase();
|
||||
if (gw === 'gowa') {
|
||||
const base = String(getSetting('gowa_base_url', 'http://127.0.0.1:3000') || '').replace(/\/+$/, '');
|
||||
const u = getSetting('gowa_username', '');
|
||||
|
||||
@@ -8,7 +8,7 @@ const path = require('path');
|
||||
const { getSetting } = require('../config/settingsManager');
|
||||
|
||||
function gateway() {
|
||||
return String(getSetting('wa_gateway_type', 'baileys') || 'baileys').toLowerCase();
|
||||
return String(getSetting('wa_gateway_type', 'gowa') || 'baileys').toLowerCase();
|
||||
}
|
||||
|
||||
function spx(t) {
|
||||
|
||||
@@ -933,7 +933,7 @@ export const whatsappStatus = {
|
||||
_connection: 'connecting',
|
||||
get connection() {
|
||||
try {
|
||||
const gw = getSetting('wa_gateway_type', 'baileys');
|
||||
const gw = getSetting('wa_gateway_type', 'gowa');
|
||||
if (gw === 'fonnte') {
|
||||
const token = getSetting('fonnte_token', '');
|
||||
return token ? 'open' : 'close';
|
||||
@@ -954,7 +954,7 @@ export const whatsappStatus = {
|
||||
_user: null,
|
||||
get user() {
|
||||
try {
|
||||
const gw = getSetting('wa_gateway_type', 'baileys');
|
||||
const gw = getSetting('wa_gateway_type', 'gowa');
|
||||
if (gw === 'fonnte') {
|
||||
return { id: 'fonnte_gateway', name: 'Fonnte Gateway' };
|
||||
}
|
||||
@@ -973,7 +973,7 @@ export const whatsappStatus = {
|
||||
_phoneNumber: null,
|
||||
get phoneNumber() {
|
||||
try {
|
||||
const gw = getSetting('wa_gateway_type', 'baileys');
|
||||
const gw = getSetting('wa_gateway_type', 'gowa');
|
||||
if (gw === 'fonnte') return 'Fonnte Gateway';
|
||||
if (gw === 'meta') return getSetting('meta_phone_number_id', 'Meta API');
|
||||
if (gw === 'gowa') return getSetting('gowa_device_id', '') || 'GOWA Gateway';
|
||||
@@ -986,7 +986,7 @@ export const whatsappStatus = {
|
||||
_pushName: null,
|
||||
get pushName() {
|
||||
try {
|
||||
const gw = getSetting('wa_gateway_type', 'baileys');
|
||||
const gw = getSetting('wa_gateway_type', 'gowa');
|
||||
if (gw === 'fonnte') return 'Fonnte Gateway';
|
||||
if (gw === 'meta') return 'Meta Cloud API';
|
||||
if (gw === 'gowa') return 'GOWA Gateway';
|
||||
@@ -1032,7 +1032,7 @@ function loadWhatsappAdminSendList() {
|
||||
* @param {string} priority - Priority level: 'high', 'medium', 'low'
|
||||
*/
|
||||
export async function sendMonitoringAlert(message, priority = 'medium') {
|
||||
const gatewayType = getSetting('wa_gateway_type', 'baileys');
|
||||
const gatewayType = getSetting('wa_gateway_type', 'gowa');
|
||||
if (gatewayType === 'baileys' && (!currentSock || whatsappStatus._connection !== 'open')) {
|
||||
logger.warn('[WhatsApp] Bot belum siap (koneksi belum terbuka), tidak dapat mengirim alert monitoring');
|
||||
return { success: false, message: 'Bot belum siap' };
|
||||
@@ -1139,7 +1139,7 @@ export async function simulateHumanTyping(sock, jid, text = '') {
|
||||
}
|
||||
|
||||
export async function sendWA(to, text, options = {}) {
|
||||
const gatewayType = getSetting('wa_gateway_type', 'baileys');
|
||||
const gatewayType = getSetting('wa_gateway_type', 'gowa');
|
||||
|
||||
let finalText = text;
|
||||
if (options.spintax !== false && typeof text === 'string' && text.includes('{') && text.includes('}')) {
|
||||
@@ -1219,7 +1219,7 @@ export async function sendWA(to, text, options = {}) {
|
||||
}
|
||||
|
||||
export async function sendWAImage(to, imageBuffer, caption = '', options = {}) {
|
||||
const gatewayType = getSetting('wa_gateway_type', 'baileys');
|
||||
const gatewayType = getSetting('wa_gateway_type', 'gowa');
|
||||
|
||||
let finalCaption = caption;
|
||||
if (options.spintax !== false && typeof caption === 'string' && caption.includes('{') && caption.includes('}')) {
|
||||
@@ -1286,7 +1286,7 @@ export async function sendWAImage(to, imageBuffer, caption = '', options = {}) {
|
||||
}
|
||||
|
||||
export async function sendWADocument(to, documentBuffer, filename = 'Invoice.pdf', caption = '', mimetype = 'application/pdf', options = {}) {
|
||||
const gatewayType = getSetting('wa_gateway_type', 'baileys');
|
||||
const gatewayType = getSetting('wa_gateway_type', 'gowa');
|
||||
|
||||
let finalCaption = caption;
|
||||
if (options.spintax !== false && typeof caption === 'string' && caption.includes('{') && caption.includes('}')) {
|
||||
|
||||
@@ -140,7 +140,7 @@ function formatUnpaidInvoicesSummary(unpaidInvoices) {
|
||||
* @param {object} options Opsi tambahan: { templateName, parameters, langCode, url, filename }
|
||||
*/
|
||||
async function sendWhatsAppMessage(toPhone, messageText, options = {}) {
|
||||
const gatewayType = getSetting('wa_gateway_type', 'baileys'); // 'baileys', 'fonnte', or 'meta'
|
||||
const gatewayType = getSetting('wa_gateway_type', 'gowa'); // 'baileys', 'fonnte', or 'meta'
|
||||
|
||||
if (gatewayType === 'fonnte') {
|
||||
// Mode FONNTE API GATEWAY (Cloud / Self-Hosted)
|
||||
|
||||
Reference in new issue
Block a user