Issue
I am using Replit
to make a discord bot.
if msgtxt in listBadWords:
await message.channel.send(mention + ", your message has been reported to Arunga")
await message.channel.send("Please do not repeat the same mistake again. Do not say bad words!")
user = client.get_user(int(userid))
await user.send("Arunga, someone said a bad word!")
listBadWords
contains a list of bad words. I want to send a dm to the owner, Arunga, saying 'Someone said a bad word!' But when I run the code, and test it out, an error comes
AttributeError:'NoneType' object has no attribute 'send' for
await user.send("Arunga, someone said a bad word!")
I did put the user is in userid
, I just didn't want to post the id here.
How do I fix this? Also, this is under async def on_message():
Solution
This is because User has no method send, Member has that, so What I did was get the owner of the server (which stored in member) and then send the message.
Answered By - Timarp Majumder
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.