Package: komi-san
We have made you a wrapper you can’t refuseWe have a vibrant community of developers helping each other in ourTelegram group. Join us!Stay tuned for library updates and new releases on ourTelegram Channel.Table of contentsIntroductionTelegram API supportInstallingGetting startedLearning by exampleLoggingDocumentationGetting helpContributingLicenseIntroductionThis library provides a pure Python interface for theTelegram Bot API.
It’s compatible with Python versions 3.7+. PTB might also work onPyPy, though there have been a lot of issues before. Hence, PyPy is not officially supported.In addition to the pure API implementation, this library features a number of high-level classes to
make the development of bots easy and straightforward. These classes are contained in thetelegram.extsubmodule.A pure API implementationwithouttelegram.extis available as the standalone packagepython-telegram-bot-raw.See here for details.NoteInstalling bothpython-telegram-botandpython-telegram-bot-rawin conjunction will result in undesired side-effects, so only installoneof both.Telegram API supportAll types and methods of the Telegram Bot API6.2are supported.InstallingYou can install or upgrade python-telegram-bot with:$pipinstallpython-telegram-bot--upgradeOr you can install from source with:$gitclonehttps://github.com/python-telegram-bot/python-telegram-bot--recursive$cdpython-telegram-bot$pythonsetup.pyinstallIn case you have a previously cloned local repository already, you should initialize the added urllib3 submodule before installing with:$gitsubmoduleupdate--init--recursiveOptional DependenciesPTB can be installed with optional dependencies:pip installpython-telegram-bot[passport]installs thecryptographylibrary. Use this, if you want to use Telegram Passport related functionality.pip installpython-telegram-bot[ujson]installs theujsonlibrary. It will then be used for JSON de- & encoding, which can bring speed up compared to the standardjsonlibrary.pip installpython-telegram-bot[socks]installs thePySockslibrary. Use this, if you want to work behind a Socks5 server.Getting startedOur Wiki contains a lot of resources to get you started withpython-telegram-bot:Introduction to the APITutorial:Your first BotOther references:Telegram API documentationpython-telegram-bot documentationLearning by exampleWe believe that the best way to learn this package is by example. Here
are some examples for you to review. Even if it is not your approach for learning, please take a
look atechobot.py, it is the de facto base for most of the bots out there. Best of all,
the code for these examples are released to the public domain, so you can start by grabbing the
code and building on top of it.Visitthis pageto discover the official examples or look at the examples on thewikito see other bots the community has built.LoggingThis library uses theloggingmodule. To set up logging to standard output, put:importlogginglogging.basicConfig(level=logging.DEBUG,format='%(asctime)s-%(name)s-%(levelname)s-%(message)s')at the beginning of your script.You can also use logs in your application by callinglogging.getLogger()and setting the log level you want:logger=logging.getLogger()logger.setLevel(logging.INFO)If you want DEBUG logs instead:logger.setLevel(logging.DEBUG)Documentationpython-telegram-bot’s documentation lives atreadthedocs.io.Getting helpYou can get help in several ways:We have a vibrant community of developers helping each other in ourTelegram group. Join us!Report bugs, request new features or ask questions bycreating an issueora discussion.OurWiki pagesoffer a growing amount of resources.You can even ask for help on Stack Overflow using thepython-telegram-bot tag.ContributingContributions of all sizes are welcome. Please review ourcontribution guidelinesto get started. You can also help byreporting bugs.DonatingOccasionally we are asked if we accept donations to support the development. While we appreciate the thought, maintaining PTB is our hobby and we have almost no running costs for it. We therefore have nothing set up to accept donations. If you still want to donate, we kindly ask you to donate to another open source project/initiative of your choice instead.LicenseYou may copy, distribute and modify the software provided that modifications are described and licensed for free underLGPL-3. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don’t have to be.