MCPcopy Create free account
hub / github.com/eternnoir/pyTelegramBotAPI / webhook

Function webhook

examples/multibot/main.py:14–30  ·  view source on GitHub ↗
(token: str)

Source from the content-addressed store, hash-verified

12
13@app.route(f"/{config.WEBHOOK_PATH}/<token>", methods=['POST'])
14def webhook(token: str):
15 if not tokens.get(token):
16 return abort(404)
17
18 if request.headers.get('content-type') != 'application/json':
19 return abort(403)
20
21 json_string = request.get_data().decode('utf-8')
22 update = types.Update.de_json(json_string)
23 if token == main_bot.token:
24 main_bot.process_new_updates([update])
25 return ''
26
27 from_update_bot = TeleBot(token)
28 register_handlers(from_update_bot)
29 from_update_bot.process_new_updates([update])
30 return ''
31
32
33@main_bot.message_handler(commands=['add_bot'])

Callers

nothing calls this directly

Calls 6

process_new_updatesMethod · 0.95
TeleBotClass · 0.90
register_handlersFunction · 0.90
getMethod · 0.45
get_dataMethod · 0.45
de_jsonMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…