SYSTEM NOTICE

Auto translation by AI. Be sure, accuracy, nuances and authorial intent may not be fully reflected.
見出し画像

Introduction and Explanation of a Discord AI Bot Developed and Implemented for Live Streaming

This time, I developed an AI Bot that recognizes and speaks to multiple speakers during a live stream on a Discord server and had VTubers actually use it, so I will share the mechanism, how to use it, and the system details.

*Regarding the publication of this article, we have received prior permission from the members of "Hetakuso Valo-bu" to post it.

Also, since this system was newly developed in response to this consultation, practicality such as setup has not been considered, so environment construction is a bit troublesome.

There is also a Streaming Partner AI System released as a product that is similar to this, so please check it out if you are interested.

*Last update of this article: 2026/7/31


System Overview

https://github.com/yuki-dev26/discord-ai-streamer

First, I will introduce what this system can do.

  • It listens to the audio of each participant in a Discord voice channel and responds with voice periodically (default interval is 1 minute).

Periodic Response
  • It listens to the audio of each participant in a Discord voice channel and responds with voice at the timing when a button is pressed (the button can be pressed by anyone in the server, and it is also possible from the smartphone app).

Response at Desired Timing

You can converse with the Discord AI Bot using mainly two patterns of your choice.

If you want it to react automatically, you can use the periodic method, and if you want it to react manually at your preferred timing, you can use the button press method.


Environment Construction

First, I will summarize the environment construction required to use this system (*This article explains for Windows, but the system itself can also be used on Mac).

  • Node.js (LTS 22.xx.x recommended). Also, Microsoft C++ Build Tools might be required.

winget install ffmpeg
  • OpenAI API -> Used for answer generation and speech recognition.

  • Aivis Cloud API -> Used for the AI voice part.

This time, I collaborated with the VTuber (Naruki) to build a synthetic voice model; please refer to the following article for instructions on how to create one.

*If you find the difficulty level too high, paid assistance is also available.


Creating and Inviting a Discord Bot

First, as a preliminary step, turn on Developer Mode in Discord.

Turn on Developer Mode

Next, access Discord for Developers to create your bot.

https://discord.com/developers/applications
Name it and create it

Once created, proceed to configure the bot settings. First, set the app icon and description in the General Information section as needed. (If you are only using it among friends, just the name and icon should suffice.)

Set the name, icon, etc.

Make the Bot Private (Optional)

*This setting is for making the bot private if you do not intend to make it public.

Once you have set the basic information, navigate to the Installation settings, set the "Install Link" section to "Off," and save.

Turn off the install link

Then, navigate to the Bot page and turn off the "Public Bot" section.

Turn off Public Bot

Invite the Bot to the Server

Navigate to the OAuth2 page and check the following boxes in the "Scopes" section.

  • bot

  • applications.commands

Scroll down and check the following items under "Bot Permissions" as well.

  • View Channels

  • Send Messages

  • Read Message History

  • Connect

  • Speak

  • Use Voice Activity

Once you have finished checking, scroll down and open the generated URL.

You will then see a connection prompt on Discord; select the server you want to add it to and proceed with the addition.

Authenticate on Discord

The bot will now be added to your Discord server.

By the way, the items you checked earlier will revert if you reload the page, but please rest assured that this is normal behavior.


System Sharing and Usage

These are the actual system files.

git clone https://github.com/yuki-dev26/discord-ai-streamer.git
https://github.com/yuki-dev26/discord-ai-streamer/releases

It is released under the MIT license.


Filling in .env and Character Settings

First, I will explain the main environment variable settings. (I will omit the OpenAI and Aivis Cloud API settings as they are explained in a separate article.)

DISCORD_TOKEN: Enter the string that can be obtained by resetting the "Token" section on the Bot page.

DISCORD_TOKEN

DISCORD_CLIENT_ID: Please enter the Client ID from the OAuth2 page.

DISCORD_CLIENT_ID

Once the .env file configuration is complete, enter the bot's character settings in prompts/system.md, and you are ready to go.


How to use the system

First, run the following command to install the dependencies.

npm install

Next, the command to start the system is as follows.

npm run dev

This will launch the system, and the flow is to join a Discord voice channel and call the bot.
*For Windows environments, a start.bat file is provided, so you can achieve the same result by running that.

The specifications are as follows:

  • Automatic periodic response: /join

  • Manual button response: /talk (The button can be pressed by anyone in the server, and it is also possible from the smartphone app)

When you send this command in a channel, the bot will enter the voice channel.

Specifications differ depending on the entry command

When you speak while the bot is in the voice channel,

  1. Transcription via OpenAI Transcriptions API

  2. Response generation via OpenAI Responses API

  3. Voice generation and response via Aivis Cloud API

The bot will respond based on what is said during the stream following this flow.

Also, since it recognizes speech content for each user in the voice channel, it is useful for streams with multiple people like this one.


Conclusion

What did you think of this system, which I developed to allow voice conversations with a Discord AI bot and which has actually been used by VTubers?

It was a fresh implementation, incorporating features like "periodic responses every XX minutes" and "button responses at arbitrary timings" so that it can also be used during streams.

Also, since this system is intended for one-time use, there are no plans for future maintenance, but please contact me if you have any requests or encounter critical bugs.

I also recommend customizing it yourself!
For example, by making the voice and speech recognition parts local.

That is all, see you later 👋

いいなと思ったら応援しよう!