Skip to content

Commit 68f151b

Browse files
committed
Merge changes
1 parent 405528c commit 68f151b

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

pyrogram/methods/bots/delete_bot_commands.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818

1919
import pyrogram
2020
from pyrogram import raw, types
21-
from pyrogram.scaffold import Scaffold
2221

2322

24-
class DeleteBotCommands(Scaffold):
23+
class DeleteBotCommands:
2524
async def delete_bot_commands(
2625
self: "pyrogram.Client",
2726
scope: "types.BotCommandScope" = types.BotCommandScopeDefault(),
2827
language_code: str = "",
29-
):
28+
) -> bool:
3029
"""Delete the list of the bot's commands for the given scope and user language.
3130
After deletion, higher level commands will be shown to affected users.
3231
@@ -53,7 +52,7 @@ async def delete_bot_commands(
5352
app.delete_bot_commands()
5453
"""
5554

56-
return await self.send(
55+
return await self.invoke(
5756
raw.functions.bots.ResetBotCommands(
5857
scope=await scope.write(self),
5958
lang_code=language_code,

pyrogram/methods/bots/get_bot_commands.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from typing import List
20+
1921
import pyrogram
2022
from pyrogram import raw, types
21-
from pyrogram.scaffold import Scaffold
2223

2324

24-
class GetBotCommands(Scaffold):
25+
class GetBotCommands:
2526
async def get_bot_commands(
2627
self: "pyrogram.Client",
2728
scope: "types.BotCommandScope" = types.BotCommandScopeDefault(),
2829
language_code: str = "",
29-
):
30+
) -> List["types.BotCommand"]:
3031
"""Get the current list of the bot's commands for the given scope and user language.
3132
Returns Array of BotCommand on success. If commands aren't set, an empty list is returned.
3233
@@ -54,9 +55,11 @@ async def get_bot_commands(
5455
print(commands)
5556
"""
5657

57-
return await self.send(
58+
r = await self.invoke(
5859
raw.functions.bots.GetBotCommands(
5960
scope=await scope.write(self),
6061
lang_code=language_code,
6162
)
6263
)
64+
65+
return types.List(types.BotCommand.read(c) for c in r)

pyrogram/methods/bots/set_bot_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async def set_bot_commands(
2929
commands: List["types.BotCommand"],
3030
scope: "types.BotCommandScope" = types.BotCommandScopeDefault(),
3131
language_code: str = "",
32-
):
32+
) -> bool:
3333
"""Set the list of the bot's commands.
3434
The commands passed will overwrite any command set previously.
3535
This method can be used by the own bot only.

0 commit comments

Comments
 (0)