carbon.py 814 B

1234567891011121314151617181920212223242526
  1. from wbb import app
  2. from wbb.utils.functions import make_carbon
  3. from pyrogram import filters
  4. from wbb.core.decorators.errors import capture_err
  5. import os
  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)