Added Poll and PollOption models
This commit is contained in:
committed by
GitHub
parent
718d864dc8
commit
47168e682d
@@ -436,6 +436,50 @@ class Mention(object):
|
||||
def __unicode__(self):
|
||||
return '<Mention {}: offset={} length={}>'.format(self.thread_id, self.offset, self.length)
|
||||
|
||||
class Poll(object):
|
||||
#: ID of the poll
|
||||
uid = None
|
||||
#: Title of the poll
|
||||
title = None
|
||||
#: List of :class:`PollOption`
|
||||
options = None
|
||||
#: Options count
|
||||
options_count = None
|
||||
|
||||
def __init__(self, title, options):
|
||||
"""Represents a poll"""
|
||||
self.title = title
|
||||
self.options = options
|
||||
|
||||
def __repr__(self):
|
||||
return self.__unicode__()
|
||||
|
||||
def __unicode__(self):
|
||||
return '<Poll ({}): {} options={}>'.format(self.uid, repr(self.title), self.options)
|
||||
|
||||
class PollOption(object):
|
||||
#: ID of the poll option
|
||||
uid = None
|
||||
#: Text of the poll option
|
||||
text = None
|
||||
#: Whether vote when creating or client voted
|
||||
vote = None
|
||||
#: ID's of the persons who voted for this poll option
|
||||
voters = None
|
||||
#: Votes count
|
||||
votes_count = None
|
||||
|
||||
def __init__(self, text, vote=False):
|
||||
"""Represents a poll option"""
|
||||
self.text = text
|
||||
self.vote = vote
|
||||
|
||||
def __repr__(self):
|
||||
return self.__unicode__()
|
||||
|
||||
def __unicode__(self):
|
||||
return '<PollOption ({}): {} voters={}>'.format(self.uid, repr(self.text), self.voters)
|
||||
|
||||
class Enum(enum.Enum):
|
||||
"""Used internally by fbchat to support enumerations"""
|
||||
def __repr__(self):
|
||||
|
Reference in New Issue
Block a user