Remove client.edit_folder

Not happy with the design, and keeping it would mean
having to maintain it. It can be added back with a better design.
This commit is contained in:
Lonami Exo
2022-02-08 10:23:55 +01:00
parent 84b016cf1c
commit 07faa53c5a
5 changed files with 6 additions and 135 deletions

View File

@@ -150,11 +150,7 @@ def get_dialogs(
ignore_pinned: bool = False,
ignore_migrated: bool = False,
folder: int = None,
archived: bool = None
) -> _DialogsIter:
if archived is not None:
folder = 1 if archived else 0
return _DialogsIter(
self,
limit,
@@ -180,39 +176,6 @@ def get_drafts(
return _DraftsIter(self, limit, entities=entity)
async def edit_folder(
self: 'TelegramClient',
entity: 'hints.EntitiesLike' = None,
folder: typing.Union[int, typing.Sequence[int]] = None,
*,
unpack=None
) -> _tl.Updates:
if (entity is None) == (unpack is None):
raise ValueError('You can only set either entities or unpack, not both')
if unpack is not None:
return await self(_tl.fn.folders.DeleteFolder(
folder_id=unpack
))
if not utils.is_list_like(entity):
entities = [await self.get_input_entity(entity)]
else:
entities = await asyncio.gather(
*(self.get_input_entity(x) for x in entity))
if folder is None:
raise ValueError('You must specify a folder')
elif not utils.is_list_like(folder):
folder = [folder] * len(entities)
elif len(entities) != len(folder):
raise ValueError('Number of folders does not match number of entities')
return await self(_tl.fn.folders.EditPeerFolders([
_tl.InputFolderPeer(x, folder_id=y)
for x, y in zip(entities, folder)
]))
async def delete_dialog(
self: 'TelegramClient',
entity: 'hints.EntityLike',