Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
how to use the message parameter outside of the `messageCreate`

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!