嗯,我正在为某个特定用户做DM直接留言功能,但我一直在寻找这样做的方式,所以我可以在服务器上给每个人发消息,而且我不会得到它。我使用discord.py 0.16.9作为参考。这是我目前的代码:
@client.command(pass_context = True)
async def dm(ctx, member : discord.Member = None, *, message):
if not ctx.message.author.server_permissions.administrator:
return
if not member:
return await client.say(ctx.message.author.mention + "Specify a user to DM!")
if member = "@everyone":
member =
else:
await client.send_message(member, message)
答案 0 :(得分:9)
正如评论中所述,对每个人来说都不是一个好主意,但如果必须,您可以迭代服务器的所有成员并单独发送消息。在您的示例中:
if member == "@everyone":
for server_member in ctx.message.server.members:
await client.send_message(server_member, message)