Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- from telegram import Update
- from telegram.constants import ParseMode as PM
- from telegram.ext import ApplicationBuilder, Defaults
- import config
- from Abishnoi.setup import setup_
- defaults = Defaults(parse_mode=PM.HTML, disable_web_page_preview=True, block=False)
- def main() -> None:
- application = (
- ApplicationBuilder()
- .token(config.TOKEN)
- .defaults(defaults)
- .post_init(setup_)
- .build()
- )
- application.run_polling(drop_pending_updates=True, allowed_updates=Update.ALL_TYPES)
- if __name__ == "__main__":
- main()
- # Works Good .
- """
- async def main() -> None:
- application = (
- ApplicationBuilder()
- .token(config.TOKEN)
- .defaults(defaults)
- .post_init(setup_)
- .build()
- )
- async with application:
- await application.start()
- await application.updater.start_polling(
- drop_pending_updates=True, allowed_updates=Update.ALL_TYPES
- )
- await application.updater.stop()
- await application.stop()
- if __name__ == "__main__":
- asyncio.run(main())
- # Works good but only for 1 sec.
- """
Advertisement
Add Comment
Please, Sign In to add comment