Inspiration

After seeing the incredible functionality of chatGPT, we wanted to bring this service to a discord bot.

What it does

The Bot has the following built in functions:

All start with \gpt-

chat- allows you to chat with chatGPT

summarize- summarizes the last n minutes of a conversation in a channel

best- using chatGPT algorithms provides the funnies, most raging, and saddest quote of the last n days

sim - @ a user in channel as the argument of this function to get a simulated response from this user

start- chatGPT API cannot by itself remember previous responses. Therefore, we implemented start/stop to allow you to have multi prompt/response sessions. The code will keep track of your responses from start is called, and chat-gpt will respond until stop is called (no need to call any commands in between start and stop). ChatGPT will be fed information about responses since start was called every time you prompt it

stop-see start

help- provides list of commands, how to use them and what they do

How we built it

Used the OpenAI API key and the discord development bot page to create a bot. From there used python to create our environments and all of our code for the bot

Challenges we ran into

First challenge was getting chatGPT and the discord bot to talk to each other, had to be very specific on how we sent/received information from both sources and handled communication.

Additionally, getting multi line responses was a problem as we realized the bot didn’t remember previous messages, which we ended up patching with start/stop commands

Filtering out messages that were too long/extraneous removed a lot of our problems with data being to large/prompts not functioning correctly

Finally, chatGPT API has a problem where responses will suddenly cut off if the AI creates too long of a response. We created prompt additions that after a little trial and error would always result in messages not cutting off.

Additionally, we limited all responses to 200 characters to improve clarity.

Accomplishments that we're proud of

Fixing all of the problems listed above definitely made us proud.

Additionally, creating a full project in 36 hours in 2 of our first hackathons was also an awesome experience.

It’s very cool to see our project working and responding.

What we learned

We learned a lot about APIs and how to manage information hiding while creating an application that other users can emulate

We also learned how to effectively send/recieve responses from a server and manage data.

What's next for Chat GPT discord bot

Next would be adding more Quality of life functions that can help the user interface with ChatGPT more smoothly, with commands such as frequency, etc. there is really no limit to what ChatGPT discord bot can accomplish

Built With

  • chatgpt
  • discord
  • openai
Share this project:

Updates