'setRateLimitPerUser does not exist

I'm creating a slow mode command for my discord bot. I create the bot with typescript and I wonder why setRateLimitPerUser does not exist. What can I use instead of using setRateLimitPerUser to make this work?

    callback: async ({
    args,
    member: staff,
    guild,
    client,
    message,
    interaction,
  }) => {
    
    const { channel } = message;

    let duration = args.toString().toLowerCase();

    if (isNaN(duration as any)) {
      return "Please provide a number of seconds";
      return;
    }

    channel.setRateLimitPerUser(duration)
  },


Solution 1:[1]

Try turning the duration to an int in channel.setRateLimitPerUser(duration) either by doing

  • channel.setRateLimitPerUser(+duration) or
  • channel.setRateLimitPerUser(parseInt(duration))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1