timoniq / telegrinder

Modern visionary telegram bot framework
MIT License
31 stars 5 forks source link

Default parse_mode value #88

Closed vffuunnyy closed 2 months ago

vffuunnyy commented 3 months ago

🚀 Feature Request 🚀

✏️ New feature description ✏️

Could you add a default value for the parse_mode parameter? This will reduce lines of code for developers.

🪄 Provide a minimal example 🪄

api = API(token=token, prase_mode=ParseMode.HTML)

async def handler(m):
    await m.answer(
        HTMLFormatter(bold(italic("bold italic text!"))),
    )

# instead of

async def handler(m):
  await m.answer(
      HTMLFormatter(bold(italic("bold italic text!"))),
      parse_mode=HTMLFormatter.PARSE_MODE,
  )
timoniq commented 2 months ago

implemented in https://github.com/timoniq/telegrinder/commit/64ec2b3b6108ebb202e18f256c7dae28e19155e5

api = API(...)
api.default_params["parse_mode"] = HTMLFormatter.PARSE_MODE