roleMembers.slice is not a function

So I have a problem: I wan't to fetch members and see if they have a role and then get the first then and splice them so I can do something with every single members of those 10 but I can't even splice them Code:
client.on('ready', async () => {
const guild = client.guilds.cache.get('1038758589055127604');

guild.members.fetch().then(members => {
const roleMembers = members.filter(member => {member.roles.cache.has('1050754704776372294')});

const firstTenMembers = roleMembers.slice(0, 10)

const firstMember = firstTenMembers[0]
const secondMember = firstTenMembers[1]
const thirdMember = firstTenMembers[2]
const fourthMember = firstTenMembers[3]

//then i want to put it in a Canvas

});
client.on('ready', async () => {
const guild = client.guilds.cache.get('1038758589055127604');

guild.members.fetch().then(members => {
const roleMembers = members.filter(member => {member.roles.cache.has('1050754704776372294')});

const firstTenMembers = roleMembers.slice(0, 10)

const firstMember = firstTenMembers[0]
const secondMember = firstTenMembers[1]
const thirdMember = firstTenMembers[2]
const fourthMember = firstTenMembers[3]

//then i want to put it in a Canvas

});
Error:
Unhandled promise rejection: TypeError: roleMembers.slice is not a function
at C:\Users\freie\Desktop\Strandbots\bademeisterv2\main.js:73:39
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Unhandled promise rejection: TypeError: roleMembers.slice is not a function
at C:\Users\freie\Desktop\Strandbots\bademeisterv2\main.js:73:39
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Bene
BeneOP2y ago
discord.js v13 Node 18
Want results from more Discord servers?
Add your server