DEV Community

Cover image for Selfhosted NodeJS ChatGPT Discord Bot
GBTI
GBTI

Posted on • Updated on

Selfhosted NodeJS ChatGPT Discord Bot

Image description

We created a ChatGPT bot powered by NodeJS.

This bot integrates with both the OpenAI and Discord API through a config.json file.

The bot requires users to have a payment account linked with OpenAI to record data usage. The data is affordable, with a power user costing about 10 cents a day and a regular user hardly a cent. Throttle management is available through the OpenAI API to help users monitor their usage.

Once connected to Discord, the bot can be assigned to a special channel where users can interact with it. Users can type in /chat prompt to create a private thread between themselves and ChatGPT or /chat prompt --public to open a public, collaborative thread. Public threads accept collaborative input from multiple parties, while private threads only allow the initiating user to participate.

The bot remembers up to 50 interactions per thread, providing the AI with a well-contextualized view of the conversation. Users can manually adjust the number of replies to remember in the codebase to control expenses.

GBTI Labs notes that while some powerful interpretations of a ChatGPT Discord bot exist, there is no official bot provided by OpenAI. However, users can still consider this bot model a starting point for other AI-powered language models.

Repository

Please find our work at the following repo:

Self-hosted NodeJS ChatGPT Discord Bot

Support our work / Join the GBTI network!

Become a supporter and join the GBTI Community

Top comments (1)

Collapse
 
gbti profile image
GBTI

Thanks for paying attention.