Answer the question
In order to leave comments, you need to log in
How to fix Unexpected end of input error?
Error:
robot.login(token);
SyntaxError: Unexpected end of input
Code:
robot.on('message', message => {
if (message.content.toLowerCase() === '!приглашения') {
var user = null;
user = message.mentions.members.first() || message.author
message.guild.fetchInvites()
.then
(invites => {
const userInvites = invites.array().filter(o => o.inviter.id === user.id);
var userInviteCount = 0;
for (var i = 0; i < userInvites.length; i++) {
var invite = userInvites[i];
userInviteCount += invite.uses;
}
message.channel.send(`Вы пригласили ${userInviteCount} пользователей на сервер!`);
})
};
Answer the question
In order to leave comments, you need to log in
it will be right:
robot.on('message', message => {
if (message.content.toLowerCase() === '!приглашения') {
var user = null;
user = message.mentions.members.first() || message.author
message.guild.fetchInvites()
.then
(invites => {
const userInvites = invites.array().filter(o => o.inviter.id === user.id);
var userInviteCount = 0;
for (var i = 0; i < userInvites.length; i++) {
var invite = userInvites[i];
userInviteCount += invite.uses;
}
message.channel.send(`Вы пригласили ${userInviteCount} пользователей на сервер!`);
})
}
})
robot.login()
- the method is used at the very bottom of the code, respectively, below the events and everything else.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question