Q:

TypeError: message.guild.members.filter is not a function

I'm new in bot developing. 
I'm trying to use a bot coded by another developer then I faced this TypeError error. 
Can anybody help me to get rid of this? I badly need help to fix this error. 
The code is given below:
const Discord = require("discord.js");
const client = new Discord.Client();
var prefix = "+";

client.on("message", message => {

    if (message.content.startsWith(prefix + "dm")) {
        if (!message.member.hasPermission("ADMINISTRATOR")) return;
        let args = message.content.split(" ").slice(1);
        var argresult = args.join(' ');
        message.guild.members.filter(m => m.presence.status !== 'offline').forEach(m => {
            m.send(`${argresult}\n ${m}`);
        })
        message.channel.send(`\`${message.guild.members.filter(m => m.presence.status !== 'online').size}\` **MESSAGE SENT** `);
        message.delete();
    };
});

Output:
 message.guild.members.filter(m => m.presence.status !== 'offline').forEach(m => {
                        ^

TypeError: message.guild.members.filter is not a function
    at Client.<anonymous> (C:\Users\ErfanAlin\Desktop\DM BOT V2\index.js:11:25)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\ErfanAlin\Desktop\DM BOT V2\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ErfanAlin\Desktop\DM BOT V2\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\ErfanAlin\Desktop\DM BOT V2\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (C:\Users\ErfanAlin\Desktop\DM BOT V2\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (C:\Users\ErfanAlin\Desktop\DM BOT V2\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (C:\Users\ErfanAlin\Desktop\DM BOT V2\node_modules\discord.js\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\ErfanAlin\Desktop\DM BOT V2\node_modules\discord.js\node_modules\ws\lib\websocket.js:800:20)

A:

In Discord.js V12 things changed a bit. You can read more about it here.
const OnlineMembers = message.guild.members.cache.filter(member => member.presence.status !== "offline").map(member => member.user.username).join(", ");
message.channel.send(OnlineMembers);

// Filter: Removes the offline members from the array.
// Map: Maps the array by username.
// Join: Transforms the array into a string by concatenating all of the elements in an array

