carbon.py 832 B

123456789101112131415161718192021222324252627
  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. __MODULE__ = "Carbon"
  6. __HELP__ = "/carbon - Make Carbon Of Code."
  7. @app.on_message(filters.command("carbon"))
  8. @capture_err
  9. async def carbon_func(_, message):
  10. if not message.reply_to_message:
  11. return await message.reply_text(
  12. "Reply to a text message to make carbon."
  13. )
  14. if not message.reply_to_message.text:
  15. return await message.reply_text(
  16. "Reply to a text message to make carbon."
  17. )
  18. m = await message.reply_text("Preparing Carbon")
  19. carbon = await make_carbon(message.reply_to_message.text)
  20. await m.edit("Uploading")
  21. await app.send_document(message.chat.id, carbon)
  22. await m.delete()
  23. carbon.close()