Skip to content

Df botΒ #121

@daffajagomlbb-creator

Description

@daffajagomlbb-creator

const { default: makeWASocket, useMultiFileAuthState, DisconnectReason, fetchLatestBaileysVersion } = require('@whiskeysockets/baileys');
const qrcode = require('qrcode-terminal');
const fs = require('fs');

async function startBot() {
const { state, saveCreds } = await useMultiFileAuthState('df-store-session');
const { version } = await fetchLatestBaileysVersion();

const sock = makeWASocket({
    version,
    auth: state,
    printQRInTerminal: true,
    logger: undefined,
    markOnlineOnConnect: true,
});

console.log('πŸš€ DF Store Bot Starting...');

sock.ev.process(async (events) => {

    if (events['connection.update']) {
        const { connection, lastDisconnect, qr } = events['connection.update'];
        if (qr) qrcode.generate(qr, { small: true });
        
        if (connection === 'open') console.log('βœ… DF Store Bot Berhasil Terhubung!');
        if (connection === 'close') {
            if (lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut) {
                startBot();
            }
        }
    }

    if (events['messages.upsert']) {
        const { messages } = events['messages.upsert'];
        const m = messages[0];
        if (!m.message) return;

        const text = (m.message.conversation || m.message.extendedTextMessage?.text || '').toLowerCase().trim();
        const from = m.key.remoteJid;
        const isGroup = from.endsWith('@g.us');

        // ==================== DF STORE MENU ====================
        if (text === '.menu' || text === 'menu') {
            const menuText = `╔══════════════════╗

β•‘ 🌟 DF STORE 🌟 β•‘
╠══════════════════╣
β€’ .ping
β€’ .owner
β€’ .produk
β€’ .harga
β€’ .sticker (reply gambar)
β€’ .toimg (reply sticker)
β€’ .ai (tanya apa saja)
β€’ .tiktok [url]
β€’ .ig [url]
β€’ .order (pesan produk)
β€’ .admin (hubungi admin)

Kirim perintah sesuai kebutuhan! πŸ”₯`;
await sock.sendMessage(from, { text: menuText });
}

        if (text === '.ping') await sock.sendMessage(from, { text: 'πŸ“ Pong! DF Store Bot Aktif!' });

        if (text === '.owner' || text === '.admin') {
            await sock.sendMessage(from, { text: 'πŸ‘‘ Owner DF Store\nWA: 628xxxxxxxxxx\nSupport 24 Jam' });
        }

        if (text === '.produk') {
            await sock.sendMessage(from, { text: `πŸ“¦ Produk DF Store:\n\n1. Pulsa & Data\n2. Diamond Game\n3. Akun Premium\n4. Script Bot\n5. Panel Bot\n\nKetik .order untuk pesan.` });
        }

        // Simple AI
        if (text.startsWith('.ai ')) {
            const query = text.slice(4);
            await sock.sendMessage(from, { text: `πŸ€– DF Store AI:\n\n${query}\n\nJawaban: Fitur ini masih dalam pengembangan, tapi pertanyaanmu sangat bagus! Mau saya bantu apa lagi?` });
        }

        // Sticker
        if (text === '.sticker' && m.message.imageMessage) {
            const stream = await sock.downloadMediaMessage(m);
            await sock.sendMessage(from, { sticker: stream });
        }

        if (text === '.toimg' && m.message.stickerMessage) {
            const stream = await sock.downloadMediaMessage(m);
            await sock.sendMessage(from, { image: stream, caption: 'βœ… Berhasil diubah oleh DF Store' });
        }

        // Order
        if (text === '.order') {
            await sock.sendMessage(from, { text: 'πŸ›’ Silakan ketik produk yang diinginkan + jumlahnya.\nContoh: order diamond ml 1000' });
        }
    }
});

sock.ev.on('creds.update', saveCreds);

}

startBot();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions