Skip to content

Commit b10817e

Browse files
committed
Merge develop -> asyncio
2 parents 3dce235 + 2983a3b commit b10817e

10 files changed

Lines changed: 21 additions & 29 deletions

File tree

compiler/docs/compiler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ def get_title_list(s: str) -> list:
184184
unban_chat_member
185185
restrict_chat_member
186186
promote_chat_member
187+
set_administrator_title
187188
export_chat_invite_link
188189
set_chat_photo
189190
delete_chat_photo

pyrogram/client/client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,10 +1433,7 @@ def load_config(self):
14331433
self.api_id = parser.getint("pyrogram", "api_id")
14341434
self.api_hash = parser.get("pyrogram", "api_hash")
14351435
else:
1436-
raise AttributeError(
1437-
"No API Key found. "
1438-
"More info: https://docs.pyrogram.org/intro/setup#configuration"
1439-
)
1436+
raise AttributeError("No API Key found. More info: https://docs.pyrogram.org/intro/setup")
14401437

14411438
for option in ["app_version", "device_model", "system_version", "lang_code"]:
14421439
if getattr(self, option):

pyrogram/client/methods/chats/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
from .pin_chat_message import PinChatMessage
4141
from .promote_chat_member import PromoteChatMember
4242
from .restrict_chat_member import RestrictChatMember
43+
from .set_administrator_title import SetAdministratorTitle
4344
from .set_chat_description import SetChatDescription
4445
from .set_chat_permissions import SetChatPermissions
4546
from .set_chat_photo import SetChatPhoto
4647
from .set_chat_title import SetChatTitle
47-
from .set_custom_title import SetCustomTitle
4848
from .unarchive_chats import UnarchiveChats
4949
from .unban_chat_member import UnbanChatMember
5050
from .unpin_chat_message import UnpinChatMessage
@@ -84,6 +84,6 @@ class Chats(
8484
DeleteChannel,
8585
DeleteSupergroup,
8686
GetNearbyChats,
87-
SetCustomTitle
87+
SetAdministratorTitle
8888
):
8989
pass

pyrogram/client/methods/chats/create_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def create_channel(
3030
"""Create a new broadcast channel.
3131
3232
Parameters:
33-
title (``title``):
33+
title (``str``):
3434
The channel title.
3535
3636
description (``str``, *optional*):

pyrogram/client/methods/chats/create_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def create_group(
3636
If you want to create a new supergroup, use :meth:`~pyrogram.Client.create_supergroup` instead.
3737
3838
Parameters:
39-
title (``title``):
39+
title (``str``):
4040
The group title.
4141
4242
users (``int`` | ``str`` | List of ``int`` or ``str``):

pyrogram/client/methods/chats/create_supergroup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def create_supergroup(
3434
If you want to create a new basic group, use :meth:`~pyrogram.Client.create_group` instead.
3535
3636
Parameters:
37-
title (``title``):
37+
title (``str``):
3838
The supergroup title.
3939
4040
description (``str``, *optional*):

pyrogram/client/methods/chats/iter_dialogs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
from typing import Generator, Optional
2020

21-
import pyrogram
2221
from async_generator import async_generator, yield_
2322

23+
import pyrogram
2424
from ...ext import BaseClient
2525

2626

@@ -38,7 +38,7 @@ async def iter_dialogs(
3838
single call.
3939
4040
Parameters:
41-
limit (``str``, *optional*):
41+
limit (``int``, *optional*):
4242
Limits the number of dialogs to be retrieved.
4343
By default, no limit is applied and all dialogs are returned.
4444

pyrogram/client/methods/chats/join_chat.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,9 @@ async def join_chat(
5858
elif isinstance(chat.chats[0], types.Channel):
5959
return pyrogram.Chat._parse_channel_chat(self, chat.chats[0])
6060
else:
61-
resolved_peer = await self.send(
62-
functions.contacts.ResolveUsername(
63-
username=chat_id.lower().strip("@")
64-
)
65-
)
66-
67-
channel = types.InputPeerChannel(
68-
channel_id=resolved_peer.chats[0].id,
69-
access_hash=resolved_peer.chats[0].access_hash
70-
)
71-
7261
chat = await self.send(
7362
functions.channels.JoinChannel(
74-
channel=channel
63+
channel=await self.resolve_peer(chat_id)
7564
)
7665
)
7766

pyrogram/client/methods/chats/set_custom_title.py renamed to pyrogram/client/methods/chats/set_administrator_title.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@
2222
from ...ext import BaseClient
2323

2424

25-
class SetCustomTitle(BaseClient):
26-
async def set_custom_title(
25+
class SetAdministratorTitle(BaseClient):
26+
async def set_administrator_title(
2727
self,
2828
chat_id: Union[int, str],
2929
user_id: Union[int, str],
3030
title: str,
3131
) -> bool:
32-
"""Set a custom title to administrators or owners of a supergroup.
32+
"""Set a custom title (rank) to an administrator of a supergroup.
33+
34+
If you are an administrator of a supergroup (i.e. not the owner), you can only set the title of other
35+
administrators who have been promoted by you. If you are the owner, you can change every administrator's title.
3336
3437
Parameters:
3538
chat_id (``int`` | ``str``):
@@ -49,8 +52,7 @@ async def set_custom_title(
4952
Example:
5053
.. code-block:: python
5154
52-
# Set custom titles to owners or administrators of supergroups
53-
app.set_custom_title(chat_id, user_id, "Custom Title")
55+
app.set_administrator_title(chat_id, user_id, "ฅ^•ﻌ•^ฅ")
5456
"""
5557
chat_id = await self.resolve_peer(chat_id)
5658
user_id = await self.resolve_peer(user_id)

pyrogram/client/storage/file_storage.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ def open(self):
108108
self.create()
109109

110110
with self.conn:
111-
self.conn.execute("VACUUM")
111+
try: # Python 3.6.0 (exactly this version) is bugged and won't successfully execute the vacuum
112+
self.conn.execute("VACUUM")
113+
except sqlite3.OperationalError:
114+
pass
112115

113116
def destroy(self):
114117
os.remove(self.database)

0 commit comments

Comments
 (0)