Stackup Helper Bot is a multi-functional Discord bot designed to help users answer general questions, and provide administrative tools for server management. It integrates Google Generative AI (Gemini API) to generate answers from text files or generative AI, and includes conversation context storage for more natural and context-aware responses. Additionally, the bot offers Zendesk Reader integration, allowing it to retrieve and respond to queries based on content from Zendesk documents.
- Command:
!ask [question]
- Users can ask questions, and the bot first tries to find the answer in a predefined text file (
faq_data.txt
). If no answer is found, the bot generates a response using the Google Gemini API. - Conversation context is stored to make future responses more context-aware.
- Users can ask questions, and the bot first tries to find the answer in a predefined text file (
- The bot can fetch data from Zendesk articles and documentation, enhancing its knowledge base to provide more specific answers when needed.
-
Command:
!kick [user]
- Kicks a specified user from the server.
-
Command:
!mute [user] [hours]
- Mutes a user for a specified number of hours, temporarily preventing them from sending messages.
-
Command:
!deletechatlog
- Deletes the chat log that stores conversation history.
- The bot logs all user queries and responses in a
chat_log.txt
file. This allows it to provide context-based responses and improve future interactions with the user.
- Command:
!help
- Provides a list of all available commands, as well as a brief description of the bot's functionalities.
git clone https://github.com/your-username/stackup-helper-bot.git
cd stackup-helper-bot
Use the requirements.txt
file to install all the necessary dependencies:
pip install -r requirements.txt
Your requirements.txt
should include dependencies such as:
discord.py
python-dotenv
google-generativeai
zendesk
Create a .env
file to store sensitive environment variables such as your Discord Bot Token and Google Gemini API key.
In your project directory, create a file called .env.Add the following lines to the .env file:
DISCORD_TOKEN=your-discord-bot-token
GEMINI_API_KEY=your-google-gemini-api-key
Once everything is set up, you can start the bot with the following command:
python main.py
-
!ask [question]
: Ask a question and get an answer from the bot. It first checks a predefined text file for the answer, and if not found, it generates an answer using the Gemini API. -
!hello
: Sends a greeting message. -
!serverinfo
: Displays the current server name and the number of members. -
!help
: Lists all commands and provides information about each.
-
!kick [user]
: Kicks a specified user from the server. -
!mute [user] [hours]
: Temporarily mutes a user for the given number of hours. -
!deletechatlog
: Deletes the stored chat log that records the conversation history.
The bot logs all user queries, responses, and response times in a chat_log.txt
file. Admins can delete this chat log using the !deletechatlog
command to clear the stored conversation history.
- Visit the Google Cloud Console and create a new project.
- Enable the Google Generative AI API.
- Obtain your API key and add it to the
.env
file asGEMINI_API_KEY
.
The bot uses this API to generate answers when no answer is found in the predefined text file.
To install all the dependencies required for the bot, use the provided requirements.txt
file:
pip install -r requirements.txt
Feel free to fork the repository and contribute to the project by adding features or fixing bugs. Submit a pull request once your changes are ready.