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

TunaHobby picture TunaHobby  路  3Comments

JackL0 picture JackL0  路  3Comments

danshat picture danshat  路  3Comments

Spyder-exe picture Spyder-exe  路  3Comments

reuscam picture reuscam  路  3Comments