Esempio n. 1
0
def merge_from_native_poll(poll: Poll, native_poll: NativePoll,
                           session: Session) -> None:
    """Fills information in a pollbot `Poll` with data extracted from a native Telegram poll"""
    poll.created_from_native = True
    poll.poll_type = convert_poll_type(native_poll).name
    poll.name = native_poll.question
    poll.anonymous = native_poll.is_anonymous
    add_text_options_from_list(session, poll,
                               [o.text for o in native_poll.options])
Esempio n. 2
0
def merge_from_native_poll(poll: Poll, native_poll: NativePoll,
                           session: Session) -> None:
    """Fills information in a pollbot `Poll` with data extracted from a native Telegram poll"""
    poll.created_from_native = True
    poll.poll_type = convert_poll_type(native_poll).name
    poll.name = native_poll.question
    poll.anonymous = native_poll.is_anonymous

    # Get all options, strip them and add them
    options = [o.text for o in native_poll.options]
    options_to_add = list(map(str.strip, options))
    add_multiple_options(session, poll, options_to_add)