DefaultOpenSSLContextFactory ( 'ssl/secret.key', 'ssl/cert.pem' ) # If want use reverse proxy, then replace listenSSL on listenTCP. id, text = 'Received command "start"' ) print ( result ) def main (): log. text ) print ( result ) ( command = ) def start_handler ( message ): result = yield bot. If you use self-signed certificate - the pass path to it: from pytgram import set_webhook set_webhook ( 'bot_token', '', 'path/to/cert.pem' ) Creating a simple bot import sys from twisted.python import log from twisted.internet import reactor, ssl from import inlineCallbacks from pytgram import TelegramBot, MessageHandler, web_hook bot = TelegramBot ( 'bot_token' ) ( content = ) def text_handler ( message ): result = yield bot. You can install pytgram using pip: $ pip install pytgram Usage Webhook setup from pytgram import set_webhook set_webhook ( 'bot_token', '' ) $ sudo yum group install "Development Tools" $ sudo yum install python36u-devel openssl-devel $ sudo apt-get install python3-dev libffi-dev libssl-dev You may need to install additional packages, depending on your operating system: PyTGram is python library to create Telegram Bot based on Twisted.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |