Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

595
Views
Error in Discord.js message.author.timeout() is not a function

I tried to run the following code:

message.author.timeout(10 * 60 * 1000)

However this resulted in an error stating its not a function:

message.author.timeout(10 * 60 * 1000)

Should be working since its referring to a guild member.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

First, you should verify that you are using the latest version of the Discord.js library, which includes the GuildMember#timeout() method.

The GuildMember#timeout() method takes two parameters: time (in milliseconds, required) and reason (optional).

What is wrong with the code is that the function is being applied to a Discord User, not a Guild Member. Methods that act directly with a guild member and require information such as roles, permissions and other things, must be applied to the Guild Member, an object that holds both Discord User and Guild data.

message.author is a Discord User. message.member is a Guild Member.

So the code should be:

message.member.timeout(10 * 60 * 1000)
about 4 years ago · Juan Pablo Isaza Report

0

You can use the GuildMember#timeout() directed to the member example:

getting the member first:

const member = message.mentions.members.first() // This is where you tagging the member you wanted to mute

you can also use their ID's

const member = message.guild.members.cache.get(args[0]) //This is you can use their id's

Or add them both:

const member = message.mentions.members.first() || message.guild.members.cache.get(args[0])

To return the command if no member mentioned or id given

if(!member) return message.reply("Your Message")

after using this command lines you can now use the GuildMember#timeout()

member.timeout(10 * 6 * 1000) //This will be your `timeout 60 seconds`

you can also use a package called ms

const ms = require('ms')
let time = args[1]
member.timeout(time)

overall code:

const member = message.mentions.members.first() || message.guild.members.cache.get(args[0])
    let time = ms(args[1])

    if(!member) return message.reply("Your Message")
    if(!time) return message.reply("Your message")
    member.timeout(time)

    message.channel.send(member.user.username + " has been timed out")

using the ms you can give such as ms/s/m/h/d

ms = 1000 = 1s
s = 1s
m = 1m
h = 1h
d = 1d
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!