diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..c3c95b5
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..e79cb04
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/telegram-bot-example.iml b/.idea/telegram-bot-example.iml
new file mode 100644
index 0000000..6711606
--- /dev/null
+++ b/.idea/telegram-bot-example.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..bf1e1ea
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,430 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1494702426152
+
+
+ 1494702426152
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Procfile b/Procfile
index 90e1869..eb399cb 100644
--- a/Procfile
+++ b/Procfile
@@ -1 +1 @@
-web: gunicorn app.main:api --workers 4
+web: python3 main.py
\ No newline at end of file
diff --git a/app/__init__.py b/app/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/app/classes/__init__.py b/app/classes/__init__.py
deleted file mode 100644
index 511117e..0000000
--- a/app/classes/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from chat import *
diff --git a/app/classes/chat.py b/app/classes/chat.py
deleted file mode 100644
index ae811c2..0000000
--- a/app/classes/chat.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from ..settings import bot
-
-class Chat(object):
-
- def __init__(self, chat_id, text=''):
- self.chat_id = chat_id
- self.text = text
-
- # main process method
- def process(self):
- bot.sendMessage(chat_id=self.chat_id, text=u"> {}".format(self.text))
diff --git a/app/main.py b/app/main.py
deleted file mode 100644
index 028eb8f..0000000
--- a/app/main.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import falcon
-from resources import HookResource, SetWebhookResource, MainResource
-
-api = falcon.API()
-api.add_route('/', MainResource())
-api.add_route('/HOOK', HookResource())
-api.add_route('/set_webhook', SetWebhookResource())
diff --git a/app/resources/__init__.py b/app/resources/__init__.py
deleted file mode 100644
index 64534d0..0000000
--- a/app/resources/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from hook import *
-from set_webhook import *
-from main import *
diff --git a/app/resources/hook.py b/app/resources/hook.py
deleted file mode 100644
index 7a55500..0000000
--- a/app/resources/hook.py
+++ /dev/null
@@ -1,22 +0,0 @@
-import telegram
-import json
-import traceback
-from ..classes import Chat
-
-class HookResource(object):
- def on_post(self, req, resp):
- try:
- body = req.stream.read()
- body_decoded = body.decode("utf-8")
- json_body = json.loads(body_decoded)
-
- update = telegram.Update.de_json(json_body)
-
- chat_id = update.message.chat.id
- text = update.message.text
-
- chat = Chat(chat_id, text)
- chat.process()
-
- except Exception as e:
- traceback.print_exc()
diff --git a/app/resources/main.py b/app/resources/main.py
deleted file mode 100644
index 672ab71..0000000
--- a/app/resources/main.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import falcon
-
-class MainResource(object):
- def on_get(self, req, resp, **params):
- resp.body = u'hi, i\'m a bot'
- resp.status = falcon.HTTP_200
- resp.content_type = 'text/html'
diff --git a/app/resources/set_webhook.py b/app/resources/set_webhook.py
deleted file mode 100644
index fd26b9f..0000000
--- a/app/resources/set_webhook.py
+++ /dev/null
@@ -1,16 +0,0 @@
-import falcon
-from ..settings import WEBHOOK_URL, bot
-
-class SetWebhookResource(object):
- def __init__(self):
- self.bot = bot
-
- def on_get(self, req, resp, **params):
- s = self.bot.setWebhook(WEBHOOK_URL)
- if s:
- resp.body = 'ok'
- resp.status = falcon.HTTP_200
- else:
- resp.body = 'an error occured'
- resp.status = falcon.HTTP_500
-
diff --git a/app/settings.py b/app/settings.py
deleted file mode 100644
index 7adc600..0000000
--- a/app/settings.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import telegram
-
-BOT_TOKEN = '268737221:AAGdNFIz7Bi6lbXx2IZUMIosQnU9_fo77Ug'
-WEBHOOK_URL = 'https://mytelegrambot.dokkurapp.com/HOOK'
-bot = telegram.Bot(token=BOT_TOKEN)
diff --git a/main.py b/main.py
new file mode 100644
index 0000000..02dd070
--- /dev/null
+++ b/main.py
@@ -0,0 +1,35 @@
+import os
+import telebot
+import cherrypy
+import time
+
+token = "320545030:AAF8okRjCqGkFoylEamUGuN4V9v60StAvgQ"
+
+WEBHOOK_HOST = '0.0.0.0'
+WEBHOOK_PORT = int(os.environ.get('PORT', 5000))
+WEBHOOK_LISTEN = '0.0.0.0'
+
+bot = telebot.TeleBot(token)
+
+
+class WebhookServer(object):
+ @cherrypy.expose
+ def index(self):
+ return 0
+
+
+bot.remove_webhook()
+
+time.sleep(5)
+
+
+bot.set_webhook("https://myboot1.herokuapp.com/" + token)
+
+
+cherrypy.config.update({
+ 'server.socket_host': '0.0.0.0',
+ 'server.socket_port': int(os.environ.get('PORT', 5000)),
+})
+
+
+cherrypy.quickstart(WebhookServer(), "https://myboot1.herokuapp.com/" + token)
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index fc50821..8a1d7df 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,10 +1,3 @@
-certifi==2016.2.28
-falcon==1.0.0
-future==0.15.2
-gunicorn==19.3.0
-peewee==2.8.1
-python-mimeparse==1.5.2
-python-telegram-bot==4.3.2
-six==1.10.0
-urllib3==1.16
-wheel==0.24.0
+pyTelegramBotAPI==2.3.2
+cherrypy
+Flask==0.12.0
\ No newline at end of file
diff --git a/runtime.txt b/runtime.txt
deleted file mode 100644
index 2b55d15..0000000
--- a/runtime.txt
+++ /dev/null
@@ -1 +0,0 @@
-python-2.7.10
diff --git a/test.py b/test.py
new file mode 100644
index 0000000..eebccc9
--- /dev/null
+++ b/test.py
@@ -0,0 +1,42 @@
+import cherrypy
+import os
+import telebot
+
+token = "320545030:AAF8okRjCqGkFoylEamUGuN4V9v60StAvgQ"
+
+WEBHOOK_HOST = '0.0.0.0'
+WEBHOOK_PORT = 5000
+WEBHOOK_LISTEN = '0.0.0.0'
+
+WEBHOOK_URL_BASE = "https://%s:%s" % (WEBHOOK_HOST, WEBHOOK_PORT)
+WEBHOOK_URL_PATH = "/%s/" % (token)
+
+bot = telebot.TeleBot(token)
+class WebhookServer(object):
+ @cherrypy.expose
+ def index(self):
+ if 'content-length' in cherrypy.request.headers and \
+ 'content-type' in cherrypy.request.headers and \
+ cherrypy.request.headers['content-type'] == 'application/json':
+ length = int(cherrypy.request.headers['content-length'])
+ json_string = cherrypy.request.body.read(length).decode("utf-8")
+ update = telebot.types.Update.de_json(json_string)
+
+ bot.process_new_updates([update])
+ return ''
+ else:
+ raise cherrypy.HTTPError(403)
+@bot.message_handler(func=lambda message: True, content_types=['text'])
+def echo_message(message):
+ bot.reply_to(message, message.text)
+
+
+
+
+cherrypy.config.update({
+ 'server.socket_host': '0.0.0.0',
+ 'server.socket_port': int(os.environ.get('PORT', 5000)),
+})
+
+
+cherrypy.quickstart(WebhookServer(), WEBHOOK_URL_PATH, {'/bot': {}})
\ No newline at end of file
diff --git a/webhook_cert.pem b/webhook_cert.pem
new file mode 100644
index 0000000..7249554
--- /dev/null
+++ b/webhook_cert.pem
@@ -0,0 +1,23 @@
+-----BEGIN CERTIFICATE-----
+MIIDzzCCAregAwIBAgIJAOxioDn/TPeAMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNV
+BAYTAmRmMQ0wCwYDVQQIDARkZmRmMQwwCgYDVQQHDANkZmYxDDAKBgNVBAoMA2Rm
+ZDEMMAoGA1UECwwDZGZkMR4wHAYDVQQDDBVteWJvb3QxLmhlcm9rdWFwcC5jb20x
+FjAUBgkqhkiG9w0BCQEWB3NkZmRzZmQwHhcNMTcwNTEzMTk1NjE4WhcNMjcwNTEx
+MTk1NjE4WjB+MQswCQYDVQQGEwJkZjENMAsGA1UECAwEZGZkZjEMMAoGA1UEBwwD
+ZGZmMQwwCgYDVQQKDANkZmQxDDAKBgNVBAsMA2RmZDEeMBwGA1UEAwwVbXlib290
+MS5oZXJva3VhcHAuY29tMRYwFAYJKoZIh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