Answer the question
In order to leave comments, you need to log in
How to send a DM message to all server users (excluding bots, they should not be sent a message)?
@Client.command()
@commands.is_owner()
async def dm(ctx, *, message):
for server_member in ctx.message.guild.members:
await server_member.create_dm()
await asyncio.sleep(1)
@Client.command()
@commands.is_owner()
async def dm(ctx, *, message):
for server_member in ctx.message.guild.members:
await server_member.create_dm()
await asyncio.sleep(1)
await server_member.send(message)
Answer the question
In order to leave comments, you need to log in
guild.members
contains all server members, including your bot, which, unlike other server members, is defined on the basis of the bot's "client" object and does not have a create_dm
.
The question is - why do you "explicitly" create a LAN channel, if the documentation states that this should be rarely used, and in most cases it happens automatically?
https://discordpy.readthedocs.io/en/stable/api.htm...
This should be rarely called, as this is done transparently for most people.
User.bot
: Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question