/Bard-Discord-bot

Integrate Google Bard into your own discord chatbot

Primary LanguagePythonGNU General Public License v2.0GPL-2.0

Setup

Prerequisites to install

  • run pip3 install -r requirements.txt

  • Rename the file example.env to .env

Step 1: Create a Discord bot

  1. Go to https://discord.com/developers/applications create an application

  2. Build a Discord bot under the application

  3. Get the token from bot setting

    image

  4. Store the token to .env under the DISCORD_BOT_TOKEN

    image
  5. Turn MESSAGE CONTENT INTENT ON

    image

  6. Invite your bot to your server via OAuth2 URL Generator

    image

Authentication

  1. Visit https://bard.google.com/
  2. F12 for console
  3. Session: Application → Cookies → Copy the value of __Secure-1PSID cookie.

Step 3: Run the bot on the desktop

  1. Open a terminal or command prompt

  2. Navigate to the directory where you installed the Bard Discord bot

  3. Run python3 main.py or python main.py to start the bot

Step 4. Invite the bot

image

Modes

  • Direct message mode: The bot can be used to chat with users in direct messages. To enable this mode, use the /toggledm command
  • Channel mode: The bot can be used to chat with users in channels. To enable this mode for a channel, use the /toggleactive command

Commands

  • /help: Displays a list of all available commands
  • /toggledm: Toggles direct message mode
  • /toggleactive: Toggles channel mode for a channel
  • /chat: Chat with Bard
  • /reset: Reset bot's context
  • /togglechannel: Add the channel you are currently in to the Active Channel List
  • /toggledm: Toggle if DM chatting should be active
  • /public: Toggle if bot should respond to all messages in chat
  • /private: Toggle if bot should only respond to /chat

Credits

This program is based on the work of mishalhossin, Zero6992, and acheong08

For more information, please visit the following repositories: