Send dm from command file

Im trying to send a dm from a command file but when it runs it errors

ReferenceError: client is not defined


This is the full file part

        const text = interaction.options.getString('text');
        let users = []
        
        interaction.channel.members.forEach(member => {
            if (member.presence) {
                if (member.presence.status == 'online' && !member.user.bot) {
                    if (member.id == interaction.user.id) {

                    } else {
                        users.push(member.id);
                    }
                }
            }
        });

        let index = Math.floor(Math.random() * users.length); 
        let user = users[index]; 

        const embed = new EmbedBuilder()
        .setTitle("Here is a random message from someone")
        .setDescription(text)
        .setColor('Blurple');
      client.users.send(user, {embeds: [embed]});
      await interaction.reply({ content: 'Sent', ephemeral: true });
Was this page helpful?