discord.js: ban command returning internal error

Please describe the problem you are having in as much detail as possible:

It’s the problem that makes my bot not fully working. It’s the fact that i can’t use the ban command, it sends everything such as the ban message but it doesn’t execute the ban command. I added some new code to implement it so when a member gets banned, they get a dm saying they have been banned and why they have been banned.

Include a reproducible code sample here, if possible:

        const mentionMember = message.mentions.members.first();
        mentionMember.ban(banReason)

(this is just the line that doesnt work and the const of the string i use to define the member which is being banned so there’s no misunderstandings)

Further details:

  • discord.js version: v^12.3.1
  • Node.js version: v14.8.0
  • Operating system: Windows 10 Pro
  • Priority this issue should have – please be realistic and elaborate if possible: For me, pretty high since it’s the problem that makes my bot not fully working. It’s the fact that i can’t use the ban command, it sends everything such as the ban message but it doesn’t execute the ban command. You can decide for yourself if this is a high priority.

Relevant client options:

  • partials: none
  • gateway intents: none
  • other: none
  • I have also tested the issue on latest master, commit hash:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 25 (5 by maintainers)

Most upvoted comments

I believe this may be a result of #4370 causing a different error to be thrown, however your usage of the .ban() method is incorrect. Unlike .kick() which only takes a string, .ban() accepts an options object.

https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=ban