Git Product home page Git Product logo

baloo-bot-final's Introduction

baloo-bot-final

A multi-purpose Discord bot built with discord.js, TypeScript

Alt


Features

  • A dedicated member welcoming and leaving system, server logging system, moderation system, AFK (Away From Keyboard) system, emote management utility
  • Fully-featured chatbot system which leverages OpenAI's gpt-3.5-turbo model
  • Makes use of Discord's new bot-user interactions: slash commands, buttons and select menus, context menus and modals
  • Provides a centralised logging solution with the use of Logtail

Installation

  1. Clone the repository and cd into it:

    git clone https://github.com/nine96as/baloo-bot-final
    cd baloo-bot-final
  2. Install required npm dependencies:

    npm install #install dependencies from package.json
  3. Complete the steps in the Configuration section, then run the bot with:

    npm run start:dev #nodemon listens for file changes

    Note: The start:dev script will run the bot with nodemon, which will automatically restart the bot when changes are made to the source code.

Configuration

The bot requires a Discord bot token to use the Discord API, the bot's APPLICATION_ID to be able to deploy commands, an OpenAI API key to enable the chatbot functionality, a DATABASE_URL to enable Prisma to interact with a database, and a sourceToken to be able to transport logs to Logtail.

  1. Fetch the Discord bot token by creating a discord bot application, using this guide.

    Warning: It is vital that you do not ever share your bot token with anybody, purposely or accidentally. If someone does manage to get a hold of your bot's token, they can use your bot as if it were theirs. If you accidentally share your token, revoke it immediately and generate a new one.

  2. Fetch the APPLICATION_ID by accessing the Discord Developer Portal, selecting your newly generated bot application, and looking at the General Information page.

  3. Fetch the OpenAI API key using this guide.

    Warning: It is imperative that you do not ever share OpenAI API key with anybody, purposely or accidentally. If you accidentally commit your token, revoke it immediately and generate a new one.

  4. Fetch the DATABASE_URL using this guide, where PlanetScale is used as the database provider.

  5. Fetch the sourceToken using this guide, where Pino is used as the logging solution.

  6. After you've acquired all the required values, create a .env file, and fill it in as shown below:

    token='token'
    clientId='APPLICATION_ID'
    openAIKey='openAIApiKey'
    logtailSourceToken='sourceToken'
    databaseUrl='DATABASE_URL'

Deployment

To deploy the bot for production, run the below commands.

npm run build #builds ts code into js
npm run start #runs js compiled code

Additional Scripts

  • Prettier, ESLint and Prisma scripts are available to automate code formatting

    npm run format #prettier checks + enforces formatting
    npm run lint #eslint check + auto-fix errors where possible
    npm run db:push #pushes schema changes to database

baloo-bot-final's People

Contributors

asninee avatar dependabot[bot] avatar

Watchers

Kostas Georgiou avatar  avatar

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.