Giter VIP home page Giter VIP logo

discord-ai-tts-bot's Introduction

Discord AI TTS Bot (Eleven Labs + OpenAI)

This is a Discord Bot that combines functionalities from Eleven Labs (TTS and Voice Cloning) and OpenAI API for text gen. With this you can locally host a discord bot that will hear your discord members conversation and when it hears a trigger word (if set to) will answer with text generated directly from the GPT model and reproduce with any voice you have available in your Eleven Labs Voice Library.

This is heavily inspired in this repo, so please check it: discord-speech-recognition

Requirements

To locally host this bot you'll need the following:

Dependencies

  • git
  • node.js (Tested on v18.16.0)
  • ffmpeg - Windows

API Keys

There's free trials for both of these for you to test!

Configuration

.ENV

BOTTOKEN=Discord bot secret token
CLIENTID=Discord Bot Application ID
MAIN_CHANNEL_ID=Channel id for typing interaction display

# open-ai
API_KEY=Your api key to open AI
ORGANIZATION_ID=Your organization ID of open AI

# elevenlabs
EL_API_KEY=Eleven labs API Key

config.json

{
  "open_ai": {
    "model_name": "gpt-4-1106-preview", //Open ai model name to generate responses, see https://platform.openai.com/docs/models/continuous-model-upgrades for more info
    "ai_personality": "You're a helpful assistant", //Initial prompt for the conversation, this will define how your openAI will generate your responses
    "max_context_lenght": 10 //maximum messages that will get attached to OpenAI request, leaving a higher number will consume more tokens and greatly increase costs but the AI will get a better context memory
  },
  "eleven_labs": {
    //see https://elevenlabs.io/docs/api-reference/streaming for information about this section
    "model_id": "eleven_multilingual_v2",
    "voice_id": "bHsbq7uvmLfNYTK2aEcL",
    "voice_settings": {
      "stability": 0.45,
      "similarity_boost": 0.7,
      "style": 0.15,
      "use_speaker_boost": true
    },
    "query_settings": {
      "optimize_streaming_latency": "3",
      "output_format": "mp3_44100_64"
    }
  },
  "discord_bot": {
    "use_triggers": true, //if set to false bot will respond to whatever someone speaks
    "trigger_words": ["phrase or word that your bot has to detect to start generating a response"],
    "join_phrase": "phrase or word to the bot join your current channel",
    "target_language": "en-US", //target language for speech recognition
    "censor_profanity": false //if set to true this will censor messages received from discord speakers
  }
}

How to run

After you are done with configurations just simply:

$ npm install

and...

$ node index.js

you should see something like this: ConsoleImage

discord-ai-tts-bot's People

Contributors

lzfelipe avatar

Stargazers

Devansh Yadav avatar  avatar Guilherme Arroio avatar

Watchers

 avatar

Forkers

dkkmartin

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.