Rei-x / discord-speech-recognition

Speech to text extension for discord.js
https://npmjs.com/package/discord-speech-recognition
MIT License
56 stars 22 forks source link

Events dosn't fire when imported as ES6 module #63

Open fishylunar opened 1 year ago

fishylunar commented 1 year ago
import { Client, ChannelType, GatewayIntentBits, Events, Collection, Partials } from 'discord.js'
import { joinVoiceChannel } from '@discordjs/voice'
import { addSpeechEvent, SpeechEvents } from 'discord-speech-recognition'
const client = new Client({
  intents: [
    GatewayIntentBits.GuildVoiceStates,
    GatewayIntentBits.DirectMessages,
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildBans,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.DirectMessages,
    GatewayIntentBits.MessageContent],
  partials: [
    Partials.Channel,
    Partials.Message
  ]
})
addSpeechEvent(client, {
  lang: 'en-US'
})

in the messageCreate event i have this

      if (message.content === 'test-join') {
        const voiceChannel = message.member?.voice.channel
        if (voiceChannel) {
          return joinVoiceChannel({
            channelId: voiceChannel.id,
            guildId: voiceChannel.guild.id,
            adapterCreator: voiceChannel.guild.voiceAdapterCreator,
            selfDeaf: false
          })
        }
      }

And then

 client.on(SpeechEvents.voiceJoin, (out) => {console.log(out)})
  client.on(SpeechEvents.speech, (msg) => {
    console.log('speech')
    // If bot didn't recognize speech, content will be empty
    if (!msg.content) return
    console.log(msg.content)
    // msg.author.send(msg.content)
  })

but none of the events fire, neither the ´voiceJoin´ nor the ´speech´ event. Am i missing something super obvious?

retrouser955 commented 11 months ago

Having the same issue as well!