'AttributeError: 'Member' object has no attribute 'timeout'

I'm trying to make a bot that can allows any member on server to mute another member for 5 minutes once per day. I've found member.timeout() method in API reference, but have problems with it

Here's my code for muting:

import discord
import datetime
import asyncio

class MyClient(discord.Client):

    listofmuted=[]

    def clearlist(self):
        self.listofmuted=[]

    def addtolist(self,newid):
        self.listofmuted.append(newid)
...
        if message.content[:5] == '!mute':
            if not message.mentions:
                await message.channel.send('No target to mute')
                return
            smallmute = datetime.timedelta(minutes=1)
            regularmute = datetime.timedelta(minutes=5)
            target = message.mentions[0]
            author = message.author
            if author.id in self.listofmuted:
                await message.channel.send('You\'ve already muted today')
                await author.timeout(smallmute)
                return
            #print(target)
            await target.timeout(regularmute)
            self.addtolist(author.id)
            #print(self.listofmuted)
            await message.channel.send('Target muted')
...
intents = discord.Intents.default()
intents.members = True
client = MyClient(intents=intents)
client.run(token)

I've not copied listclear background loop, it seems to work correctly for now

When I test !mute command in chat I get this message:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\User\Pythony\bot\bot.py", line 53, in on_message
    await target.timeout(regularmute)
AttributeError: 'Member' object has no attribute 'timeout'


Solution 1:[1]

I think Member.timeout() only exists it discord.py 2.0. You can use Member.edit() instead.

await target.edit(timed_out_until=regularmute)

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 3nws