Discord-Chatbot README

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.

Features

  • 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

Dependencies

Installation

  1. Install the required Python packages:
pip install discord.py openai re json requests datetime pytz os google-api-python-client tiktoken python-dotenv
  1. Create a new Discord bot and copy the bot token.

  2. Get an API key from OpenAI and copy the key.

  3. Obtain the Google Search API Key and Custom Search Engine ID (CSE ID). Here's a guide on how to do that.

  4. 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
  1. Save the bot script as helpful_bot.py and run it:
python helpful_bot.py
  1. For web scraping capabilities, set up the Web Scraper Server and follow the instructions in its README.

Usage

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.