} catch { error

Hello the bot i was working on got into a problem when I updated the express and discord js in the packages


} catch {


SyntaxError: Unexpected token {

at createScript (vm.js:80:10)

at Object.runInThisContext (vm.js:139:10)

at Module._compile (module.js:617:28)

at Object.Module._extensions..js (module.js:664:10)

at Module.load (module.js:566:32)

at tryModuleLoad (module.js:506:12)

at Function.Module._load (module.js:498:3)

at Module.require (module.js:597:17)

at require (internal/module.js:11:18)

at Object.<anonymous> (/rbd/pnpm-volume/e3ef1a6a-78ba-402b-a021-c6f631173fb5/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/index.js:8:11)

Welcome to the Glitch Forums!

Can you give us some more context for this code, that snippet isn’t big enough to tell much of anything…

What kind of context? Because im also not sure where the error is because it is not showing in the code itself.

Whatever part of your code includes that catch statement.

///////////////////CONNECT TO VC
bot.on("message", message => {
  const args = message.content
    .split(/ +/g);
  const command = args.shift().toLowerCase();
  if (command === "join") {
    // Note that this will only work if the message was sent in a guild
    // and the author is actually in a voice channel.
    // You might want to check for all that stuff first
    const channel = message.member.voiceChannel;

      .then(connection => console.log("Connected!"))

and this one

else if (command === “prune”) {

  const amount = parseInt(args[0]) + 1;

  if (isNaN(amount)) {
    return message.reply("that doesn't seem to be a valid number.");
  } else if (amount <= 1 || amount > 100) {
    return message.reply("you need to input a number between 1 and 99.");

  message.channel.bulkDelete(amount, true).catch(err => {
      "there was an error trying to prune messages in this channel!"

i dont think its in this two command tho

these are the only commands that has catch in it

I dont know of this is still a problem but you should be able to fix this with updateing your node version to 12 or higher.