discord.js语法错误:无效或意外的令牌

问题描述 投票:-3回答:1

我知道之前曾有人问过这个问题,但是我找不到解决方案,或者为什么我的机器人正在这样做,我对此没有任何解决方案。如果您能帮助我,我将非常感激。

SyntaxError:无效或意外的令牌

<<

IP地址是以人类可读的符号编写和显示的,例如IPv4中的172.16.254.1,以及IPv6中的2001:db8:0:1234:0:567:8:1。通过在地址后缀有效位数(例如192.168.1.15/24),以CIDR表示法指定地址的路由前缀的大小,该地址等同于历史上使用的子网掩码255.255.255.0。IP地址空间由Internet号码分配机构(IANA)以及五个在其指定地区负责分配给本地Internet注册表(例如Internet服务提供商)和其他最终用户的区域Internet注册表(RIR)进行全局管理。 IANA将IPv4地址分配给RIR,每个地址块大约有1680万个地址,但自2011年以来,在IANA级别上已经用尽。仅其中一个RIR仍可提供非洲的本地分配。[6]

网络管理员为连接到网络的每个设备分配IP地址。此类分配可以基于静态(固定或永久)或动态进行,具体取决于网络实践和软件功能。

const Discord = require("discord.js"); const bot = new Discord.Client(); const prefix = "/"; var fs = require("fs"); var lineReader = require("line-reader"); var async = require("async"); const firstline = require("firstline"); const generated = new Set(); bot.on("ready", () => { console.log(`Logged in as ${bot.user.tag}!`); }); bot.on("message", message => { if (message.channel.id === "INSERT_CHANNEL_ID") { //channel id here if (message.author.bot) return; var command = message.content .toLowerCase() .slice(prefix.length) .split(" ")[0]; if (command === "test") { message.channel.send("Test done, bot's working"); } if (command === "gen") { if (generated.has(message.author.id)) { message.channel.send( "Wait 15 minute before generating another account!. - " + message.author ); } else { let messageArray = message.content.split(" "); let args = messageArray.slice(1); if (!args[0]) return message.reply("Please, specify the service you want!"); var fs = require("fs"); const filePath = __dirname + "/" + args[0] + ".txt"; fs.readFile(filePath, function(err, data) { if (!err) { data = data.toString(); var position = data.toString().indexOf("\n"); var firstLine = data.split("\n")[0]; message.author.send(firstLine); if (position != -1) { data = data.substr(position + 1); fs.writeFile(filePath, data, function(err) { const embed = { title: "Account Generated!", description: "Check your dm for the account's information!", color: 8519796, timestamp: "2019-04-04T14:16:26.398Z", footer: { icon_url: "https://cdn.discordapp.com/avatars/530778425540083723/7a05e4dd16825d47b6cdfb02b92d26a5.png", text: "Buy discord accounts from Mental#1424" }, thumbnail: { url: "http://www.compartosanita.it/wp-content/uploads/2019/02/right.png" }, author: { name: "Account Generator", url: "https://discordapp.com", icon_url: bot.displayAvatarURL }, fields: [] }; message.channel.send({ embed }); generated.add(message.author.id); setTimeout(() => { // Removes the user from the set after a minute generated.delete(message.author.id); }, 150000); if (err) { console.log(err); } }); } else { message.channel.send( "Sorry, there isn't any account avaible for that service!" ); } } else { message.channel.send( "Sorry, that service doesen't exists on our database" ); } }); } } if (command === "help") { const embed = { title: "Anarchy Account Generator", description: "Informations", color: 8519796, timestamp: "2019-04-04T14:16:26.398Z", footer: { icon_url: "https://cdn.discordapp.com/avatars/530778425540083723/7a05e4dd16825d47b6cdfb02b92d26a5.png", text: "Buy discord accounts from Mental#1424" }, thumbnail: { url: "http://www.compartosanita.it/wp-content/uploads/2019/02/right.png" }, author: { name: "Account Generator", url: "https://discordapp.com", icon_url: bot.displayAvatarURL }, fields: [ { name: "Bot made by", value: "Mental#1424" } ] }; message.channel.send({ embed }); } if (command === "restock") { let messageArray = message.content.split(" "); let args = messageArray.slice(1); if (!message.member.hasPermission("ADMINISTRATOR")) return message.reply("Sorry, you can't do it, you are not an admin!"); if (!args[0]) return message.reply( "Please, specify the service you want to restock!" ); message.channel.send( "@everyone " + "**" + args[0] + "**" + " has been restocked by " + "<@" + message.author.id + ">" ); } } }); bot.login("NoTokenForU");

我知道以前曾问过这个问题,但是我找不到解决方案,或者为什么我的机器人这样做了,而我对此没有任何解决方案。如果您能帮助我,我将非常感激。 ...

discord.js
1个回答
0
投票
请确保您正确地复制了令牌,如果您还没有令牌,请访问Discord Developer Portal
© www.soinside.com 2019 - 2024. All rights reserved.