Skip to content

FoxyMoe is a discord bot written in nodejs with discord.js. This is a chat bot that communicates via the oobabooga webui API.

License

Notifications You must be signed in to change notification settings

kitsumed/FoxyMoe-DiscordBot

Repository files navigation

Contributors Forks Stargazers Issues MIT License


FoxyMoe Discord Bot

FoxyMoe is a discord bot written with discord.js. This is a chat bot that communicates via the oobabooga webui API.

Chat Bot Showcase

showcase_ai_txt.mp4
See showcase configurations

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Ideas
  5. Contributing
  6. Acknowledgments

About The Project

FoxyMoe was a project I started around 2022 as a joke between friends. At the time, the main objective was to make the bot join a voice channel and use MoeGoe for TTS. However, MoeGoe stopped receiving updates the same year and encountered problems with certain characters, causing the bot to be unstable. Around one year later, I decided to pick back that project and rewrite most of the code, a V2, and this time focused on the other half of the original idea, the chat bot (with LLM).

(back to top)

Getting Started

Prerequisites

  1. Node.js
  2. Oobabooga WebUI (Github repo) Follow the installation procedure in their readme

Caution

The chat bot showcase was done on oobabooga webui v1.10.1. If you plan to use embeddings (vector search) for the long term memory, you may have a problem with oobabooga as a module is missing. Please refer to this issue to correct it.

Installation

This guide assume your already have installed Oobabooga webui, a model inside the webui and created a Discord Bot.

  1. Go into the root folder of your Oobabooga installation and locate the CMD_FLAGS.TXT file. Ensure that you have enabled the --api flag. Here's a example of a correct configuration:

     # Only used by the one-click installer.
     # Example:
     # --listen --api
     --api
    
  2. Clone this repo or download it as a zip file

    git clone https://github.com/kitsumed/FoxyMoe-DiscordBot
  3. Open a cmd into the root of the repo and install the npm packages of the project

    npm install
  4. Create a .env file in the root of the repo and configure your environement file with the following settings:

    If you are unsure about your LLM informations, go back to where you downloaded the model, example of the Instruction Template and chat mode should be mentioned.

    TOKEN=YOUR_DISCORD_BOT_TOKEN
    ClientID=YOUR_DISCORD_BOT_CLIENT_ID
    GuildID=YOUR_DISCORD_SERVER_ID
     
    OobaboogaApiEndpoint=http://127.0.0.1:5000
    OobaboogaModelName=YOUR_MODEL_NAME
    OobaboogaUseEmbeddings=true/false
    OobaboogaChatMode=YOUR_MODEL_SUPPORTED_MODE
    OobaboogaInstructionTemplateName=YOUR_MODEL_INSTRUCTION_TEMPLATE
    ChatAiChannelID=YOUR_DISCORD_CHANNEL_ID

Note

Some values like the prompt temperature are hard-coded inside the ObaBogaAPI module. All Models should always work as the hard-coded values are only having a effect on the LLM completion generation, but they won't always achieve the best results possible.

  1. Deploy the commands to your Discord guild
    node .\deploy-commands.js

(back to top)

Usage

These are just the basics; other commands are also available.

How do I start the bot?

Once you completed the installation steps, go into the project root directory and start the bot with

node .\index.js

During it's first execution, the bot should create a SQLite database.

How do I create a ObaBogaInstance?

To create a ObaBogaInstance, go into your discord server and write  /config ai_text_generation manage action:Create.

Each instance has it's own system prompt and chat history and you can switch between them without restarting the bot. For better results, I recommend including conversasion example at the end of your system prompt. If your bot name is potato and your user name is chicken the example should follow this format

chicken: Hi there
potato: Hi user, how do you feel today?
chicken: I feel great!

How do I load a ObaBogaInstance?

To load a ObaBogaInstance, go into your discord server and write  /config ai_text_generation select id:VALUE.

Note that if you've restarted the bot after loading a ObaBogaInstance, the bot will load the last used instance by default.

How do I edit a ObaBogaInstance?

Warning

If you're updating the instance currently loaded, you will need to reload the instance to get the new configuration

To edit a ObaBogaInstance, go into your discord server and write  /config ai_text_generation edit id:VALUE.

How can I delete the chat history of the ObaBogaInstance I'm currently using?

To clear your chat history, go into your discord server and write  /config ai_text_generation clear.

(back to top)

Ideas

(back to top)

Contributing

Note

Before making a pull request, please ensure that your code is easily readable and contains good enough comments in English. This will make it easy for everyone to understand the project.

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. Don't forget to give the project a star! Thanks again!

(back to top)

Acknowledgments

(back to top)

About

FoxyMoe is a discord bot written in nodejs with discord.js. This is a chat bot that communicates via the oobabooga webui API.

Topics

Resources

License

Stars

Watchers

Forks