Helpful Bot is a Discord bot that can answer questions and perform tasks, such as searching the web and scraping web pages. It utilizes OpenAI's GPT-3.5 Turbo model, Google API, and a back-end web scraper server to fetch relevant information and generate helpful responses.
- Answer questions and perform tasks for users
- Use Google API for web search and return results in a conversational format
- Scrape web pages and incorporate scraped data into responses
- Run as a Discord bot to respond to messages in real-time
- Install the required Python packages:
pip install discord.py openai re json requests datetime pytz os google-api-python-client tiktoken python-dotenv
-
Create a new Discord bot and copy the bot token.
-
Get an API key from OpenAI and copy the key.
-
Obtain the Google Search API Key and Custom Search Engine ID (CSE ID). Here's a guide on how to do that.
-
Create a
.env
file in the same folder as the bot script and add your bot token, OpenAI API key, Google API Key, and Google CSE ID:
DISCORD_TOKEN=your_discord_bot_token
OPENAI_API_KEY=your_openai_key
GOOGLE_API_KEY=your_google_api_key
GOOGLE_CSE_ID=your_google_cse_id
- Save the bot script as
helpful_bot.py
and run it:
python helpful_bot.py
- For web scraping capabilities, set up the Web Scraper Server and follow the instructions in its README.
To trigger the bot, mention its name or an associated keyword in a Discord channel, followed by your message. The bot will then run its search, scrape data if necessary, and generate a helpful response based on the available information. By default, the bot is called "Byte". This can be changed in the code by changing any mention of "Byte" to your bot's name.