Put PollOption back in a separate file, its docstrings must be visible
This commit is contained in:
parent
c4280f017e
commit
c833b3842a
@ -32,7 +32,7 @@ from .client.types import (
|
||||
Location, Message, MessageEntity, Dialog, Dialogs, Photo, PhotoSize, Sticker, User, UserStatus,
|
||||
UserProfilePhotos, Venue, Animation, Video, VideoNote, Voice, CallbackQuery, Messages, ForceReply,
|
||||
InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove,
|
||||
Poll
|
||||
Poll, PollOption
|
||||
)
|
||||
from .client import (
|
||||
Client, ChatAction, ParseMode, Emoji,
|
||||
|
@ -31,7 +31,7 @@ from .input_media import (
|
||||
from .messages_and_media import (
|
||||
Audio, Contact, Document, Animation, Location, Photo, PhotoSize,
|
||||
Sticker, Venue, Video, VideoNote, Voice, UserProfilePhotos,
|
||||
Message, Messages, MessageEntity, Poll
|
||||
Message, Messages, MessageEntity, Poll, PollOption
|
||||
)
|
||||
from .user_and_chats import (
|
||||
Chat, ChatMember, ChatMembers, ChatPhoto,
|
||||
|
@ -27,6 +27,7 @@ from .messages import Messages
|
||||
from .photo import Photo
|
||||
from .photo_size import PhotoSize
|
||||
from .poll import Poll
|
||||
from .poll_option import PollOption
|
||||
from .sticker import Sticker
|
||||
from .user_profile_photos import UserProfilePhotos
|
||||
from .venue import Venue
|
||||
|
@ -20,25 +20,12 @@ from typing import List
|
||||
|
||||
import pyrogram
|
||||
from pyrogram.api import types
|
||||
from .poll_option import PollOption
|
||||
from ..pyrogram_type import PyrogramType
|
||||
|
||||
|
||||
class PollOption(PyrogramType):
|
||||
def __init__(self,
|
||||
*,
|
||||
client: "pyrogram.client.ext.BaseClient",
|
||||
text: str,
|
||||
voters: int,
|
||||
data: bytes):
|
||||
super().__init__(client)
|
||||
|
||||
self.text = text
|
||||
self.voters = voters
|
||||
self._data = data
|
||||
|
||||
|
||||
class Poll(PyrogramType):
|
||||
"""This object represents a Poll
|
||||
"""This object represents a Poll.
|
||||
|
||||
Args:
|
||||
id (``int``):
|
||||
@ -48,7 +35,7 @@ class Poll(PyrogramType):
|
||||
Whether the poll is closed or not.
|
||||
|
||||
question (``str``):
|
||||
Poll question
|
||||
Poll question.
|
||||
|
||||
options (List of :obj:`PollOption`):
|
||||
The available poll options.
|
||||
|
46
pyrogram/client/types/messages_and_media/poll_option.py
Normal file
46
pyrogram/client/types/messages_and_media/poll_option.py
Normal file
@ -0,0 +1,46 @@
|
||||
# Pyrogram - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
|
||||
#
|
||||
# This file is part of Pyrogram.
|
||||
#
|
||||
# Pyrogram is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Pyrogram is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pyrogram
|
||||
from ..pyrogram_type import PyrogramType
|
||||
|
||||
|
||||
class PollOption(PyrogramType):
|
||||
def __init__(self,
|
||||
*,
|
||||
client: "pyrogram.client.ext.BaseClient",
|
||||
text: str,
|
||||
voters: int,
|
||||
data: bytes):
|
||||
"""This object represents a Poll Option.
|
||||
|
||||
Args:
|
||||
text (``str``):
|
||||
Text of the poll option.
|
||||
|
||||
voters (``int``):
|
||||
The number of users who voted this option.
|
||||
|
||||
data (``bytes``):
|
||||
Unique data that identifies this option (among all the other options in a poll).
|
||||
"""
|
||||
super().__init__(client)
|
||||
|
||||
self.text = text
|
||||
self.voters = voters
|
||||
self.data = data
|
Loading…
Reference in New Issue
Block a user