import fetch from 'node-fetch';

// ...

export async function before(m, { isAdmin, isBotAdmin }) { if (m.isBaileys && m.fromMe) return !0 if (!m.isGroup) return !1 let chat = global.db.data.chats[m.chat] let bot = global.db.data.settings[this.user.jid] || {} if (chat.chatbot) { try { const text = encodeURIComponent(m.text); const apiUrl = https://api.clayzaaubert.my.id/api/ai/v1/chatgpt?q=${text}&apikey=${global.clayza};

        let api = await fetch(apiUrl);
        let res = await api.json();
        m.reply(res.data); // Assuming the API returns a response field
    } catch (e) {
        m.reply('Error occurred: ' + e);
    }
}

}

// ...

// Remove the wetabChat function, as it's no longer needed with the new API.

ChatGPT Integration for Group Chats using Node.js

原文地址: https://www.cveoy.top/t/topic/bGGP 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录