mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Poll type parameter parse fix
Plus some typo
This commit is contained in:
parent
7e68721475
commit
91b665ea94
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -10,6 +10,5 @@ OS:
|
||||
|
||||
## Checklist:
|
||||
- [ ] I added/edited example on new feature/change (if exists)
|
||||
- [ ] My changes won't break backend compatibility
|
||||
- [ ] I made changes for async and sync
|
||||
|
||||
- [ ] My changes won't break backward compatibility
|
||||
- [ ] I made changes both for sync and async
|
||||
|
@ -35,7 +35,7 @@ class StateRedisStorage(StateStorageBase):
|
||||
"""
|
||||
Function to get record from database.
|
||||
It has nothing to do with states.
|
||||
Made for backend compatibility
|
||||
Made for backward compatibility
|
||||
"""
|
||||
result = await self.redis.get(self.prefix+str(key))
|
||||
if result: return json.loads(result)
|
||||
@ -45,7 +45,7 @@ class StateRedisStorage(StateStorageBase):
|
||||
"""
|
||||
Function to set record to database.
|
||||
It has nothing to do with states.
|
||||
Made for backend compatibility
|
||||
Made for backward compatibility
|
||||
"""
|
||||
|
||||
await self.redis.set(self.prefix+str(key), json.dumps(value))
|
||||
@ -55,7 +55,7 @@ class StateRedisStorage(StateStorageBase):
|
||||
"""
|
||||
Function to delete record from database.
|
||||
It has nothing to do with states.
|
||||
Made for backend compatibility
|
||||
Made for backward compatibility
|
||||
"""
|
||||
await self.redis.delete(self.prefix+str(key))
|
||||
return True
|
||||
|
@ -28,7 +28,7 @@ class StateRedisStorage(StateStorageBase):
|
||||
"""
|
||||
Function to get record from database.
|
||||
It has nothing to do with states.
|
||||
Made for backend compatibility
|
||||
Made for backward compatibility
|
||||
"""
|
||||
connection = Redis(connection_pool=self.redis)
|
||||
result = connection.get(self.prefix+str(key))
|
||||
@ -40,7 +40,7 @@ class StateRedisStorage(StateStorageBase):
|
||||
"""
|
||||
Function to set record to database.
|
||||
It has nothing to do with states.
|
||||
Made for backend compatibility
|
||||
Made for backward compatibility
|
||||
"""
|
||||
connection = Redis(connection_pool=self.redis)
|
||||
connection.set(self.prefix+str(key), json.dumps(value))
|
||||
@ -51,7 +51,7 @@ class StateRedisStorage(StateStorageBase):
|
||||
"""
|
||||
Function to delete record from database.
|
||||
It has nothing to do with states.
|
||||
Made for backend compatibility
|
||||
Made for backward compatibility
|
||||
"""
|
||||
connection = Redis(connection_pool=self.redis)
|
||||
connection.delete(self.prefix+str(key))
|
||||
|
@ -2774,23 +2774,29 @@ class Poll(JsonDeserializable):
|
||||
obj['explanation_entities'] = Message.parse_entities(obj['explanation_entities'])
|
||||
return cls(**obj)
|
||||
|
||||
# noinspection PyShadowingBuiltins
|
||||
def __init__(
|
||||
self,
|
||||
question, options,
|
||||
poll_id=None, total_voter_count=None, is_closed=None, is_anonymous=None, poll_type=None,
|
||||
poll_id=None, total_voter_count=None, is_closed=None, is_anonymous=None, type=None,
|
||||
allows_multiple_answers=None, correct_option_id=None, explanation=None, explanation_entities=None,
|
||||
open_period=None, close_date=None, **kwargs):
|
||||
open_period=None, close_date=None, poll_type=None, **kwargs):
|
||||
self.id: str = poll_id
|
||||
self.question: str = question
|
||||
self.options: List[PollOption] = options
|
||||
self.total_voter_count: int = total_voter_count
|
||||
self.is_closed: bool = is_closed
|
||||
self.is_anonymous: bool = is_anonymous
|
||||
self.type: str = type
|
||||
if poll_type is not None:
|
||||
# Wrong param name backward compatibility
|
||||
logger.warning("Poll: poll_type parameter is deprecated. Use type instead.")
|
||||
if type is None:
|
||||
self.type: str = poll_type
|
||||
self.allows_multiple_answers: bool = allows_multiple_answers
|
||||
self.correct_option_id: int = correct_option_id
|
||||
self.explanation: str = explanation
|
||||
self.explanation_entities: List[MessageEntity] = explanation_entities # Default state of entities is None. if (explanation_entities is not None) else []
|
||||
self.explanation_entities: List[MessageEntity] = explanation_entities
|
||||
self.open_period: int = open_period
|
||||
self.close_date: int = close_date
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user