A Discord bot that answers questions based on provided documentation.
The bot is configured via environment variables set in the .env file:
DISCORD_TOKEN: Your Discord bot tokenGROQ_API_KEY: Your API key for the Groq APISUPPORT_ROLE_ID(optional): The ID of the role allowed to use the/generatecommandGUILD_ID(optional): The ID of the server for registering slash commandsFAQ_CHANNEL_NAME(optional): The name of the channel where the bot should answer questions (default:faq-fragen)FAQ_CHANNEL_ID(optional): The ID of the channel where the bot should answer questions (takes precedence overFAQ_CHANNEL_NAME)
To enable slash commands, GUILD_ID must be set. Commands will then be registered automatically when the bot starts.
- Create a
.envfile with your credentials (setGUILD_IDto enable slash commands) - Install dependencies with
pip install -r requirements.txt - Start the bot with
python main.py
The bot supports two types of commands:
- Traditional prefix commands:
!generate <message-id> - Slash commands:
/generate <message-id>
Both commands work identically and allow supporters with the configured role to generate a response for any message in any channel.
With slash commands, Discord automatically displays the parameters. Just type /generate and Discord will prompt you to enter the message ID.
The bot monitors the configured channel for messages ending with a question mark. When such a message is detected, the bot searches the provided documentation for relevant information and generates a response using the Groq API.
The bot also supports the manual command /generate <message-id> (or !generate <message-id>), which allows supporters with the appropriate role to generate a response for any message in any channel. The message does not need to be in the FAQ channel — the command works server-wide.