You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code makes a connection between a Discord bot and the ChatGPT API, where the response to the prompt entered by the user is returned, as in the example below. The prompt typed in was "What is GitHub?":
Important Notes:
You will need an OpenAi API Key, it can be obtained from the official OpenAi website: openai.com
You will need your bot's token.
You can change the chatbot model in the "OpenAiRequest" Class.
You can edit the maximum amount of tokens, respecting the limit already set by Discord
About
Bot Discord Java integrated with the OpenAi API, it receives a prompt from the user passed as parameter in slash command, makes the request and returns the response from the API.