Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
integrations: improve Discord bot instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobdylanc committed Apr 25, 2024
1 parent ef41884 commit 1678a37
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions src/pages/integrations/messaging/discord.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import { Callout, Steps } from 'nextra/components'

# Discord

## Integrate Discord Bot with Jan
## Integrate llmcord.py with Jan

Discord bot can enhance your discord server interactions. Integrating Jan with it can significantly boost responsiveness and user engagement on your Discord server.
[llmcord.py](https://github.com/jakobdylanc/discord-llm-chatbot) lets you and your friends chat with LLMs directly in your Discord server.

To integrate Jan with a Discord bot, follow the steps below:
To integrate Jan with llmcord.py, follow the steps below:

<Steps>

Expand All @@ -45,6 +45,10 @@ After cloning the repository, run the following command:
pip install -r requirements.txt
```

<Callout type="info">
A valid Python installation is required.
</Callout>

### Step 3: Set the Environment

1. Create a copy of `.env.example`.
Expand All @@ -53,35 +57,22 @@ pip install -r requirements.txt

| Setting | Instructions |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DISCORD_BOT_TOKEN` | Generate a new Discord application at [discord.com/developers/applications](https://discord.com/developers/applications), obtain a token from the Bot tab, and enable MESSAGE CONTENT INTENT. |
| `LLM` | For [Jan](https://jan.ai/), set to `local/openai/(MODEL_NAME)`, where `(MODEL_NAME)` is your loaded model's name. |
| `CUSTOM_SYSTEM_PROMPT` | Adjust the bot's behavior as needed. |
| `CUSTOM_DISCORD_STATUS` | Set a custom message for the bot's Discord profile. (Max 128 characters) |
| `ALLOWED_CHANNEL_IDS` | Enter Discord channel IDs where the bot can send messages, separated by commas. Leave blank to allow all channels. |
| `ALLOWED_ROLE_IDS` | Enter Discord role IDs that are allowed to use the bot, separated by commas. Leave blank to allow everyone. This includes at least one role, which also turns off DMs. |
| `MAX_IMAGES` | Max number of image attachments allowed per message when using a vision model. (Default: `5`) |
| `MAX_MESSAGES` | Max messages allowed in a reply chain. (Default: `20`) |
| `LOCAL_SERVER_URL` | URL of your local API server for LLMs starting with `local/`. (Default: `http://localhost:5000/v1`) |
| `LOCAL_API_KEY` | API key for your local API server with LLMs starting with `local/`. It is usually safe to leave blank. |
| `DISCORD_BOT_TOKEN` | Create a new Discord bot at at [discord.com/developers/applications](https://discord.com/developers/applications), obtain a token from the Bot tab, and enable MESSAGE CONTENT INTENT. |
| `DISCORD_CLIENT_ID` | Found under the OAuth2 tab of the Discord bot you just made. |
| `LLM` | For Jan, set to `local/openai/(MODEL_NAME)`, where `(MODEL_NAME)` is your loaded model's name. |
| `CUSTOM_SYSTEM_PROMPT` | Adjust the bot's behavior as needed. |
| `LOCAL_SERVER_URL` | URL of your local API server. For Jan, set to `http://localhost:1337/v1`. |

### Step 4: Insert the Bot
For more configuration options, refer to llmcord.py's [README](https://github.com/jakobdylanc/discord-llm-chatbot/tree/main?tab=readme-ov-file#instructions).

Invite the bot to your Discord server using the following URL:

```bash
https://discord.com/api/oauth2/authorize?client_id=(CLIENT_ID)&permissions=412317273088&scope=bot
```

<Callout type="info">
Replace `CLIENT_ID` with your Discord application's client ID from the OAuth2 tab.
</Callout>

### Step 5: Run the Bot
### Step 4: Run the Bot

Run the bot by using the following command in your command prompt:

```bash
python llmcord.py
```

The bot's invite URL will be printed in the console. Use it to add the bot to your server.

</Steps>

0 comments on commit 1678a37

Please sign in to comment.