擅长:python、mysql、java
<p>如果你不想每次都查询,你可以把群组/聊天室/用户或任何你想要的东西保存在一个外部文件中。<a href="https://lonamiwebs.github.io/Telethon/methods/messages/send_message.html" rel="nofollow noreferrer">^{<cd1>} </a>实际采用的是<a href="https://lonamiwebs.github.io/Telethon/types/input_peer.html" rel="nofollow noreferrer">^{<cd2>}</a>,在您的例子中,可以是<a href="https://lonamiwebs.github.io/Telethon/constructors/input_peer_chat.html" rel="nofollow noreferrer">^{<cd3>}</a>。在</p>
<p>假设您知道聊天的ID,可以执行以下操作:</p>
<pre><code>from telethon.tl.types import InputPeerChat
chat = InputPeerChat(desired_chat_id)
client.send_message(chat, 'your message')
</code></pre>