V3RM1N
V3RM1N
DIAdiscord.js - Imagine an app
Created by V3RM1N on 12/7/2023 in #djs-questions
Fetching / Getting the id of a subcommand in a subcommandgroup
Thanks man
10 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 12/7/2023 in #djs-questions
Fetching / Getting the id of a subcommand in a subcommandgroup
No description
10 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 12/7/2023 in #djs-questions
Fetching / Getting the id of a subcommand in a subcommandgroup
const rest = new REST({ version: '10' }).setToken(process.env.TOKEN)

const commands = await rest.get(
Routes.applicationCommands(process.env.DISCORD_APPLICATION_ID)
)

const helpEmbed = new EmbedBuilder()
.setTitle('Help')
.setDescription('Here are all of my commands\r------------------')
.setAuthor({ name: interaction.client.user.tag })
.setThumbnail(
interaction.client.user.displayAvatarURL({ dynamic: true })
)
.setFooter({ text: `Note: More commands will be added soon` })

commands.forEach((command) => {
if (command.name === 'Info') return
helpEmbed.addFields({
name: `</${command.name}:${command.id}>`
? `</${command.name}:${command.id}>`
: 'No name',
value: `${
command.description ? command.description : 'No description'
}`,
})
})
const rest = new REST({ version: '10' }).setToken(process.env.TOKEN)

const commands = await rest.get(
Routes.applicationCommands(process.env.DISCORD_APPLICATION_ID)
)

const helpEmbed = new EmbedBuilder()
.setTitle('Help')
.setDescription('Here are all of my commands\r------------------')
.setAuthor({ name: interaction.client.user.tag })
.setThumbnail(
interaction.client.user.displayAvatarURL({ dynamic: true })
)
.setFooter({ text: `Note: More commands will be added soon` })

commands.forEach((command) => {
if (command.name === 'Info') return
helpEmbed.addFields({
name: `</${command.name}:${command.id}>`
? `</${command.name}:${command.id}>`
: 'No name',
value: `${
command.description ? command.description : 'No description'
}`,
})
})
10 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 12/7/2023 in #djs-questions
Fetching / Getting the id of a subcommand in a subcommandgroup
well no it works like i said perfectly for those commands with no subcommandgroups
10 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 12/7/2023 in #djs-questions
Fetching / Getting the id of a subcommand in a subcommandgroup
doesnt work
10 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 12/7/2023 in #djs-questions
Fetching / Getting the id of a subcommand in a subcommandgroup
wait ill give you some code
10 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 12/7/2023 in #djs-questions
Fetching / Getting the id of a subcommand in a subcommandgroup
but where the f are they stored then
10 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 12/7/2023 in #djs-questions
Fetching / Getting the id of a subcommand in a subcommandgroup
well yes and no you are able to copy a command id from a subcommand so somewhere have they have to be stored
10 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 5/3/2023 in #djs-questions
Welcome message send twice
Well this is interesting now, after adding this line the "bug" disappeared
5 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 5/3/2023 in #djs-questions
Welcome message send twice
Nope and nope
5 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 2/22/2023 in #djs-questions
How to fetch all online users in a guild, including idle and dnd
Found a solution doing it this way:
let onlineUsers = guild.members.cache.filter(member => (member.presence?.status === 'online' ||
member.presence?.status === 'idle' ||
member.presence?.status === 'dnd') &&
!member.user.bot)
.size;
let onlineUsers = guild.members.cache.filter(member => (member.presence?.status === 'online' ||
member.presence?.status === 'idle' ||
member.presence?.status === 'dnd') &&
!member.user.bot)
.size;
Thanks for your help
15 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 2/22/2023 in #djs-questions
How to fetch all online users in a guild, including idle and dnd
Is enables in developer portal and intents are right, and its just my testbot on my test server so only one, but i need the loop for my main bot with 10+ servers
15 replies
DIAdiscord.js - Imagine an app
Created by V3RM1N on 2/22/2023 in #djs-questions
How to fetch all online users in a guild, including idle and dnd
Had to change the loop to a for loop and made the execution async (commeted out the interval)
for (const guild of client.guilds.cache) {
if (fs.existsSync('./config/' + guild.id + '.json') === false) continue;
//Get all online users from guild
const members = await guild.members.fetch();
console.log(members)
let onlineUsers = members.filter(member => member.presence?.status === ('online' || 'dnd' || 'idle') && !member.user.bot).size;
let config = JSON.parse(fs.readFileSync('./config/' + guild.id + '.json', 'utf8'));
if (!config.onlineChannel) continue;
guild.channels.edit(config.onlineChannel, {name: `Online: ${onlineUsers}`});
if (!config.allChannel) continue;
guild.channels.edit(config.allChannel, {name: `Members: ${guild.memberCount}`});
if (!config.botChannel) continue;
guild.channels.edit(config.botChannel, {name: `Bots: ${guild.members.cache.filter(member => member.user.bot).size}`});
}
for (const guild of client.guilds.cache) {
if (fs.existsSync('./config/' + guild.id + '.json') === false) continue;
//Get all online users from guild
const members = await guild.members.fetch();
console.log(members)
let onlineUsers = members.filter(member => member.presence?.status === ('online' || 'dnd' || 'idle') && !member.user.bot).size;
let config = JSON.parse(fs.readFileSync('./config/' + guild.id + '.json', 'utf8'));
if (!config.onlineChannel) continue;
guild.channels.edit(config.onlineChannel, {name: `Online: ${onlineUsers}`});
if (!config.allChannel) continue;
guild.channels.edit(config.allChannel, {name: `Members: ${guild.memberCount}`});
if (!config.botChannel) continue;
guild.channels.edit(config.botChannel, {name: `Bots: ${guild.members.cache.filter(member => member.user.bot).size}`});
}
but the looks like the isnt coming to action cuz the console.log(members) isnt called
15 replies