【发布时间】:2021-12-24 12:21:59
【问题描述】:
我在这里遇到的问题是,当机器人在成员之间循环并发送消息时,当用户关闭 dms 时,它就会停止通过它们。
我希望它在关闭 dms 的情况下击中成员后继续通过成员。
代码:
@client.command()
async def pd(ctx):
try:
for m in client.get_all_members():
await m.send(ad)
print(f"received the ad")
except:
print(f" has [DM] `off`")
这是在关闭 dms 的情况下击中成员后的样子。 终端:
bot is now online
received the ad
received the ad
received the ad
received the ad
has [DM] `off`
谢谢!
【问题讨论】:
标签: python discord discord.py bots