Discord.py: await client.kick(userid)

Created on 5 Mar 2018  路  2Comments  路  Source: Rapptz/discord.py

Using await client.kick(userid), where user id = user input, and i am getting

yield from self.http.kick(member.id, member.server.id) AttributeError: 'str' object has no attribute 'id'

I have tried everything i could think of, idk what the issue is.

my full code section is
if message.content.startswith('!kick '): userid = message.content.split(' ', 1)[1] print(userid) msg = 'User has been kicked.'.format(message) await client.send_message(message.channel, msg) await client.kick(userid)

question

Most helpful comment

client.kick does not take a user id as an argument but a member object.

If you wanted to use method like this you would need to use the server.get_member() method. Where server is the server object you wish to kick the user from.

Questions like this are better suited to the discord.py help server.
https://discord.gg/r3sSKJJ

All 2 comments

client.kick does not take a user id as an argument but a member object.

If you wanted to use method like this you would need to use the server.get_member() method. Where server is the server object you wish to kick the user from.

Questions like this are better suited to the discord.py help server.
https://discord.gg/r3sSKJJ

Thank you so very much! @SourSpoon

Was this page helpful?
0 / 5 - 0 ratings