carbon.py 815 B

123456789101112131415161718192021222324252627
  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. await message.reply_text("Reply to a text message to make carbon.")
  13. return
  14. if not message.reply_to_message.text:
  15. await message.reply_text("Reply to a text message to make carbon.")
  16. return
  17. m = await message.reply_text("Preparing Carbon")
  18. carbon = await make_carbon(message.reply_to_message.text)
  19. await m.edit("Uploading")
  20. await app.send_photo(message.chat.id, carbon)
  21. await m.delete()
  22. os.remove(carbon)