3.4.1 • Published 12 months ago

discord-speech-recognition v3.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Discord Speech Recognition Extension

This is an extension for discord.js 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

https://discordsr.netlify.app/

Example usage for discord.js v14

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.

npm.io

3.4.0

12 months ago

3.4.1

12 months ago

3.3.1

1 year ago

3.3.0

1 year ago

3.1.2

1 year ago

3.2.0

1 year ago

3.1.1

2 years ago

3.0.2

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

2.2.0

2 years ago

2.1.1

3 years ago

2.0.2

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.0-beta.0

3 years ago

1.1.0

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago