TypeError: member.roles.add is not a function

I’m working on a bot that needs to check some things before giving/removing a role from a user, but for some reason, the .has(), .some(), .add() and, .remove() functions don’t work.

Here’s my code:

const Permissions = require('discord.js');

function isAdmin(member) {
    return member.permissions.has(Permissions.FLAGS.ADMINISTRATOR);
}

function hasRole(member, roleID) {
    return member.roles.some(role => role.id === roleID);
}

function giveRole(member, role) {
    member.roles.add(role)
}

function removeRole(member, role) {
    member.roles.remove(role);
}

Here’s the full error that I get:

TypeError: member.roles.add is not a function
    at Object.giveRole (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTutil.js:101:30)
    at Object.buttonClicked (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTcommandsbuttonRoleexecute.js:23:14)
    at WebSocketManager.<anonymous> (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTindex.js:101:28)
    at WebSocketManager.emit (node:events:390:28)
    at WebSocketShard.onMessage (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTnode_modulesdiscord.jssrcclientwebsocketWebSocketShard.js:300:54)
    at WebSocket.onMessage (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTnode_moduleswslibevent-target.js:199:18)
    at WebSocket.emit (node:events:390:28)
    at Receiver.receiverOnMessage (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTnode_moduleswslibwebsocket.js:1137:20)
    at Receiver.emit (node:events:390:28)
    at Receiver.dataMessage (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTnode_moduleswslibreceiver.js:528:14)
    at Receiver.getData (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTnode_moduleswslibreceiver.js:446:17)
    at Receiver.startLoop (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTnode_moduleswslibreceiver.js:148:22)
    at Receiver._write (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTnode_moduleswslibreceiver.js:83:10)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at Receiver.Writable.write (node:internal/streams/writable:334:10)
    at TLSSocket.socketOnData (C:UsersAdminOneDriveDocumentsGithub ProjectsdiscordBots-BOK-BOTnode_moduleswslibwebsocket.js:1231:35)
    at TLSSocket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:199:23)