Home
Blog
How to build a voice-to-text Discord bot with Gladia real-time transcription API

How to build a voice-to-text Discord bot with Gladia real-time transcription API

How to build a voice-to-text Discord bot with Gladia real-time transcription API
Published on
Mar 2024

Discord, the leading communication platform for gamers and communities, is designed for seamless communication with other users, be it through text channels, DMs, 1-1 calls or even collective voice channels.

Based on multiple request from our Discord members, we’ve built a custom JavaScript bot that makes use of Gladia’s live transcription API to transcribe speech in real time directly on the Discord server.

What can you do with Discord bot?

First, you can transcribe voice in real time directly on Discord’s voice channels. Ex. you’re streaming a game on Discord and want to access some learnings and tips received during the sessions. Or, you’re having your group gathers on the platform and want to be able to review the talking points after – just like with any other virtual meeting platform. 

Beyond that, a bot like this could be used for real-time moderation to flag hate speech and ban users. With additional tools like ChatGPT, you could also create command-based notes to provide meeting summaries and helps you catch up with meetings you may have missed.

Screenshot of a transcription bot on Discord

How to implement the Discord.js v14 bot + Gladia real-time transcription

Step 1: Register your bot

Create a Discord bot that you'd like to use for transcription. If you’ve never  built one before, here’s a useful resource to help.

First, install all the required package by running:


npm install

Then, you will to setup the index.js script with your Discord keys, guild ID (Server ID), and the Voice Channel ID.

Step 2: Retrieve API key

Sign up for our speech-to-text API at app.gladia.io and obtain your API key. Documentation for Gladia live transcription can be found here.

Step 3:  Code integration

Once everything is set up properly, simply run:


npm run start YOUR_GLADIA_TOKEN

Your bot should then join the channel corresponding to the channel ID you configured in the index.js file.

 Step 4: Configure Discord permissions

  • Make sure your bot is invited on the server;
  • Give the bot the required voice permissions.

Bear in mind that the current v1 implementation of the bot is not fully optimized, so you might experiences inaccuracy regarding language changes & words.

And you’re good to go!

🔗 Source GitHub repository is available here.

We hope you enjoyed this short tutorial. Given how much audio data still goes to wasted, we’re always curious to explore the many ways in which transcription tech can be used to remedy that. Let us know if you went on to build a bot or used our API for others apps on Discord or beyond, we’d love to hear from you. 

About Gladia

At Gladia, we built an optimized version of Whisper in the form of an API, adapted to real-life use cases and distinguished by exceptional accuracy, speed, extended multilingual capabilities and state-of-the-art features, including speaker diarization and word-level timestamps.

Contact us

280
Your request has been registered
A problem occurred while submitting the form.

Read more

Product News

Our Road to Real-Time Audio AI – with $16M in Series A funding

Real-time audio AI is transforming the way we work and build software. With instant insights from every call and meeting at their fingertips, customer support agents and sales reps will be able to reach new levels of efficiency and deliver a more delightful customer experience across borders.

Product News

Gladia selected to participate in the 2024 AWS Generative AI Accelerator

We’re proud to announce that Gladia has been selected for the second cohort of the AWS Generative AI Accelerator, a global program offering top early-stage startups that are using generative AI to solve complex challenges, learn go-to-market strategies, and access to mentorship and AWS credits.

Tutorials

How to implement advanced speaker diarization and emotion analysis for online meetings

In our previous article, we discussed how to unlock some of that data by building a speaker diarization system for online meetings (POC) to identify speakers in audio streams and provide organizations with detailed speaker-based insights into meetings, create meeting summaries, action items, and more.