components.Question¶
- class components.Question(member, attribute, multiple_choice=True, poll=None)¶
Bases:
object
Representation of a single question asked in an AkaNamen Bot components.
- member¶
The member, who’s attribute is the correct answer.
- Type
- multiple_choice¶
If
False
, the question is to be answered with “free text” instead of choosing an option from a poll.- Type
- poll¶
The poll sent to the user/chat.
- Type
- Parameters
member (Member) – The member, whose attribute is the correct answer.
attribute (
str
) – The attribute that is asked for. Must be one ofSUPPORTED_ATTRIBUTES
.multiple_choice (
bool
) – IfFalse
, the question is to be answered with “free text” instead of choosing an option from a poll. Defaults toTrue
.poll (
Poll
) – The poll sent to the user/chat. Pass this if and only ifmultiple_choice
isTrue
.
- SUPPORTED_ATTRIBUTES = ['first_name', 'last_name', 'nickname', 'birthday', 'age', 'instruments', 'address', 'full_name', 'photo_file_id', 'joined', 'functions']¶
Attributes usable for questions
- Type
List[
str
]
- check_answer(update)¶
Checks, if the given answer is correct.
- Parameters
update (
Update
) – Thetelegram.Update
.- Return type
- check_update(update)¶
Checks, if th given update is a valid response to this question and can be handled by
check_answer()
.- Parameters
update (
Update
) – Thetelegram.Update
to be tested.- Return type