Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f34212c
(init): refactoring
SpEcHiDe Apr 8, 2025
ce75fe5
minor fixes
SpEcHiDe Apr 8, 2025
693e7e7
Add delete_sticker_set
SpEcHiDe Apr 8, 2025
9892a9b
fix examples
SpEcHiDe Apr 8, 2025
634c78d
Rename get_custom_emoji_stickers
SpEcHiDe Apr 9, 2025
d0f0b5f
Revert ce75fe5
SpEcHiDe Apr 9, 2025
e3059f5
steal https://github.com/LonamiWebs/Telethon/blob/3921914a96101fba990…
SpEcHiDe Apr 9, 2025
6fb7b46
Add StickerFormat
SpEcHiDe Apr 9, 2025
8687b8b
Rename get_custom_emoji_stickers
SpEcHiDe Apr 9, 2025
56a6a83
Add incomplete upload_sticker_file
SpEcHiDe Apr 9, 2025
98747e2
docs
SpEcHiDe Apr 9, 2025
daa5763
change return of upload_sticker_file
SpEcHiDe Apr 10, 2025
10b13ad
Merge branch 'dev' into stickers
SpEcHiDe Apr 13, 2025
bfe3fd0
fix imports
SpEcHiDe Apr 28, 2025
d42a141
Add set_sticker_set_title
SpEcHiDe Apr 29, 2025
d656101
Add delete_sticker_from_set
SpEcHiDe Apr 29, 2025
0c58bca
Merge branch 'dev' into stickers
SpEcHiDe May 8, 2025
01be03d
Add set_sticker_position_in_set
SpEcHiDe May 8, 2025
1bfadca
Add get_suggested_sticker_set_name
SpEcHiDe May 8, 2025
cba2a6e
fixes
SpEcHiDe May 8, 2025
db88749
Merge branch 'dev' into stickers
SpEcHiDe May 9, 2025
ea9d8d8
Merge branch 'dev' into stickers
SpEcHiDe Jul 10, 2025
569ad22
Add 1 unknown_error
SpEcHiDe Jul 25, 2025
0ecd68d
Merge branch 'dev' into stickers
SpEcHiDe Jul 28, 2025
ea2f73d
Merge branch 'dev' into stickers
SpEcHiDe Aug 10, 2025
45920d7
Merge branch 'dev' into stickers
SpEcHiDe Aug 13, 2025
4b082dc
Merge branch 'dev' into stickers
SpEcHiDe Aug 20, 2025
0099cef
Merge branch 'dev' into stickers
SpEcHiDe Sep 13, 2025
73ea404
Merge branch 'dev' into stickers
SpEcHiDe Sep 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions compiler/docs/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,16 @@ def get_title_list(s: str) -> list:
""",
stickers="""
Stickers
get_suggested_sticker_set_name
send_sticker
get_custom_emoji_stickers
get_message_effects
upload_sticker_file
set_sticker_position_in_set
set_sticker_set_title
get_stickers
delete_sticker_from_set
delete_sticker_set
""",
stories="""
Stories
Expand Down Expand Up @@ -604,6 +610,7 @@ def get_title_list(s: str) -> list:
Animation
Audio
Document
File
Story
Video
VideoNote
Expand Down Expand Up @@ -1022,6 +1029,7 @@ def get_title_list(s: str) -> list:
ProfileColor
AccentColor
SentCodeType
StickerFormat
NextCodeType
UserStatus
""",
Expand Down
2 changes: 2 additions & 0 deletions pyrogram/enums/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from .parse_mode import ParseMode
from .poll_type import PollType
from .sent_code_type import SentCodeType
from .sticker_format import StickerFormat
from .user_status import UserStatus
from .client_platform import ClientPlatform
from .accent_color import AccentColor
Expand All @@ -52,6 +53,7 @@
'ParseMode',
'PollType',
'SentCodeType',
'StickerFormat',
'UserStatus',
'ClientPlatform',
'AccentColor',
Expand Down
34 changes: 34 additions & 0 deletions pyrogram/enums/sticker_format.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# 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 enum import auto

from .auto_name import AutoName


class StickerFormat(AutoName):
"""Format of the sticker."""

STATIC = auto()
"static"

ANIMATED = auto()
"animated"

VIDEO = auto()
"video"
2 changes: 0 additions & 2 deletions pyrogram/methods/messages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from .forward_messages import ForwardMessages
from .get_chat_history import GetChatHistory
from .get_chat_history_count import GetChatHistoryCount
from .get_custom_emoji_stickers import GetCustomEmojiStickers
from .get_discussion_message import GetDiscussionMessage
from .get_discussion_replies import GetDiscussionReplies
from .get_discussion_replies_count import GetDiscussionRepliesCount
Expand Down Expand Up @@ -96,7 +95,6 @@ class Messages(
ForwardMessages,
GetChatHistory,
GetChatHistoryCount,
GetCustomEmojiStickers,
GetDiscussionMessage,
GetDiscussionReplies,
GetDiscussionRepliesCount,
Expand Down
14 changes: 14 additions & 0 deletions pyrogram/methods/stickers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,26 @@
# 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 .delete_sticker_from_set import DeleteStickerFromSet
from .delete_sticker_set import DeleteStickerSet
from .get_custom_emoji_stickers import GetCustomEmojiStickers
from .get_message_effects import GetMessageEffects
from .get_stickers import GetStickers
from .get_suggested_sticker_set_name import GetSuggestedStickerSetName
from .set_sticker_position_in_set import SetStickerPositionInSet
from .set_sticker_set_title import SetStickerSetTitle
from .upload_sticker_file import UploadStickerFile


class Stickers(
DeleteStickerFromSet,
DeleteStickerSet,
GetCustomEmojiStickers,
GetMessageEffects,
GetStickers,
GetSuggestedStickerSetName,
SetStickerPositionInSet,
SetStickerSetTitle,
UploadStickerFile,
):
pass
55 changes: 55 additions & 0 deletions pyrogram/methods/stickers/delete_sticker_from_set.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.

import logging

import pyrogram
from pyrogram import raw, types, utils

log = logging.getLogger(__name__)


class DeleteStickerFromSet:
async def delete_sticker_from_set(
self: "pyrogram.Client",
sticker: str
) -> "types.StickerSet":
"""Use this method to delete a sticker from a set created by the current user.

.. include:: /_includes/usable-by/users-bots.rst

Parameters:
sticker (``str``):
File identifier of the sticker.

Returns:
:obj:`~pyrogram.types.StickerSet`: The updated StickerSet on success.

Raises:
RPCError: In case of Telegram RPCError.

"""
stickerdocument = utils.get_input_media_from_file_id(sticker)
stickerid = stickerdocument.id
r = await self.invoke(
raw.functions.stickers.RemoveStickerFromSet(
sticker=stickerid
)
)
# TODO:
return r
54 changes: 54 additions & 0 deletions pyrogram/methods/stickers/delete_sticker_set.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.

import logging

import pyrogram
from pyrogram import raw

log = logging.getLogger(__name__)


class DeleteStickerSet:
async def delete_sticker_set(
self: "pyrogram.Client",
name: str
) -> bool:
"""Use this method to delete a sticker set that was created by the current user.

.. include:: /_includes/usable-by/users-bots.rst

Parameters:
name (``str``):
Sticker set name.

Returns:
``bool``: True on success.

Raises:
RPCError: In case of Telegram RPCError.

"""
r = await self.invoke(
raw.functions.stickers.DeleteStickerSet(
stickerset=raw.types.InputStickerSetShortName(
short_name=name
)
)
)
return r
52 changes: 52 additions & 0 deletions pyrogram/methods/stickers/get_suggested_sticker_set_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.

import logging

import pyrogram
from pyrogram import raw

log = logging.getLogger(__name__)


class GetSuggestedStickerSetName:
async def get_suggested_sticker_set_name(
self: "pyrogram.Client",
title: str
) -> str:
"""Use this method to return a suggested name for a new sticker set with a given title.

.. include:: /_includes/usable-by/users.rst

Parameters:
title (``str``):
Sticker set title; 1-64 characters.

Returns:
``str``: the suggested name on success.

Raises:
RPCError: In case of Telegram RPCError.

"""
r = await self.invoke(
raw.functions.stickers.SuggestShortName(
title=title
)
)
return r.short_name
60 changes: 60 additions & 0 deletions pyrogram/methods/stickers/set_sticker_position_in_set.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.

import logging

import pyrogram
from pyrogram import raw, utils

log = logging.getLogger(__name__)


class SetStickerPositionInSet:
async def set_sticker_position_in_set(
self: "pyrogram.Client",
sticker: str,
position: int
) -> bool:
"""Use this method to move a sticker in a set created by the bot to a specific position.

.. include:: /_includes/usable-by/users-bots.rst

Parameters:
sticker (``str``):
File identifier of the sticker.

position (``str``):
New sticker position in the set, zero-based.

Returns:
``bool``: True on success.

Raises:
RPCError: In case of Telegram RPCError.

"""
stickerdocument = utils.get_input_media_from_file_id(sticker)
stickerid = stickerdocument.id
r = await self.invoke(
raw.functions.stickers.ChangeStickerPosition(
sticker=stickerid,
position=position
)
)
# TODO
return r
Loading