I am having trouble getting the definition of the message parameter outside of the client.on('messageCreate', async message) event. Because I use discord-music-player it has its own events which are outside of the messageCreate event and the bot now cant send the message when I trigger a discord-music-player event.
So, how do I pass the message event into a discord-music-player event?
Perhaps you want to use a global variable. Declaring a variable outside the event will save the value.
var lastMessage = null
client.on("messageCreate", async message => {
lastMessage = message
//rest of your callback
})
//once a message is received, lastMessage will be the message object, updating on each message