-
@ the bot and it will reply to your message. Reply to the bot's message to continue the conversation from that point. Build conversations with reply chains!
Works when replying to ANY message in your server, just @ the bot!
-
The bot's responses are dynamically generated just like ChatGPT.
With intuitive color coding (orange = generating, green = done).
-
The bot can see your image attachments when set to a vision model.
- Choose your LLM (from OpenAI or Mistral API)
- Easily set a custom personality (aka system prompt)
- User identity aware
- Fully asynchronous
- 1 Python file, ~200 lines of code
Before you start, install Python and clone this git repo.
- Install Python requirements:
pip install -r requirements.txt
- Create .env from .env.example and set it up:
Setting | Instructions |
---|---|
DISCORD_BOT_TOKEN | Create a new Discord application at discord.com/developers/applications and generate a token under the Bot tab. Also enable MESSAGE CONTENT INTENT. |
OPENAI_API_KEY | Only required if you select an OpenAI model. Generate an OpenAI API key at platform.openai.com/account/api-keys. You must also add a payment method to your OpenAI account at platform.openai.com/account/billing/payment-methods. |
MISTRAL_API_KEY | Only required if you select a Mistral model. Generate a Mistral API key at console.mistral.ai/user/api-keys. You must also add a payment method to your Mistral account at console.mistral.ai/billing. |
LLM | OpenAI models: Â Â Â gpt-3.5-turbo-1106 (latest GPT-3.5 Turbo) Â Â Â gpt-4-1106-preview (GPT-4 Turbo) Â Â Â gpt-4-vision-preview (GPT-4 Turbo with vision) Mistral models: Â Â Â mistral-tiny (Mistral-7B) Â Â Â mistral-small (Mixtral-8X7B) Â Â Â mistral-medium (Mistral internal prototype) |
MAX_IMAGES | The maximum number of image attachments allowed in a single message. Only applicable when using a vision model. (Default: 5) |
MAX_MESSAGES | The maximum number of messages in a reply chain. (Default: 20) |
CUSTOM_SYSTEM_PROMPT | Write practically anything you want to customize the bot's behavior! |
- Invite the bot to your Discord server with this URL (replace <CLIENT_ID> with your Discord application's client ID found under the OAuth2 tab):
https://discord.com/api/oauth2/authorize?client_id=<CLIENT_ID>&permissions=412317273088&scope=bot
- Run the bot:
python llmcord.py