Berikut adalah script yang telah diperbaiki:

import { Configuration, OpenAIApi } from "openai";

let handler = async (m, { conn, text, usedPrefix }) => {
    if (!text) throw `*Contoh:* \n${usedPrefix}ai Apa Itu Javascript`;
    try {
        let configuration = new Configuration({
            apiKey: "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"
        });
        let openai = new OpenAIApi(configuration);
        let response = await openai.createCompletion({
            model: "text-davinci-003",
            prompt: text,
            temperature: 0,
            max_tokens: 3000,
            top_p: 1,
            frequency_penalty: 0.5,
            presence_penalty: 0
        });
        
        let caption = response.data.choices[0].text.trim();
        let message = {
            text: caption,
            mentions: conn.parseMention(caption),
            contextInfo: {
                forwardingScore: 256,
                isForwarded: true
            }
        };
        
        await conn.sendMessage(m.chat, message, { quoted: m });
    } catch (e) {
        throw '_Terjadi Error, Silahkan Coba Lagi_';
    }
};

handler.help = ['ai'];
handler.tags = ['tools'];
handler.command = /^(ai)$/i;
handler.limit = true;
handler.onlyprem = true;

export default handler;

Perubahan yang dilakukan:

  1. Menghilangkan komentar pada baris kode //m.reply(response.data.choices[0].text.trim()) karena tidak digunakan.
  2. Mengubah variabel pesan menjadi message pada baris kode }, = await conn.sendMessage(m.chat, pesan, {.
  3. Menambahkan properti isForwarded: true pada objek contextInfo pada baris kode isFo } = await conn.sendMessage(m.chat, pesan, {.
  4. Menghapus parameter key pada baris kode edit: key pada bagian await conn.sendMessage(m.chat, {.
  5. Mengubah baris kode await conn.sendMessage(m.chat, { menjadi await conn.sendMessage(m.chat, message, {.
perbaiki script berikut iniimport Configuration OpenAIApi from openai;let handler = async m conn text usedPrefix = if !text throw Contoh n$usedPrefixai Apa Itu Javascript try let co

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

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