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

components.Member

attribute

The attribute that is asked for.

Type

str

multiple_choice

If False, the question is to be answered with “free text” instead of choosing an option from a poll.

Type

bool

poll

The poll sent to the user/chat.

Type

telegram.Poll

Parameters
  • member (Member) – The member, whose attribute is the correct answer.

  • attribute (str) – The attribute that is asked for. Must be one of SUPPORTED_ATTRIBUTES.

  • multiple_choice (bool) – If False, the question is to be answered with “free text” instead of choosing an option from a poll. Defaults to True.

  • poll (Poll) – The poll sent to the user/chat. Pass this if and only if multiple_choice is True .

ADDRESS: str = 'address'

Instrument of an AkaBlas member

Type

str

AGE: str = 'age'

Age of an AkaBlas member

Type

str

BIRTHDAY: str = 'birthday'

Birthday of an AkaBlas member

Type

str

FIRST_NAME: str = 'first_name'

First name of an AkaBlas member

Type

str

FULL_NAME: str = 'full_name'

Full name of an AkaBlas member

Type

str

FUNCTIONS: str = 'functions'

Functions of an AkaBlas member

Type

str

INSTRUMENT: str = 'instruments'

Instrument of an AkaBlas member

Type

str

JOINED: str = 'joined'

Year an AkaBlas member joined

Type

str

LAST_NAME: str = 'last_name'

Last name of an AkaBlas member

Type

str

NICKNAME: str = 'nickname'

Nickname of an AkaBlas member

Type

str

PHOTO: str = 'photo_file_id'

Foto of an AkaBlas member

Type

str

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) – The telegram.Update.

Return type

bool

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) – The telegram.Update to be tested.

Return type

bool

property correct_answer: Union[str, List[str]]

The correct answer for this question.

Return type

Union[str, List[str]]