使用 Discord 机器人打印在线 discord 用户
Print online discord users using a Discord bot
我目前正在尝试从我的服务器打印所有在线和免打扰用户,但我收到此错误:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'property' object is not iterable
这是代码:
@bot.command()
async def status(ctx):
for member in message.Guild.members:
if (member.status == discord.Status.online or member.status == discord.Status.dnd) and not member.bot:
print(member)
根据API
@bot.command()
async def D(ctx):
for user in ctx.guild.members:
if user.status != discord.Status.offline
print (user.name+"#"+user.discriminator)
我目前正在尝试从我的服务器打印所有在线和免打扰用户,但我收到此错误:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'property' object is not iterable
这是代码:
@bot.command()
async def status(ctx):
for member in message.Guild.members:
if (member.status == discord.Status.online or member.status == discord.Status.dnd) and not member.bot:
print(member)
根据API
@bot.command()
async def D(ctx):
for user in ctx.guild.members:
if user.status != discord.Status.offline
print (user.name+"#"+user.discriminator)