I would recommend trying to search some more, and next time please post your "attempted" code, as this helps people know that you have tried and not purely relying StackOverflow to give you an answer.
Here I have given a simple example of a member dm, you call the command, mention a member, then sending a message. Ill leave it up to you to customize this command.
@client.command()
async def welcome(ctx, member: discord.Member, *, message=None):
await member.send(message)
await ctx.send(f'You successfully sent a message to {member}')
A little more built to your question, you can run this command only with a member and it would send the rules from the rules
variable
@client.command()
async def welcome(ctx, member: discord.Member):
rules = """
Welcome, user to our server.
please read the rules we have set for our server
1. Have respect
2. Be nice
3. And so on..."""
await member.send(rules)
await ctx.send(f'You successfully sent a message to {member}')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…