const Discord = require("discord.js");
const client = new Discord.Client();
const fs = require("fs")
let warns = JSON.parse(fs.readFileSync('./warns.json', 'utf8'));
// Config Settings
const token = "nope"
const prefix = "&^"
const ownerID = "nope"
// Config Settings
var vids = [cant post links"];
var msgsvids = ["Have fun **;)**", "wow.", ":^)", "lawl.", "Enjoi", "Dont
file a complaint.", "Dont have **any** fun **);**", "* cringe *", "*
**cringe** *"]
const help = new Discord.RichEmbed().setTitle("_+-=^Exotic Economy^=-
+_").setDescription("**Popular Commands :**\n&^ytroul.\n**Useful Commands
:**\n&^add, &^subtract, &^multiply, &^divide, &^factorial (__***WARNING: DO
NOT INPUT A NUMBER HIGHER THAN 10000 OR YOU WILL BE WARNED!***__), &^sqrt,
&^random, and &^ping.").setColor("#00fff6").setThumbnail("cant post
links").setFooter("Version 1.8 | By LittleWhole, Burst, and
Chewie").setTimestamp();
client.login(token);
client.on('ready', () => {
console.log(`Logged in as ${client.user.username}!`);
client.user.setGame('&^help | By LittleWhole, Burst, + Chewie');
client.user.setStatus('online');
});
client.on('guildMemberAdd', member => {
var findchannel = member.guild.channels.find('name', 'general');
if (!channel) return;
findchannel.send(`*Welcome to the server,* **${member}**`);
var findchannel = member.guild.channels.find('name', 'balance');
if (!channel) return;
findchannel.send(`(:pushpin: 0 | :mega: 0 | :fish: 0 | :rocket: 0 | :fire:
0)`);
var findchannel = member.guild.channels.find('name', 'items');
if (!channel) return;
findchannel.send(`(:blackcoin: 0 | :coin: 50)`);
});
var f = [];
function factorial (n) {
if (n == 0 || n == 1)
return 1;
if (f[n] > 0)
return f[n];
return f[n] = factorial(n-1) * n;
};
client.on('message', message => {
var vchannel = message.channel;
var vmessage = message.content;
var vauthor = message.author;
var vguild = message.guild;
let command = message.content.split(" ")[0];
command = command.slice(prefix.length);
let args = message.content.split(" ").slice(1);
if (!message.content.startsWith(prefix)) return;
if (message.author.bot) return;
if (!message.guild) return;
if (command === 'help') {
const help = new Discord.RichEmbed().setTitle("_+-=^Exotic Code^=-
+_").setDescription("**Popular Commands :**\n*&^ytroul.*\n**Useful Commands
:**\n*&^add, &^subtract, &^multiply, &^divide,
&^ping.*").setColor("#00fff6").setThumbnail("cant post
links").setFooter("Version 1.8").setTimestamp();
message.channel.send({ embed: help });
}
if (command === 'warn') {
var player = parseInt(args[0]);
var reason = parseInt(args[1]);
const warne = new
Discord.RichEmbed().setTitle(
:锤:).setDescription("").setColor("#ffff3d")
setFooter("");
var findchannel = member.guild.channels.find(' name',' mod-logs');
if(!channel)return;
findchannel.send({embed:warne});
}
if (command === 'add') {
var num1 = parseInt(args[0]);
var num2 = parseInt(args[1]);
var ans = num1 + num2
message.channel.send(":atom: **|** *" + ans + "*");
}
if (command === 'multiply') {
var num1 = parseInt(args[0]);
var num2 = parseInt(args[1]);
var ans = num1 * num2
message.channel.send(":atom: **|** *" + ans + "*");
}
if (command === 'subtract') {
var num1 = parseInt(args[0]);
var num2 = parseInt(args[1]);
var ans = num1 - num2
message.channel.send(":atom: **|** *" + ans + "*");
}
if (command === 'divide') {
var num1 = parseInt(args[0]);
var num2 = parseInt(args[1]);
var ans = num1 / num2
message.channel.send(":atom: **|** *" + ans + "*");
}
if (command === 'factorial') {
var num1 = parseInt(args[0]);
var ans = factorial(num1);
message.channel.send(":atom: **|** *" + ans + "*");
if (command === 'random') {
var num1 = parseInt(args[0]);
var num2 = parseInt(args[1]);
var ans = Math.floor(Math.random() * num2) + num1
message.channel.send(":atom: **|** *" + ans + "*");
}
if (command === 'sqrt') {
var num1 = parseInt(args[0]);
var ans = Math.sqrt(num1)
message.channel.send(":atom: **|** *" + ans + "*");
}
if (command === 'ping') {
message.channel.send(':ping_pong: **|** Reply took').then(m =>
m.edit(`:ping_pong: **|** Reply took \`\`${message.createdTimestamp -
Date.now()}ms.\`\``));
}
if (command === 'ytroul') {
message.channel.send(":movie_camera: **|** ***" +
vids[Math.floor((Math.random() * vids.length) + 1) -1] + "*** " +
msgsvids[Math.floor((Math.random() * msgsvids.length) + 1) - 1]);
}
});
基本上,命令提示符表示这是一个意外的令牌错误。我不知道为什么。有人请帮忙!
答案 0 :(得分:0)
这里的代码
var vids = [cant post links"];
可能是问题,除非您在没有正确保留引号的情况下编辑了stackoverflow。