E
E
enabl32018-01-23 18:12:07
linux
enabl3, 2018-01-23 18:12:07

How to check the presence of data in a file through the telegram bot?

There is a bot written in python.
There is a file in which some data is written, all of them on a new line, a file of n lines.
Please tell me how to implement the following:
So that when sending the /check value command to the bot, he checks for the presence of data in the file, if there is any, he answers that there is, if not, sends a message not to the sender, but to the group that there are none?
If it is possible that it would be possible to register several values ​​separated by commas.
For example /check 12345, 67890

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mikhail Vasilyev, 2019-11-08
@vasilyevmn

https://openvpn.net/faq/tls-error-tls-key-negotiat...
In your case, very similar to the last point:

Another possible cause is that the windows firewall is blocking access for the openvpn.exe binary. You may need to whitelist (add it to the "Exceptions" list) it for OpenVPN to work.

R
res2001, 2019-11-08
@res2001

Apparently the server IP is not available from the client, i.e. Really there is no connection and falls off on a timeout. It's not about shaking hands.

V
ValdikSS, 2019-11-15
@ValdikSS

Look at the log on the server side, there should be some details of the error if the port is available and the server receives the packet from the client.

S
sar0ka8, 2018-01-24
@enabl3

result = ("есть такое значение {}".format(check))
To search by multiple values, you can do something like this

check = message.text.split()[1:]
for x in check:
    if x in text:
        result = ("есть такое значение".format(x))
        bot.send_message(message.chat.id, result)
    else:
        result = ("нет такого {}".format(x))
        bot.send_message(message.chat.id, result)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question