DISCORD BOT PURGE COMMAND ERROR

Status
This thread has been locked.

FelixDev

Typical Developer and Designer
Premium
Feedback score
9
Posts
1,113
Reactions
331
Resources
0
Code:
// Commands
    if (msg.startsWith(prefix + 'purge')) {
      async function purge() {
        message.delete();

        if (!message.member.roles.find("name", "Hasses-Bästisar")){
          message.channel.send('Du behöver ha ranken hasses-bästisar för att använda purge commandot');
          return;
        }

        if (isNaN(args[0])) {
          // skickar ett meddelande i kanalen
          message.channel.send('Skriv number hur många messages du vill ta bort :) \n Skriv: ' + prefix + 'purge <nummer>');
          // Canclar skripten
          return;
        }

        const fetched = await message.channel.fetchMessage({limit: args[0]});
        console.log(fetched.size + ' messages found, deleting...');

        // Raderar meddelanden
        message.channel.bulkDelete(fetched)
                .catch(error => message.channel.send('Error: ${error}'));
      }

      purge();




    }
I got this code, To use a purge command but it gives me an error.
ERROR DOWN BELOW
Code:
Bot started
(node:3120) DeprecationWarning: Collection#find: pass a function instead
(node:3120) DeprecationWarning: Collection#find: pass a function instead
(node:3120) DeprecationWarning: Collection#find: pass a function instead
(node:3120) DeprecationWarning: Collection#find: pass a function instead
(node:3120) DeprecationWarning: Collection#find: pass a function instead
(node:3120) DeprecationWarning: Collection#find: pass a function instead
(node:3120) DeprecationWarning: Collection#find: pass a function instead
(node:3120) DeprecationWarning: Collection#find: pass a function instead
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

FelixDev

Typical Developer and Designer
Premium
Feedback score
9
Posts
1,113
Reactions
331
Resources
0

MarkFreak

Feedback score
11
Posts
558
Reactions
280
Resources
0
Not sure why you are declaring a function in the event and calling it there. For the error some function in your code is deprecated, should be on line 3210.
 

markd

plox.host
Supreme
Feedback score
56
Posts
644
Reactions
394
Resources
0
It's not an error everything will still work, but in the future version, you will only be able to use Collection#find with a function rather than a property-value-pair as you are using now.
 

FelixDev

Typical Developer and Designer
Premium
Feedback score
9
Posts
1,113
Reactions
331
Resources
0

FelixDev

Typical Developer and Designer
Premium
Feedback score
9
Posts
1,113
Reactions
331
Resources
0
Code:
<Collection>.find('property', value);    deprecated, but still works on stable for now (removed on master)

<Collection>.find(element => element.property === value);    pass a function instead
Could you add me on dsicord, Didnt really understand where to get in that. L00ting#8928
 
Status
This thread has been locked.
Top