Events dosn't fire when imported as ES6 module
fishylunar opened this issue · 1 comments
fishylunar commented
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
Having the same issue as well!