carbon.py 843 B

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