1.1.2 • Published 1 year ago

discordai v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

DiscordGPT

Notes

This project is still in beta, and has bugs.

discordGPT Installation

$ npm install discordgpt

Usage

DiscordGPT can implement AI features into your Discord bot by just a few simple steps.

  1. Create an OpenAI API key here if you do not have an api key.

  2. Install discordGPT

  3. Implement this example code:
const { discordGPT } = require("discordgpt");
const { Client } = require("discord.js");
const secret = require("../config.json");
const client = new Client({ intents: [] });

const prompt = "";

new discordGPT(client, {
  message: prompt,
  apiKey: secret,
});
  1. Make an config.json (or an .env file) and put your OpenAI API key there.
{
 apiKey: "API_KEY_HERE"
}
  1. Finally, you can place that in a discord bot command.

Example:

const { SlashCommandBuilder } = require("discord.js");
const { discordGPT } = require("discordgpt");
module.exports = {
  data: new SlashCommandBuilder()
    .setName("ask-gpt")
    .setDescription("Generate a AI response!")
    .addStringOption((option) =>
      option
        .setName("prompt")
        .setDescription("The text to generate.")
        .setRequired(true)
    ),
  async execute(client, interaction) {
    const prompt = interaction.options.getString("prompt");
    const gpt = new discordGPT(client, {
      message: prompt,
      apiKey: secret,
    });
    await interaction.reply({ content: gpt.response });
  },
};
1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago