mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Merge changes
This commit is contained in:
parent
405528c74b
commit
68f151bad5
@ -18,15 +18,14 @@
|
||||
|
||||
import pyrogram
|
||||
from pyrogram import raw, types
|
||||
from pyrogram.scaffold import Scaffold
|
||||
|
||||
|
||||
class DeleteBotCommands(Scaffold):
|
||||
class DeleteBotCommands:
|
||||
async def delete_bot_commands(
|
||||
self: "pyrogram.Client",
|
||||
scope: "types.BotCommandScope" = types.BotCommandScopeDefault(),
|
||||
language_code: str = "",
|
||||
):
|
||||
) -> bool:
|
||||
"""Delete the list of the bot's commands for the given scope and user language.
|
||||
After deletion, higher level commands will be shown to affected users.
|
||||
|
||||
@ -53,7 +52,7 @@ class DeleteBotCommands(Scaffold):
|
||||
app.delete_bot_commands()
|
||||
"""
|
||||
|
||||
return await self.send(
|
||||
return await self.invoke(
|
||||
raw.functions.bots.ResetBotCommands(
|
||||
scope=await scope.write(self),
|
||||
lang_code=language_code,
|
||||
|
@ -16,17 +16,18 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import List
|
||||
|
||||
import pyrogram
|
||||
from pyrogram import raw, types
|
||||
from pyrogram.scaffold import Scaffold
|
||||
|
||||
|
||||
class GetBotCommands(Scaffold):
|
||||
class GetBotCommands:
|
||||
async def get_bot_commands(
|
||||
self: "pyrogram.Client",
|
||||
scope: "types.BotCommandScope" = types.BotCommandScopeDefault(),
|
||||
language_code: str = "",
|
||||
):
|
||||
) -> List["types.BotCommand"]:
|
||||
"""Get the current list of the bot's commands for the given scope and user language.
|
||||
Returns Array of BotCommand on success. If commands aren't set, an empty list is returned.
|
||||
|
||||
@ -54,9 +55,11 @@ class GetBotCommands(Scaffold):
|
||||
print(commands)
|
||||
"""
|
||||
|
||||
return await self.send(
|
||||
r = await self.invoke(
|
||||
raw.functions.bots.GetBotCommands(
|
||||
scope=await scope.write(self),
|
||||
lang_code=language_code,
|
||||
)
|
||||
)
|
||||
|
||||
return types.List(types.BotCommand.read(c) for c in r)
|
||||
|
@ -29,7 +29,7 @@ class SetBotCommands:
|
||||
commands: List["types.BotCommand"],
|
||||
scope: "types.BotCommandScope" = types.BotCommandScopeDefault(),
|
||||
language_code: str = "",
|
||||
):
|
||||
) -> bool:
|
||||
"""Set the list of the bot's commands.
|
||||
The commands passed will overwrite any command set previously.
|
||||
This method can be used by the own bot only.
|
||||
|
Loading…
Reference in New Issue
Block a user