Discord.js “ReferenceError: message is not defined”

I was looking at the tutorial with making kick command (https://www.youtube.com/watch?v=IKg7tX5MeWc) and I typed the same. But it doesn’t work. It gives me “ReferenceError: message is not defined” error. How to fix it?

if(message.content.startsWith("?kick")) {
  if(message.member.hasPermission("KICK_MEMBERS")) {
    let member = message.mentions.members.first()
    if(!member) message.channel.send("Вы не указали, кого кикнуть.")
    else {
      member.kick().then(mem => {
        message.channel.send(`${mem.user.username} был успешно кикнут.`)
      })
    }
  } else {
    message.reply("Вы на данный момент не имеете права кикать людей.")
  }
}