When someone DM's my bot, I have it print to the console who messaged, what the message was, and the time the message was sent. I would like the bot to then DM me to either notify me someone messaged it, and/or who and what and when.
I've seen many issues about this with different solutions. A lot of them were outdated therefore do not work with my code. I use Python 3.7 on Spyder.
I can get the bot to DM a user on bot command but cannot get it to DM a specific user ID which would be mine.
Here's the code that prints DM messages received to the console. Again, no issues with this part. Just need this info private messaged to me.
if isinstance(message.channel, discord.DMChannel):
print("******************************")
print("DM Recieved by: " + message.author.name)
print("Time:", str(datetime.datetime.now()))
print("Message: " + message.content)
print("******************************")
Updated Code:
if client.user.mentioned_in(message) and message.mention_everyone is False:
await message.delete()
channel = message.channel
await channel.trigger_typing()
await channel.send("{0.mention} Please don't tag me.".format(message.author))
print("**************************************************")
print("Mentioned By: " + message.author.name)
print("Time:", str(datetime.datetime.now()))
print("Message: " + message.clean_content)
print("Channel: " + str(message.channel))
print("**************************************************\n")
#DM me when bot get's mentioned.
client.get_user(305508822485827584)
await user.send("Test")