Discord.py: Banning users not in server

Created on 17 Apr 2018  路  2Comments  路  Source: Rapptz/discord.py

Anyone know how to ban someone that isn't in your server? i am able to get a command to ban users IN the server but i also want to ban people that aren't in it.

Most helpful comment

For rewrite branch,
await guild.ban(discord.Object(id=member_id))

For async branch,

fake_member = discord.Object(id=member_id)
fake_member.server = discord.Object(id=server_id)
await bot.ban(fake_member)

Don't use the internal http class calls for this as suggested above. It's designed primarily for internal use, subject to change, and in this case unnecessary.

All 2 comments

client.http.ban()

For rewrite branch,
await guild.ban(discord.Object(id=member_id))

For async branch,

fake_member = discord.Object(id=member_id)
fake_member.server = discord.Object(id=server_id)
await bot.ban(fake_member)

Don't use the internal http class calls for this as suggested above. It's designed primarily for internal use, subject to change, and in this case unnecessary.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcoshuck picture marcoshuck  路  16Comments

haaddaa1 picture haaddaa1  路  14Comments

AceKiron picture AceKiron  路  23Comments

johndoe434 picture johndoe434  路  21Comments

pappabewar picture pappabewar  路  26Comments