コード例 #1
0
def webhook():
    """
    Route для прослуховування вхідних запитів від телеграму.
    Використовується, якщо бот запущений через start_bot_weebook()
    :return:
    """
    update = types.Update.de_json(request.stream.read().decode('utf-8'))
    bot.process_new_updates([update])
    return 'ok', 200
コード例 #2
0
 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)
コード例 #3
0
ファイル: main.py プロジェクト: kolacx/ITEA
def webhook():
    """
    Function process webhook call
    """
    if request.headers.get('content-type') == 'application/json':

        json_string = request.get_data().decode('utf-8')
        update = Update.de_json(json_string)
        bot.process_new_updates([update])
        return ''

    else:
        abort(403)
コード例 #4
0
ファイル: main.py プロジェクト: GolovPavel/timetable_bot
 def getMessage():
     bot.process_new_updates([
         telebot.types.Update.de_json(
             request.stream.read().decode("utf-8"))
     ])
     return "!", 200
コード例 #5
0
def getMessage():
    request_object = request.stream.read().decode("utf-8")
    update_to_json = [telebot.types.Update.de_json(request_object)]
    bot.process_new_updates(update_to_json)
    return "got Message bro"
コード例 #6
0
ファイル: firstBot.py プロジェクト: fenestron/HSEFreeRoom_bot
 def index(self):
     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 ''