Open Arti0mka opened 3 years ago
re-turn indicates a return from a function.
therefore this part will never be executed. it is superfluous.
for value,key in oArr.items():
markup.add(types.InlineKeyboardButton(text=value,
callback_data="['value', '" + value + "', '" + key + "']"))
return markup
And why when I click on them then they do not work?
And now how to do to play tic-tac-toe?
since you skipped boring topics like
1.compare one version of the program with another
then your question is logical.
but I remind you that you should already understand that there is no focus. everything works as you write.
you have one program that plays tic-tac-toe in the console, there is a program that plays in the telegram. It seems to me that you need to do that the third would play in the telegram on the buttons.
and let's start asking questions about what exactly is not clear, and we will not return to the fact that I will not let you think again, and I will write a new program for you.
learn.
Can you please tell me where to start to write tic-tac-toe with buttons in the telegram?
And then I can’t help but understand how I’m already trying to insert something and what’s not working out?
I have already checked the programs.
Can you help how to move further with the creation of tic-tac-toe. What to do next?
we agreed to create a list of what has not been done. I have not seen him until now.
I'll finish the lessons now and send them.
1 ) How to combine buttons with tic-tac-toe? 2 ) How to set the sequence of moves? 3 ) How to make a beautiful field? 4 ) How to play with an opponent?
I closed it by accident.
Hello El Padoro Differences In tele.py, there are no functions for building a board, determining the winner, placing numbers in ascending order, determining the winner and loser and a draw. There is no winning code.
Work
There is only one function in tele.py. When I write any text, tele.py says "i undestend write \ help." When I write \ help, tele.py says "i am stypit."
Work
There are many functions in tele1.py. The first function of building a board. The second function is to enter a number from 1 to 9, if I enter a number greater than 9, then tele1.py will write "Invalid input. Please enter a number from 1 to 9 to be like." The second part of the second function is responsible for placing crosses and zeroes. If I look where there is already a cross or a zero, then tele1.py will write "This cell is already taken." The second function also contains victory codes. In the last function, as well as in tele.py, it is responsible for the text. When I write / help tele1.py writes "hello my dear hoziain im a you slav" and if I write text that is not involved in the program tele1.py writes "i undestend write / help." Even when I write "gogo" then the program is activated and you can play tic-tac-toe. And it is written whether the player won or lost.
OK. it really looks good already.
let's compare "Add file.py" and tele1.py
Differ
Add file.py is a python tic-tac-toe game and tele1.py This is a tic-tac-toe game written in Python and played through telegrams. They differ in that in tele1.py in telegram, and Add file.py in Python. Tele1.py has commands for example: 'text', / help, "gogo", "tt".
I need you to describe the difference in great detail. for example, I printed these two files and wrote what each line in both files does what is the same and what has changed.
every line.
it is very important that you see the difference, this is learning.
if you find pieces that are not clear at all, then mark them as complex and in the second iteration we will analyze them.
Work
Add file.py has four functions. The first function is responsible for building the field. And spreading numbers. The second function is responsible for placing crosses and zeroes. The third function is responsible for the winning code. The fourth function is responsible for writing a message whether the player won or lost or draw.
There are many functions in tele1.py. The first function of building a board. The second function is to enter a number from 1 to 9, if I enter a number greater than 9, then tele1.py will write "Invalid input. Please enter a number from 1 to 9 to be like." The second part of the second function is responsible for placing crosses and zeroes. If I look where there is already a cross or a zero, then tele1.py will write "This cell is already taken." The second function also contains victory codes. In the last function, as well as in tele.py, it is responsible for the text. When I write / help tele1.py writes "hello my dear hoziain im a you slav" and if I write text that is not involved in the program tele1.py writes "i undestend write / help." Even when I write "gogo" then the program is activated and you can play tic-tac-toe. And it is written whether the player won or lost.
thanks we are starting to move after the break. let's call and discuss in the evening.
the only thing to be more careful, I wrote that you need to unpack and be ready to discuss every line.
bot = telebot.TeleBot('1287725214:AAEPpUk4MmCQOl5FDBs5IiF3zzNRQXHnB6Q')
arin = 0
@bot.message_handler(content_types=['text'])
def get_text_messages(message):
global arin
arin = arin + 1
print(message.text)
if message.text == "/help":
bot.send_message(message.from_user.id, "i am stupit")
if message.text == "Рокси":
arin = 0
print(message.text)
if arin == 21:
bot.send_message(message.from_user.id, "очко")
else:
bot.send_message(message.from_user.id, arin)
bot.polling(none_stop=True, interval=0)
good. why you do not create file in repository?
ElPadro why when I want to display the user.id in the error it says name 'user' is not defined.
try
ElPadro can tell you how to do the task that you gave. It just got better today and started to work.
try
- message.from_user.id
- str(message.from_user.id)
You try this?
Yes
ElPadro, please tell me how to do the second task.
Can you check the code?