Skrayvee2021-07-14 16:50:01
Skrayvee, 2021-07-14 16:50:01

[AIOGRAM] How to make an infinite class with state?

I need to make a randomizer that will take the n-th number of values ​​from the user, and then choose one of them (Roulette without animation). I know how to make the selection of one of the elements itself, but how to make an infinite receipt of values ​​from the user?

class Choice(StatesGroup):
  choice = State()

global add_1
add_1 = 1

As you can see, there is a variable "add_1". I had this idea: When a person enters a value, a new State is created with the name +1, ie:
And save after typing (Keyboard) "Done"

Do you have any other options for getting input from the user? If not, how to implement what I described above?

Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Alan Gibizov, 2021-07-15

To accumulate input results, it is convenient to use lists. Learn how to work with lists, loops, iterators and don't reinvent the wheel.
As a last resort, look at github for how other people solve similar problems.
And leave the bots alone. It's too complicated for beginners.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question