carbon.py 801 B

12345678910111213141516171819202122232425
  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. async def carbon_func(_, message):
  10. if not message.reply_to_message:
  11. await message.reply_text("Reply to a text message to make carbon.")
  12. return
  13. if not message.reply_to_message.text:
  14. await message.reply_text("Reply to a text message to make carbon.")
  15. return
  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_photo(message.chat.id, carbon)
  20. await m.delete()
  21. os.remove(carbon)