Reputation:
I'm trying to send a dm to all the members of a server. The code I'm using gives no errors but it isn't working.
@bot.command(pass_context=True)
async def dm(ctx, *, message):
for user in ctx.guild.members:
try:
await user.send(message)
print(f"Sent {user.name} a DM.")
except:
print(f"Couldn't DM {user.name}.")
print("Sent all the server a DM.")
Upvotes: 0
Views: 1951
Reputation: 31
I know this is already answered but to anyone looking at this in the future:
hope this helps even a little
Upvotes: 1