Closed ihsinme closed 3 years ago
Can you please tell me how to make buttons?
I can't find it. I honestly searched.
почитай про телеграм ботов и сделай бот который выводит кнопки и дает возможность их нажимать.
I think you should have asked. and where to read? and I would answer on google.
Can you tell me I entered the code on the buttons, but it did not work for me. What should I do?
firstly you must remember that the example must be inserted into your program, where there are keys of your bot, etc. secondly, the question must contain a kind of error. thirdly, give an example of your program that you want to run.
and only then can I help you.
An example of my program is a calendar or cities where I want to go. Can you help?
of course I can help you. but first, make your program file in your repository, call it tele2.py. run in gipod and copy the error messages.
then I can look at both the file and the error.
read my answers carefully.
What would I create a file, I need to click go to file?
A file to do through? Commit directly to the main branch. or Create a new branch for this commit and start a pull request.
go to file is go to file. and to create a file is to add a file
Commit directly to the main branch.
I made a file you can see?
Yes, I see. I do not even seem to be bad. but now let's figure it out.
this line @ bot.message_handler (content_types = ['text']) says that all messages will be processed by the function that is declared immediately below it and messages will be text and will be sent to the message variable. and you have your function under it
def get_text_messages (message):
and the calendar function lies at the end and does not receive anything, which means it is not called.
let's do this remove all functions from tic-tac-toe. under @ bot.message_handler (content_types = ['text']) place def get_calendar (message):
Then, in theory, any of your messages should get a calendar.
That is, I have to complete everything before the start of the calendar command?
And replace this function bot.message_handler (content_types = ['text']) on this def get_text_messages (message):
Here is a program
import os
import sys
import subprocess
import telebot
import time
#pip3 install pytelegrambotapi --upgrade
#pip3 install python-telegram-bot --upgrade
bot = telebot.TeleBot('1287725214:AAEPpUk4MmCQOl5FDBs5IiF3zzNRQXHnB6Q')
def get_calendar(message):
now = datetime.datetime.now() #Текущая дата
chat_id = message.chat.id
date = (now.year,now.month)
current_shown_dates[chat_id] = date #Сохраним текущую дату в словарь
markup = create_calendar(now.year,now.month)
bot.send_message(message.chat.id, "Пожалйста, выберите дату", reply_markup=markup)
bot.polling(none_stop=True, interval=0)
Here are the error lines
Traceback (most recent call last):
File "/workspace/Projekt1pository/tele2.py", line 4, in
you forgot to install
pip3 install pytelegrambotapi --upgrade
Uncle Sergey can you please tell me how to move forward in solving this problem.
Can you tell me what the error is?
import os
import sys
import subprocess
import telebot
import time
#pip3 install pytelegrambotapi --upgrade
#pip3 install python-telegram-bot --upgrade
bot = telebot.TeleBot('1287725214:AAEPpUk4MmCQOl5FDBs5IiF3zzNRQXHnB6Q')
@bot.message_handler(commands=['calendar'])
def get_calendar(message):
now = datetime.datetime.now() #Текущая дата
chat_id = message.chat.id
date = (now.year,now.month)
current_shown_dates[chat_id] = date #Сохраним текущую дату в словарь
markup = create_calendar(now.year,now.month)
bot.send_message(message.chat.id, "Пожалйста, выберите дату", reply_markup=markup)
bot.answer_callback_query(call.id, text="Дата выбрана")
bot.polling(none_stop=True, interval=0)
Sorry for not writing for so long.
I have bad news for you. 1.I had error 2021-01-08 20: 51: 22,369 (init.py:510 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: can ' t parse reply keyboard markup JSON object "it can say that telegram does not support this project now. 2.therefore, when choosing an article, carefully look at the date, https://habr.com/ru/post/335886/ the date of article is 2017.
Thank you
I gave you a simple example. he is in PR, accept and work.
simple working example. figure out how it works and what it does. if you can't start the keyboard in 40 minutes, ask for a hint.
It gives me such errors. What should I do?
unresolved import 'telebot'Python (unresolved-import) [4, 8]
unresolved import 'telebot'Python (unresolved-import) [6, 6]
you forgot to install
pip3 install pytelegrambotapi --upgrade
How many times will I write the same thing?
Can you please give me a hint?
let's get in touch in the evening
Ok!
извини что из за меня идет торможение. надеюсь скоро вернемся в работу. пока что почитай про телеграм ботов и сделай бот который выводит кнопки и дает возможность их нажимать.
почитай в гугле