M7MD
M7MD
DIdiscord.js - Imagine ❄
Created by M7MD on 12/10/2024 in #djs-voice
Detect Move
How to detect if a member moved from a voice to another i tried using:
if(oldState.channelId !== null && newState.channelId !== null) {}
if(oldState.channelId !== null && newState.channelId !== null) {}
but if someone selfmute or selfdeaf them selfs it will count as a move
3 replies
DIdiscord.js - Imagine ❄
Created by M7MD on 11/9/2024 in #djs-voice
bot leave voice channel after a while
My bot leaves voice channel after a while so i let him join the vc every 30m but it works only on one server it doesn't work on all servers im going to send my ready.js file because it has the joining vc code
const color = require('chalk')
const { joinVoiceChannel } = require('@discordjs/voice');
const guildSchema = require('../MongoDB/Schema/guildSchema');
const { EmbedBuilder } = require('discord.js');

module.exports = {
name: 'ready',
async execute(client) {
client.guilds.cache.forEach(async(guild) => {
try {
let data = await guildSchema.findOne({ guildId: guild.id }) || null
if(data !== null && data.voiceChannel) channel = guild.channels.cache.get(data?.voiceChannel) || null
if(data !== null) {
setInterval(()=> {
client.VoiceIDS.push(channel?.id)
if(data !== null && data.premium === "None Version") return;
}, 5_000)
if(data.premium === "Plus Version" || data.premium === "Premium Version") {
if(channel === null) return;
setTimeout(()=> {
connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});

return console.log(`Connection Started in ${channel.id}`)
})
setInterval(() => {
connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});

return console.log(`Connection Started in ${channel.id}`)
}, 60_000 * 30)
}
}
} catch(e) {
console.log(e)
}
})
}
}
const color = require('chalk')
const { joinVoiceChannel } = require('@discordjs/voice');
const guildSchema = require('../MongoDB/Schema/guildSchema');
const { EmbedBuilder } = require('discord.js');

module.exports = {
name: 'ready',
async execute(client) {
client.guilds.cache.forEach(async(guild) => {
try {
let data = await guildSchema.findOne({ guildId: guild.id }) || null
if(data !== null && data.voiceChannel) channel = guild.channels.cache.get(data?.voiceChannel) || null
if(data !== null) {
setInterval(()=> {
client.VoiceIDS.push(channel?.id)
if(data !== null && data.premium === "None Version") return;
}, 5_000)
if(data.premium === "Plus Version" || data.premium === "Premium Version") {
if(channel === null) return;
setTimeout(()=> {
connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});

return console.log(`Connection Started in ${channel.id}`)
})
setInterval(() => {
connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});

return console.log(`Connection Started in ${channel.id}`)
}, 60_000 * 30)
}
}
} catch(e) {
console.log(e)
}
})
}
}
13 replies
DIdiscord.js - Imagine ❄
Created by M7MD on 8/9/2024 in #djs-voice
My bot does not run the audio
hey my bot works totally fine in my device but when the bot in a server the audio does not play everything is latest version
4 replies
DIdiscord.js - Imagine ❄
Created by M7MD on 6/28/2024 in #djs-questions
Can i change custom invite link using discord.js
Hello i was wondering if i can change a custom invite link using discord.js if i can please tell me or send me anything about it.
8 replies
DIdiscord.js - Imagine ❄
Created by M7MD on 1/26/2024 in #djs-voice
Error: FFmpeg/avconv not found!
everytime i run the code it says the error on the title code:
const { Events } = require('discord.js');

module.exports = {
name: Events.ClientReady,
execute(client) {
console.log(`Ready! Logged in as ${client.user.tag}`);
const { joinVoiceChannel } = require('@discordjs/voice');
let channel = client.channels.cache.get('871129812046082078')
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});
const { createAudioPlayer, NoSubscriberBehavior, createAudioResource, StreamType } = require('@discordjs/voice');
const { join } = require('node:path');
const { createReadStream } = require('node:fs');
const player = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause,
},
});

const resource = createAudioResource(createReadStream(join('./test.webm')));

player.play(resource);
},
};
const { Events } = require('discord.js');

module.exports = {
name: Events.ClientReady,
execute(client) {
console.log(`Ready! Logged in as ${client.user.tag}`);
const { joinVoiceChannel } = require('@discordjs/voice');
let channel = client.channels.cache.get('871129812046082078')
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});
const { createAudioPlayer, NoSubscriberBehavior, createAudioResource, StreamType } = require('@discordjs/voice');
const { join } = require('node:path');
const { createReadStream } = require('node:fs');
const player = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause,
},
});

const resource = createAudioResource(createReadStream(join('./test.webm')));

player.play(resource);
},
};
14 replies