Skip to content

Instantly share code, notes, and snippets.

@EremeykinS
Last active July 23, 2016 15:21
Show Gist options
  • Save EremeykinS/83df7340445bef43ead5006fa5fdbeda to your computer and use it in GitHub Desktop.
Save EremeykinS/83df7340445bef43ead5006fa5fdbeda to your computer and use it in GitHub Desktop.
problem with bots
# some stuff here ...
def main():
# Create the EventHandler and pass it your bot's token.
updater = Updater(telegram_token)
# Get the dispatcher to register handlers
dp = updater.dispatcher
# on different commands - answer in Telegram
dp.add_handler(CommandHandler("start", start))
dp.add_handler(CommandHandler("help", helper))
# on noncommand i.e message
dp.add_handler(MessageHandler([Filters.text], chat))
# log all errors
dp.add_error_handler(error)
# Start the Bot
updater.start_webhook(listen='127.0.0.1', port=2002)
updater.bot.setWebhook(url='https://crocode.org/MaraphonBot',
certificate=open('/home/user/new_cert/cert.pem', 'rb'))
updater.idle()
if __name__ == '__main__':
main()
<VirtualHost *:*>
# SSL
SSLEngine on
SSLCertificateFile /home/user/new_cert/cert.pem
SSLCertificateKeyFile /home/user/new_cert/private.key
# other
ServerName crocode.org
DocumentRoot /var/www/crocode.org
ProxyPreserveHost On
ProxyPass /TrainRunnerBot http://127.0.0.1:2001
ProxyPass /MaraphonBot http://127.0.0.1:2002
ProxyPassReverse /MaraphonBot http://127.0.0.1:2002
ProxyPassReverse /TrainRunnerBot http://127.0.0.1:2001
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment