title: i am trying to make a discord bot using discord.js and im making an even handler but im getting this error
body: <pre><code>SyntaxError: Unexpected token 'const'
      at Object.compileFunction (node:vm:352:18)
      at wrapSafe (node:internal/modules/cjs/loader:1032:15)
      at Module._compile (node:internal/modules/cjs/loader:1067:27)
      at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
      at Module.load (node:internal/modules/cjs/loader:981:32)
      at Function.Module._load (node:internal/modules/cjs/loader:822:12)
      at Module.require (node:internal/modules/cjs/loader:1005:19)
      at require (node:internal/modules/cjs/helpers:102:18)
      at Client.client.loadEvents (/Users/jacobzaldivar/Desktop/bot/index.js:21:38)
      at Object.&lt;anonymous&gt; (/Users/jacobzaldivar/Desktop/bot/index.js:23:8)
  (base) jacobzaldivar@jacobs-mbp bot % 
  </code></pre>
  <p>here's my code if you need it</p>
  <pre class="lang-js prettyprint-override"><code>const bot = require(&quot;..&quot;)
  const { getFiles } = require(&quot;../util/functions&quot;)
  
  module.exports = (bot, reload) =&gt; {
      const {client} = bot
  
      let events = getFiles(&quot;../events/&quot;, &quot;.js&quot;)
  
      if (events.length === 0){
          console.log(&quot;No events to load&quot;)
      }
  
      events.forEach((f, i) =&gt; {
          if (reload)
              delete require.cache[require.resolve(`../events/${f}`)]
          const event = require(`../events/${f}`)
          client.events.set(event.name, event)
  
          if (!reload)
              console.log(`${i + 1}. ${f} loaded`)
      })
  
      if (!reload)
          initEvents(bot)
  
  }
  
  function triggerEventHandler(bot, event, ...args)
      const {client} = bot
  
      try {
          if (client.events.has(event))
              client.events.get(event).run(bot, ...args)
          else
              throw new Error(`Event ${event} does not exist`)
      }
      catch(err){
          console.error(err)
      }
  function initEvents(bot) {
      const {client} = bot
  
      client.on(&quot;ready&quot;, () =&gt; {
          triggerEventHandler(bot, &quot;ready&quot;)
      })
  }
  </code></pre>