title: Pickle telethon message throws "cannot pickle '_asyncio.Future' object"
body: <pre><code>messages = []
  
  async def save_messages():
     async for dialog in client.iter_dialogs():
         async for msg in client.iter_messages(dialog):
             messages.append(msg)
             with open(&quot;data.db&quot;, 'wb') as f:
                 pickle.dump(messages, f) # &quot;TypeError: cannot pickle '_asyncio.Future' object&quot;
                 print(&quot;saved to database&quot;)
  
  
  client = TelegramClient('Session', config.api_id, config.api_hash)
  client.start()
  client.loop.run_until_complete(save_messages())
  </code></pre>
  <p><strong>Telethon</strong> has a method named: <a href="https://docs.telethon.dev/en/latest/modules/client.html#telethon.client.messages.MessageMethods.forward_messages" rel="nofollow noreferrer">forward_message</a> by which I can forward message. I want to <code>save_messages</code> periodically (for example every 1 hour), and then forward saved messages at another time.</p>
  <p>Neither <strong>pickleDB</strong> nor <strong>dill</strong> library can save message object:</p>
  <blockquote>
  <p>&quot;TypeError: cannot pickle '_asyncio.Future' object&quot;</p>
  </blockquote>
  <p>I read lots of related questions but none of them helped me. Do you have any idea? If this problem related to pickleDB, are there any libraries which don't have this issue?</p>