F
F
Felisia2020-01-09 19:17:43
Node.js
Felisia, 2020-01-09 19:17:43

Why does ParsingError:Unexpected token occur?

I'm making my own discord bot, trying to make a command to delete messages, but for some reason some error appears, and I don't know how to fix it.

const Discord = require("discord.js");
const fs = require("fs");
module.exports.run = async (bot, message, args) => {
  if(message.content.startsWith(prefix + "clear")){
    if(!message.member.hasPermission("MANAGE_MESSAGES"))return(message.reply("you need to have \`MANAGE_MESSAGES\` permission to do that"));
    let howManyDelete = args[1];
    if(!howManyDelete)return(message.reply("please enter how many messages you want to delete"));
    if(howManyDelete < 1)return(message.reply("please enter number more than 1"));
    if(howManyDelete > 100)return(mesasge.reply("please enter number lower than 100"));
    await message.channel.bulkDelete(howManyDelete);
    message.channel.send(`Deleted \`${howManyDelete}\` messages`);
  };

  module.exports.help = {
  name: "clear"
};

Tell me what can be done

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Adam Salavatov, 2020-01-11
@LemonChik63

This error is related to the token. Your token is invalid, insert a new token into your bot.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question