Why doesn't kicking people work using discord.js
up vote
1
down vote
favorite
const Discord = require("discord.js"),
bot = new Discord.Client();
let pre = "?"
bot.on("message", async msg =>
var msgArray = msg.content.split(" ");
var args = msgArray.slice(1);
var prisonerRole = msg.guild.roles.find("name", "Prisoner");
let command = msgArray[0];
if (command == `$preroll`)
if (!msg.member.roles.has(prisonerRole.id))
roll = Math.floor(Math.random()*6)+1;
msg.reply(`You rolled a $roll`)
else
msg.reply(`HaHa NOOB, you're in prison you don't get priveleges!`)
if (command == `$prekick`)
)
bot.login("token").then(function()
console.log('Good!')
, function(err)
console.log('Still good, as long as the process now exits.')
bot.destroy()
)
Everything works except actually kicking the person. The message sends nut it doesn't kick people. For example, when I type in ?kick @BobNuggets#4576 inactive
, it says @rishabhase has kicked @BobNuggets
Reason: inactive
But it doesn't actually kick the user, which is weird, can you help me?
javascript node.js discord discord.js
add a comment |
up vote
1
down vote
favorite
const Discord = require("discord.js"),
bot = new Discord.Client();
let pre = "?"
bot.on("message", async msg =>
var msgArray = msg.content.split(" ");
var args = msgArray.slice(1);
var prisonerRole = msg.guild.roles.find("name", "Prisoner");
let command = msgArray[0];
if (command == `$preroll`)
if (!msg.member.roles.has(prisonerRole.id))
roll = Math.floor(Math.random()*6)+1;
msg.reply(`You rolled a $roll`)
else
msg.reply(`HaHa NOOB, you're in prison you don't get priveleges!`)
if (command == `$prekick`)
)
bot.login("token").then(function()
console.log('Good!')
, function(err)
console.log('Still good, as long as the process now exits.')
bot.destroy()
)
Everything works except actually kicking the person. The message sends nut it doesn't kick people. For example, when I type in ?kick @BobNuggets#4576 inactive
, it says @rishabhase has kicked @BobNuggets
Reason: inactive
But it doesn't actually kick the user, which is weird, can you help me?
javascript node.js discord discord.js
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
const Discord = require("discord.js"),
bot = new Discord.Client();
let pre = "?"
bot.on("message", async msg =>
var msgArray = msg.content.split(" ");
var args = msgArray.slice(1);
var prisonerRole = msg.guild.roles.find("name", "Prisoner");
let command = msgArray[0];
if (command == `$preroll`)
if (!msg.member.roles.has(prisonerRole.id))
roll = Math.floor(Math.random()*6)+1;
msg.reply(`You rolled a $roll`)
else
msg.reply(`HaHa NOOB, you're in prison you don't get priveleges!`)
if (command == `$prekick`)
)
bot.login("token").then(function()
console.log('Good!')
, function(err)
console.log('Still good, as long as the process now exits.')
bot.destroy()
)
Everything works except actually kicking the person. The message sends nut it doesn't kick people. For example, when I type in ?kick @BobNuggets#4576 inactive
, it says @rishabhase has kicked @BobNuggets
Reason: inactive
But it doesn't actually kick the user, which is weird, can you help me?
javascript node.js discord discord.js
const Discord = require("discord.js"),
bot = new Discord.Client();
let pre = "?"
bot.on("message", async msg =>
var msgArray = msg.content.split(" ");
var args = msgArray.slice(1);
var prisonerRole = msg.guild.roles.find("name", "Prisoner");
let command = msgArray[0];
if (command == `$preroll`)
if (!msg.member.roles.has(prisonerRole.id))
roll = Math.floor(Math.random()*6)+1;
msg.reply(`You rolled a $roll`)
else
msg.reply(`HaHa NOOB, you're in prison you don't get priveleges!`)
if (command == `$prekick`)
)
bot.login("token").then(function()
console.log('Good!')
, function(err)
console.log('Still good, as long as the process now exits.')
bot.destroy()
)
Everything works except actually kicking the person. The message sends nut it doesn't kick people. For example, when I type in ?kick @BobNuggets#4576 inactive
, it says @rishabhase has kicked @BobNuggets
Reason: inactive
But it doesn't actually kick the user, which is weird, can you help me?
javascript node.js discord discord.js
javascript node.js discord discord.js
asked Jul 21 at 22:00
Rishi Ryan
414
414
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
Change
msg.guild.member(kickUser).kick();
to
kickUser.kick();
also, make sure the bot is elevated in hierarchy
add a comment |
up vote
0
down vote
Use kickUser.kick();
I recommend using a command handler to neaten up your code. You don't want all your commands in one .js file.
New contributor
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Change
msg.guild.member(kickUser).kick();
to
kickUser.kick();
also, make sure the bot is elevated in hierarchy
add a comment |
up vote
0
down vote
Change
msg.guild.member(kickUser).kick();
to
kickUser.kick();
also, make sure the bot is elevated in hierarchy
add a comment |
up vote
0
down vote
up vote
0
down vote
Change
msg.guild.member(kickUser).kick();
to
kickUser.kick();
also, make sure the bot is elevated in hierarchy
Change
msg.guild.member(kickUser).kick();
to
kickUser.kick();
also, make sure the bot is elevated in hierarchy
answered Jul 22 at 3:56
Saddy
4239
4239
add a comment |
add a comment |
up vote
0
down vote
Use kickUser.kick();
I recommend using a command handler to neaten up your code. You don't want all your commands in one .js file.
New contributor
add a comment |
up vote
0
down vote
Use kickUser.kick();
I recommend using a command handler to neaten up your code. You don't want all your commands in one .js file.
New contributor
add a comment |
up vote
0
down vote
up vote
0
down vote
Use kickUser.kick();
I recommend using a command handler to neaten up your code. You don't want all your commands in one .js file.
New contributor
Use kickUser.kick();
I recommend using a command handler to neaten up your code. You don't want all your commands in one .js file.
New contributor
New contributor
answered Nov 10 at 14:05
MyNameIsVati
84
84
New contributor
New contributor
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51460457%2fwhy-doesnt-kicking-people-work-using-discord-js%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown