Answer the question
In order to leave comments, you need to log in
How to get chat id in telegram?
Hello!
I wrote a bot that sends a screenshot of the computer state to the telegram group,
If I use this function:
@bot.callback_query_handler(func=lambda call: True)
def query_handler(call):
answer = ''
if call.data == '3':
screen = mss.mss().save()
i = 0
for file in screen:
if i == 0:
i += 1
continue
bot.send_photo(call.message.chat.id, open(file, 'rb'))
#print(file)
call.message.chat.id
@bot.message_handler(commands=['get_screen'])
def query_handler(call):
screen = mss.mss().save()
chat_id = -xxx
i = 0
try:
for file in screen:
if i == 0:
i += 1
continue
bot.send_photo(chat_id, open(file, 'rb'))
# print(file)
except Exception as e:
print(e.args)
Answer the question
In order to leave comments, you need to log in
bot.send_photo(call.chat.id, open(file, 'rb'))
call.chat.id
- this is the chat_id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question