Ban command

I seem to be having this issue when trying to ban someone outside the server I have been trying to find a way to ban outside the server for a bit but could not do it Here is my code https://pastebin.com/Kw7GQbWt
Pastebin
const Discord = require('discord.js');module.exports = async (clien...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
12 Replies
d.js toolkit
d.js toolkit12mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
grass
grass12mo ago
guild.bans.create()
d.js docs
d.js docs12mo ago
method GuildBanManager#create() Bans a user from the guild.
X_DigitalNinja
X_DigitalNinja12mo ago
Would I do this on Line 11?
grass
grass12mo ago
35 I believe oh yes also, you can use interaction.options.getMember() instead of fetching them
X_DigitalNinja
X_DigitalNinja12mo ago
This is on line 11 assume for const member = await interaction.guild.members.fetch(interaction.options.getUser('user').id);
X_DigitalNinja
X_DigitalNinja12mo ago
Not sure I did it right https://pastebin.com/mTQ28ci9 I am getting a error unknown member
Pastebin
const Discord = require('discord.js');module.exports = async (clien...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
X_DigitalNinja
X_DigitalNinja12mo ago
DiscordAPIError[10007]: Unknown Member at handleErrors (/app/node_modules/@discordjs/rest/dist/index.js:687:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async SequentialHandler.runRequest (/app/node_modules/@discordjs/rest/dist/index.js:1072:23) at async SequentialHandler.queueRequest (/app/node_modules/@discordjs/rest/dist/index.js:913:14) at async _REST.request (/app/node_modules/@discordjs/rest/dist/index.js:1218:22) at async GuildMemberManager._fetchSingle (/app/node_modules/discord.js/src/managers/GuildMemberManager.js:221:18) at async module.exports (/app/src/commands/moderation/ban.js:11:18) and this error TypeError: Cannot read properties of null (reading 'id') at module.exports (/app/src/commands/moderation/ban.js:11:93) at processTicksAndRejections (node:internal/process/task_queues:96:5) But yea I don't know what else to do here, sorry for bothering you. and thanks for the help?
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
X_DigitalNinja
X_DigitalNinja12mo ago
For the <Guild> part what do I do with that? I forgot to mention this is soon gonna be a public bot?
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs12mo ago
Tag suggestion for @x_digitalninja: Explaining <Class> and Class#method notation: learn more
Want results from more Discord servers?
Add your server