This is the important part of your error, and it basically shows already what it is about; The bot has no attribute of message, in which it doesn't and should be member.send in your case. You also don't need to get the id of the member.
AttributeError: 'Bot' object has no attribute 'message'
By re-writing your command, here are those errors fixed
@bot.command()
async def dm(ctx, member: discord.Member):
for a in range(5):
await member.send("text")
You can also add more specific detail to the command, in this example if you don't include a member it won't cause an error, or if the member was not reachable, it would handle the error.
@bot.command()
async def dm(ctx, member: discord.Member=None):
if member == None:
await ctx.send('Mention a member')
return
try:
for a in range(5):
await member.send("text")
except commands.CommandInvokeError:
await ctx.send("Couldn't send message to user")