C⁶H¹²O⁶
C⁶H¹²O⁶
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by C⁶H¹²O⁶ on 4/5/2024 in #djs-voice
How do i close a receiver subscription (opus stream)
setTimeout(() => this.connection.destroy(), after); this.emit('stop-listining-stream'); console.log(this.opusStream); return this; i have this code, this code must destroy the connection, but even if the connetion gets destroyed, the receiver subscribtion doesnt end ever, so how do i end it?
37 replies
DIAdiscord.js - Imagine an app
Created by C⁶H¹²O⁶ on 4/5/2024 in #djs-voice
the receiver subscription (opus stream) haves the end method = 0
createListeningStream(usersIds, writeStream) { const receiver = this.connection.receiver; this.opusStream = []; // console.log(usersIds); usersIds.forEach((userId) => { const opusStream = receiver.subscribe(userId); const opusDecoder = new prism.opus.Decoder({ frameSize: 960, channels: 2, rate: 48000, }); this.opusStream = opusStream; console.log(this.opusStream.end); opusStream.pipe(opusDecoder).pipe(writeStream); }); this.emit('create-listining-stream'); return this; } I think thats comming from the end behaviour that i had set
2 replies
DIAdiscord.js - Imagine an app
Created by C⁶H¹²O⁶ on 2/8/2024 in #djs-voice
How do I get a stream to the voice that the bot in
While the bot is in some voice channel, how do I get a stream for the voice channel? or at least for a person in channel I will loop over the users in the voice channel to make stream for them if this how it works
5 replies
DIAdiscord.js - Imagine an app
Created by C⁶H¹²O⁶ on 10/8/2023 in #djs-questions
TextChannel object
client.on('channelCreate', async (channel) => { }); This eventhandler, gives a TextChannel object, or VoiceChannel object, the question is, how do i know who created the channel?
14 replies
DIAdiscord.js - Imagine an app
Created by C⁶H¹²O⁶ on 10/4/2023 in #djs-questions
Wierd wierd problem
const emailSend = crypto.randomBytes(12).toString('hex'); const member = await msg.guild.members.fetch(msg.content); if (!member) return msg.channel.send('هذا الشخص غير موجود'); if (!msg.member.roles.cache.has('1066350005050425394')) return msg.channel.send('أنت لا تملك الصلاحيه للتفعيل'); const otp = crypto.randomBytes(12).toString('hex'); const user = new User({ name: member.user.displayName, role: 'discord-user', otp, email: emailSend, memberID: member.id, }); await user.save({ validateBeforeSave: false }); const dmChannel = await member.createDM(); dmChannel.send(مرحبا، نرجو تسجيل الدخول الى هذا الموقع، علما بأنه نشرك لهذا الرابط سيؤدي لتهكير حسابك); dmChannel.send( ${process.env.API_LIVE}/api/v1/users/link?otp=${otp}&email=${emailSend} ); I have this code here, this code runs on each message sent on some channel, am using discord.js, and mongoose models for this, so dont care for all of this, am using heroku for deploying this app, so the msg, is the msg that was send to the channel, in the development, so on my local computer when i send a message of id of member, it works just fine, but on heroku it makes a request for some reason here: ${process.env.API_LIVE}/api/v1/users/link?otp=${otp}&email=${emailSend} Thats really wierd
12 replies
DIAdiscord.js - Imagine an app
Created by C⁶H¹²O⁶ on 9/27/2023 in #djs-questions
voice channel
Why when i fetch a voice channel, and use the voiceChannel.members property, it works fine, but it does not refresh, like when someone leave, enter the voice channel, it do nothing, am making an API that is also combined with the discord bot for controll, this is the handler function: exports.getAllMembersInRoom = catchAsync(async (req, res, next) => { if (!req.params?.id) return next(new AppError('Please provice channel id', 400)); // Get the voice channel object for the voice room you want to list the members of. const voiceChannel = await client.channels.fetch(req.params.id); if (!voiceChannel) return next(new AppError(Invalid channel ID, 400)); if (!voiceChannel.isVoiceBased()) return next(new AppError(Please provide a voice channel ID, 400)); // Get the members of the voice channel. const members = voiceChannel.members; // Returning the members to the client res.status(200).json({ status: 'success', data: { members, }, }); });
9 replies