1.0.3 • Published 2 years ago

chatdemo.ia v1.0.3

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 years ago

ChatDemo.Ia

Un paquete de npm para interactuar con el chat GPT-3.5 de OpenAI.

Fallas

1.0.0 - 1.0.2 = Error en la API Key

Instalación

Ejecuta en tu consola lo siguiente:

npm install chatdemo.ia

Ejemplo

Discord v13:

const Discord = require("discord.js")
const client = new Discord.Client({ intents: 3276799 })
const { enviarMensaje } = require("chatdemo.ia")

client.on("ready", () => {
  console.log(`Bot online como ${client.user.tag}`)
})

client.on("messageCreate", async(message) => {

if(message.channel.type === "dm") return;
if(message.author.bot) return;
  let prefix = "ia!";
const args = message.content.slice(prefix.length).trim().split(/ +/g);

if(message.content.startsWith(prefix + "ask")){

  const text = args.join(" ")
  enviarMensaje(text).then(respuesta => {

    /* const embed = Discord.MessageEmbed()
    .setAuthor(text, message.author.displayAvatarURL({ dynamic: true }))
    .setDescription(respuesta)
    .setFooter("Cost: Free")

    message.channel.send({ embeds: [embed] })
    */ optional

    message.channel.send({ content: [respuesta] })
  })
  
}
  
})
1.0.3

2 years ago

1.0.2

2 years ago

1.0.2-beta

2 years ago

1.0.1

2 years ago

1.0.1-beta

2 years ago

1.0.0

2 years ago