carbon.py 765 B

123456789101112131415161718192021222324
  1. from pyrogram import filters
  2. from wbb import app
  3. from wbb.core.decorators.errors import capture_err
  4. from wbb.utils.functions import make_carbon
  5. @app.on_message(filters.command("carbon"))
  6. @capture_err
  7. async def carbon_func(_, message):
  8. if not message.reply_to_message:
  9. return await message.reply_text(
  10. "Reply to a text message to make carbon."
  11. )
  12. if not message.reply_to_message.text:
  13. return await message.reply_text(
  14. "Reply to a text message to make carbon."
  15. )
  16. m = await message.reply_text("Preparing Carbon")
  17. carbon = await make_carbon(message.reply_to_message.text)
  18. await m.edit("Uploading")
  19. await app.send_document(message.chat.id, carbon)
  20. await m.delete()
  21. carbon.close()