Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rei-x/discord-speech-recognition
Speech to text extension for discord.js
https://github.com/rei-x/discord-speech-recognition
discord discord-bot discord-js hacktoberfest speech-recognition speech-to-text
Last synced: 9 days ago
JSON representation
Speech to text extension for discord.js
- Host: GitHub
- URL: https://github.com/rei-x/discord-speech-recognition
- Owner: Rei-x
- License: mit
- Created: 2021-05-11T13:26:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-30T15:02:59.000Z (over 1 year ago)
- Last Synced: 2024-12-20T06:06:03.634Z (9 days ago)
- Topics: discord, discord-bot, discord-js, hacktoberfest, speech-recognition, speech-to-text
- Language: TypeScript
- Homepage: https://npmjs.com/package/discord-speech-recognition
- Size: 543 KB
- Stars: 57
- Watchers: 3
- Forks: 23
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Discord Speech Recognition Extension
This is an extension for [discord.js](https://discord.js.org) library that makes creating discord speech recognition bots as easy as common text bots.
## Installation
**Discord.js v14**:
```
npm i discord-speech-recognition
```Checkout simpleBot example in examples directory for ready-to-use bot.
**Discord.js v13**:
```
npm i discord-speech-recognition@2
```**Discord.js v12**:
```
npm i discord-speech-recognition@1
```## Docs
## Example usage for discord.js v14
```javascript
const { Client, GatewayIntentBits, Events } = require("discord.js");
const { joinVoiceChannel } = require("@discordjs/voice");
const { addSpeechEvent, SpeechEvents } = require("discord-speech-recognition");const client = new Client({
intents: [
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
],
});
addSpeechEvent(client);client.on(Events.MessageCreate, (msg) => {
const voiceChannel = msg.member?.voice.channel;
if (voiceChannel) {
joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator,
selfDeaf: false,
});
}
});client.on(SpeechEvents.speech, (msg) => {
// If bot didn't recognize speech, content will be empty
if (!msg.content) return;msg.author.send(msg.content);
});client.on(Events.ClientReady, () => {
console.log("Ready!");
});client.login("token");
```You need to enable message content for this example, so it can react to messages in chat.
![](https://i.imgur.com/06doHXE.png)