Git Product home page Git Product logo

ai-discord-bot's Introduction

Mendable AI Discord Bot

This is a Discord bot that uses the Mendable API to answer questions and provide sources for the answers. It creates a new thread for each question asked and stores the history of the conversation.

Features

  • Starts a new thread for each question asked.
  • Uses the Mendable API to answer questions and provide sources.
  • Stores the history of the conversation.

Setup

  1. Clone this repository.
  2. Install the required dependencies with npm install.
  3. Create a .env file in the root directory of the project and add the following environment variables:
    • MENDABLE_API_KEY: Your Mendable API key.
    • DISCORD_TOKEN: Your Discord bot token.
    • BOT_ID: Your Discord bot ID.
  4. Run the bot with node index.js or npm run start.

Usage

To ask a question, mention the bot followed by your question. For example:

@MendableAI How to create a Mendable AI Discord Bot?

The bot will create a new thread, answer the question, and provide sources for the answer.

Dependencies

  • discord.js: A powerful library for interacting with the Discord API.
  • dotenv: A zero-dependency module that loads environment variables from a .env file into process.env.

Creating a Discord Application and Getting the Necessary Tokens and Bot ID

  1. Create a Discord Application

    • Go to the Discord Developer Portal.
    • Click on the New Application button.
    • Give your application a name and click Create.
  2. Create a Bot for the Application

    • Click on the Bot tab on the left side of the application page.
    • Click on the Add Bot button on the right and confirm by clicking Yes, do it!.
  3. Get the Bot Token

    • Still on the Bot tab, find the Token section.
    • Click on Copy to copy the bot token. This is your DISCORD_TOKEN.
  4. Get the Bot ID

    • Go to the General Information tab on the left side of the application page.
    • Find the Application ID section and click Copy. This is your BOT_ID.
  5. Invite the Bot to Your Server

    • Go to the OAuth2 tab on the left side of the application page.
    • In the Scopes section, select bot.
    • In the Bot Permissions section, select the permissions your bot needs.
    • Copy the generated URL and open it in your web browser to invite the bot to your server.
  6. Get the Bot ID

    • Right click on the bot name and select Copy ID. This is your BOT_ID.

Deploying to Railway

With Railway you can deploy your bot in less than a minute. To do so, follow these steps:

  1. Create a new Railway project.
  2. Connect your GitHub repo that contains the bot's code.
  3. Insert your environment variables in the Environment Variables section of the project settings.
  4. That's it! Railway will automatically deploy your bot and keep it running.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

ai-discord-bot's People

Contributors

nickscamara avatar

Stargazers

Sayantan Das avatar Brian J King avatar Abhay Bhardwaj avatar Nathan Lloyd Ward avatar  avatar Eric Ciarla avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

adriatic

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.