Skip to content

This is a primitive Discord bot application to transcribe voice messages as text on command

License

Notifications You must be signed in to change notification settings

Oja95/discord-transcribe-bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audio message transcriber Discord bot

This project contains a basic Discord app written in JavaScript, built base on the getting started guide. It's goal is to obtain the latest (or specified) message that contains an audio recording attachment, send it to speech recongition AI and return the transcribed result back to Discord.

Project structure

Below is a basic overview of the project structure:

├── .env        -> sample .env file
├── app.js      -> main entrypoint for app
├── commands.js -> slash command payloads + helpers
├── utils.js    -> utility functions and enums
├── package.json
├── README.md
└── .gitignore

Running app locally

Before you start, you'll need to install NodeJS and create a Discord app with the proper permissions:

  • applications.commands
  • bot (with Send Messages & Read messages & Read chat history enabled)

Configuring the app is covered in detail in the getting started guide.

Setup project

First clone the project:

git clone [email protected]:Oja95/discord-transcribe-bot.git

Then navigate to its directory and install dependencies:

cd discord-transcribe-bot
npm install

Get app credentials

Fetch the credentials from your app's settings and add them to a .env file (see .env.sample for an example). You'll need your app ID (APP_ID), bot token (DISCORD_TOKEN), and public key (PUBLIC_KEY). Fetching Discord credentials is covered in detail in the getting started guide.

It is also possible to configure custom listening port for the HTTP server by setting the PORT environment attribute.

Additionally, this bot implementation relies on the DeepInfra Automatic Speech Recognition AI model, communicating it via API. One must configure DEEPINFRA_API_KEY token obtained from the said site.

Install slash commands

The commands for the example app are set up in commands.js. All of the commands in the ALL_COMMANDS array at the bottom of commands.js will be installed when you run the register command configured in package.json:

npm run register

Commands

This bot defines two commands:

  • /what-did-you-say - Fetches the last 50 messages sent in the channel where the command was invoked and looks up the latest message with voice message attachments.
  • /what-did-you-say-id <messageid> - Fetches the messsage with provided message identifier and assumes it has voice message attachment

Run the app

After your credentials are added, go ahead and run the app:

node app.js

⚙️ A package like nodemon, which watches for local changes and restarts your app, may be helpful while locally developing.

Other resources

  • Read the documentation for in-depth information about API features.
  • Browse the examples/ folder in this project for smaller, feature-specific code examples
  • Join the Discord Developers server to ask questions about the API, attend events hosted by the Discord API team, and interact with other devs.
  • Check out community resources for language-specific tools maintained by community members.

About

This is a primitive Discord bot application to transcribe voice messages as text on command

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%