Skip to content

KingCobra70/OrcaleAIBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OrcaleAIBot

This code is a Python program that runs a chatbot and image generator using OpenAI's GPT-3 API. It listens for messages in a Discord server and responds to them if they match certain conditions. It uses the discord and discord.ext libraries for interacting with the Discord API, as well as the openai library for interacting with the GPT-3 API. The program reads configuration settings from a config.ini file, which includes the OpenAI API key, the Discord bot token, and a list of guild IDs to monitor.

When a user sends a message starting with "!chat", the program sends the message to the GPT-3 API and returns a response. When a user sends a message starting with "!img", the program sends the message to the GPT-3 API to generate an image based on the text, which is then returned to the user as a URL. The program also includes an on_connect event handler to log in to Discord and monitor the configured guilds.

The code uses Python's asyncio library to handle asynchronous operations and improve the responsiveness of the bot. It also includes exception handling to handle errors that may occur when interacting with the APIs. Overall, this code provides a basic example of how to use OpenAI's GPT-3 API and the Discord API to create a chatbot and image generator.

!chat: This command allows you to chat with the GPT-3.5 model, which is powered by the OpenAI API. When you send a message starting with !chat, the bot will generate a response based on the message history in the channel, using the GPT-3.5 model. The bot will respond with the generated message.

!img: This command allows you to generate an image based on a prompt. When you send a message starting with !img, the bot will generate an image based on the message history in the channel, using the OpenAI API. The bot will respond with a link to the generated image.

About

Discord chat/ image bot using openai api

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages