T
T
Timtaran2020-08-27 15:41:45
Bots
Timtaran, 2020-08-27 15:41:45

Why can't I see a message from the bot?

The code:

from flask import Flask
from flask import Flask, request, json
import telebot
import json
import vk_api
telegram = telebot.TeleBot('127****421**AFyu7i8-n9j*****N***SAc********SY')
vk_session = vk_api.VkApi(token='ac********c****40f6****927f84****d7616b7d514f82****22e339901****ada3811e****ea3****')
vk = vk_session.get_api()
app = Flask(__name__)
@app.route('/', methods=['POST'])
def processing():
    data = json.loads(request.data)
    telegram.send_message(973302492, str(data))
    if 'type' not in data.keys():
        return 'not vk'
    elif data['type'] == 'wall_repost':
        if data['secret'] == '6tgfGJhgfygjdrsjb':
            vk.messages.send(random_id=0, user_id=int(data['object']['from_id']), message='Ты сделал репост записи, спасибо')
    return '12909e1a'
@app.route('/test')
def test():
    telegram.send_message(973302492, 'Working')
    return 'Working GG'


Hosted:
pythonanywhere.com

Error log:
2020-08-27 12:31:44,371: Starting new HTTPS connection (1): api.telegram.org

The rest of the screenshots:
5f47a9a40132a478844294.png
5f47a9b958d52338697526.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2020-08-28
@Timtaran

1. Make sure that the bot sends messages by entering an api request in the address bar of the browser indicating the id of your chat with it.
2. Make sure that the bot (program) should send something in response to the /start command, since this is just a chat id registration between the client and the bot.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question