#TypeError: Cannot read properties of undefined (reading 'hasPermission')

19 messages · Page 1 of 1 (latest)

hushed havenBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • 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!
static monolith
#

@steady furnace did you accidentally open a post or?

steady furnace
#

I realized this was question and not support

#

I was gonna post it in #djs-help-v14

static monolith
#

this is a support channel

steady furnace
#

oh well

static monolith
#

it’s for questions and issues same as the other channel

#

what’s up

steady furnace
#

I keep getting this error as shown above and here's my code:

    async execute(message) {
        if (message.member.guild.me.hasPermission("ADMINISTRATOR"))
            return message.channel.send("You can ban people!")```
static monolith
#

it’s permissions.has(…)

hasPermission was v12 and we don’t support 12 or 13

steady furnace
#

Ah okay

static monolith
#

in v14, it’s <Guild>.members.me.permissions.has('Administrator')

steady furnace
flat escarpBOT
#

Explaining <Class> and Class#method notation: learn more

steady furnace
#

ty

static monolith
#

i suggest you learn javascript before making a discord bot

steady furnace
static monolith
#

i understand, but if you just jump right into making a bot in javascript, you’ll have a much harder time understanding it if you don’t have those basic fundamentals out of the way first

#

there are great places in #resources