discord.pyでbotを作っています。
実現したいこと
botが起動した時に相手にdmを送信したいです。
発生している問題・エラーメッセージ
AttributeError: 'NoneType' object has no attribute 'send'
該当のソースコード
python
1import discord 2bot=discord.Client() 3with open("content.txt") as f: 4 contents = f.read() 5 6@bot.event 7async def on_ready(): 8 print("起動") 9 user = bot.get_user(id) 10 await user.send(contents) 11 12bot.run(token)
試したこと
python
1if user: 2 user = bot.get_user(id) 3 await user.send(contents) 4 print("send")
補足情報(FW/ツールのバージョンなど)
pydroid3で実行しています。
discord.py docs見ろとか言わないでほしいです。

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。