marian
marian
Explore posts from servers
KKord
Created by marian on 7/17/2024 in #help
Join voice channel
How can I make the bot join a voice channel? I couldnt find a method in VoiceChannel nor Member
2 replies
DIAdiscord.js - Imagine an app
Created by marian on 1/19/2024 in #djs-questions
Can you cache rest only?
is there a built in way to cache requests? (using rest only)
3 replies
DIAdiscord.js - Imagine an app
Created by marian on 7/9/2023 in #djs-voice
Not receiving events
so im trying to listen to voice events but i dont receive anything. I don't receive speaking events nor the received bytes... what could it cause? the bot is in my voice call and its not deafened AscShrug the code snippet:
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: guild.id,
selfDeaf: false,
selfMute: true,
adapterCreator: guild.voiceAdapterCreator,
})
const silentFrame = new Uint8Array([0xF8, 0xFF, 0xFE]);
connection.prepareAudioPacket(Buffer.from(silentFrame))
connection.dispatchAudio()

const receiver = connection.receiver;

class StreamTransform extends Transform {
constructor() {
super({objectMode: true});
}

_transform(data: Uint8Array, encoding: string, callback: () => void) {
console.log('Received data:', data);
// NEVER PRINTED OUT
this.push(data);
callback();
}
}

receiver.speaking.on("start", userId => {
// NEVER PRINTED OUT
console.log(userId + " is speaking")
const stream = receiver.subscribe(userId, {
end: {
behavior: EndBehaviorType.Manual
},
})
const transform = new StreamTransform()
pipeline(stream, transform, (error) => {
console.log("error")
})
})
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: guild.id,
selfDeaf: false,
selfMute: true,
adapterCreator: guild.voiceAdapterCreator,
})
const silentFrame = new Uint8Array([0xF8, 0xFF, 0xFE]);
connection.prepareAudioPacket(Buffer.from(silentFrame))
connection.dispatchAudio()

const receiver = connection.receiver;

class StreamTransform extends Transform {
constructor() {
super({objectMode: true});
}

_transform(data: Uint8Array, encoding: string, callback: () => void) {
console.log('Received data:', data);
// NEVER PRINTED OUT
this.push(data);
callback();
}
}

receiver.speaking.on("start", userId => {
// NEVER PRINTED OUT
console.log(userId + " is speaking")
const stream = receiver.subscribe(userId, {
end: {
behavior: EndBehaviorType.Manual
},
})
const transform = new StreamTransform()
pipeline(stream, transform, (error) => {
console.log("error")
})
})
@discordjs/voice ^0.16.0 discord.js ^14.11.0 Can anyone help me out?
3 replies
TTCTheo's Typesafe Cult
Created by marian on 6/30/2023 in #questions
Create a global "reactive" variable
Hello everyone, I want to have a global variable which is available both on client side components as well as server side components. Is this possible? My variable stores translations. I want to avoid passing them down as props but I can't figure out a way to make them available in every component. It's important that the value gets initialized on the server, because I read the data by using the file system. Also I'd like to be able to change the variable and with it all components using the variable should get updated. Thanks in advance!
7 replies