# Fjerkroa bot

A simple Discord bot that uses OpenAI's GPT to chat with users.

## Installation

1. Install the package using pip:
```
pip install fjerkroa-bot
```

2. Create a `config.toml` file with the following content, replacing the tokens with your own:
```toml
openai-key = "OPENAIKEY"
discord-token = "DISCORDTOKEN"
model = "gpt-3.5-turbo"
max-tokens = 1024
temperature = 0.9
top-p = 1.0
presence-penalty = 1.0
frequency-penalty = 1.0
history-limit = 20
history-per-channel = 5
history-directory = "history"
welcome-channel = "chat"
staff-channel = "mods"
join-message = "Hi! Ich heiße {name} und ich bin neu hier! Wie geht es euch?"
short-path = [['^news$', '^news-bot$'], ['^mods$', '.*']]
ignore-channels = ["blengon"]
fix-model = "gpt-3.5-turbo"
fix-description = "You are an AI which fixes JSON documents. User send you JSON document, possibly invalid, and you fix it as good as you can and return as answer. Even when document is valid, return it pretty formated."
additional-responders = []
system = "You are an smart AI"
```

3. Run the bot:
```
python -m fjerkroa_bot --config config.toml
```

## Configuration

Create a `config.toml` file with the following configuration options:

```toml
openai-key = "OPENAIKEY"
discord-token = "DISCORDTOKEN"
model = "gpt-3.5-turbo"
max-tokens = 1024
temperature = 0.9
top-p = 1.0
presence-penalty = 1.0
frequency-penalty = 1.0
history-limit = 10
welcome-channel = "welcome"
staff-channel = "staff"
join-message = "Hi! I am {name}, and I am new here."
short-path = [['^news$', '^news-bot$'], ['^mod$', '.*']]
system = "You are an smart AI"
```

- `discord-token`: The token for the Discord bot account.
- `openai-token`: The API key for the OpenAI API.
- `model`: The OpenAI model name to be used for generating AI responses.
- `temperature`: The temperature for the AI model's output.
- `history-limit`: The maximum number of messages to maintain in the conversation history.
- `history-directory`: The directory where the conversation history will be stored.
- `history-per-channel`: The number of history items to keep per channel.
- `max-tokens`: The maximum number of tokens in the generated AI response.
- `top-p`: The top-p sampling value for the AI model's output.
- `presence-penalty`: The presence penalty value for the AI model's output.
- `frequency-penalty`: The frequency penalty value for the AI model's output.
- `staff-channel`: The name of the channel where staff messages will be sent.
- `welcome-channel`: The name of the channel where welcome messages will be sent.
- `join-message`: The message template to be sent to AI when a user joins the server, triggers that way the AI to write something to the user.
- `ignore-channels`: A list of channels to be ignored by the bot.
- `additional-responders`: A list of channels that should have a separate AI responder with separated history.
- `short-path`: List of channel and user regex patterns to apply short path (skip sending message to AI, just fill the history).
- `system`: The system message template for the AI conversation.
- `fix-model`: The OpenAI model name to be used for fixing the AI responses.
- `fix-description`: The description for the fix-model's conversation.

register-python-argcomplete