File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919import pyrogram
2020from 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 ,
Original file line number Diff line number Diff line change 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+
1921import pyrogram
2022from 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 )
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments