removeListener of anonymous or imported function

Hello, I am currently building a bot that notifies people when someone goes live in a voice chat. The issue is, that when I want to remove the listener, I can't because it's an anonymous function. When I try to introduce an imported/required function, it crashes because oldState and newState are not defined. How can I remove the listener?
const notify = require(`${process.cwd()}/utils/notify`);

user.client.removeListener("voiceStateUpdate", notify(oldState, newState);
const notify = require(`${process.cwd()}/utils/notify`);

user.client.removeListener("voiceStateUpdate", notify(oldState, newState);
4 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ncls.
ncls.2y ago
And adding the Listener? Also an anonymous function or like in my post?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ncls.
ncls.2y ago
Thanks for your help! (Not)