Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

596
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda