Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cd1bb07
(init): refactoring
SpEcHiDe Apr 8, 2025
65f13c8
minor fixes
SpEcHiDe Apr 8, 2025
a840505
Add delete_sticker_set
SpEcHiDe Apr 8, 2025
e609df3
fix examples
SpEcHiDe Apr 8, 2025
f280843
Rename get_custom_emoji_stickers
SpEcHiDe Apr 9, 2025
1087b78
Revert 65f13c8
SpEcHiDe Apr 9, 2025
4faf9c4
steal https://github.com/LonamiWebs/Telethon/blob/3921914a96101fba990…
SpEcHiDe Apr 9, 2025
4c711d2
Add StickerFormat
SpEcHiDe Apr 9, 2025
c5a8978
Rename get_custom_emoji_stickers
SpEcHiDe Apr 9, 2025
08578c0
Add incomplete upload_sticker_file
SpEcHiDe Apr 9, 2025
b9c1b74
docs
SpEcHiDe Apr 9, 2025
124db84
change return of upload_sticker_file
SpEcHiDe Apr 10, 2025
83a77f8
Merge branch 'dev' into stickers
SpEcHiDe Apr 13, 2025
aafa9c3
fix imports
SpEcHiDe Apr 28, 2025
ca8bf4b
Add set_sticker_set_title
SpEcHiDe Apr 29, 2025
213590e
Add delete_sticker_from_set
SpEcHiDe Apr 29, 2025
1496c6d
Merge branch 'dev' into stickers
SpEcHiDe May 8, 2025
a3d8627
Add set_sticker_position_in_set
SpEcHiDe May 8, 2025
3416e6d
Add get_suggested_sticker_set_name
SpEcHiDe May 8, 2025
301ffb8
fixes
SpEcHiDe May 8, 2025
4ab741b
Merge branch 'dev' into stickers
SpEcHiDe May 9, 2025
25fa137
Merge branch 'dev' into stickers
SpEcHiDe Jul 10, 2025
79e74a3
Add 1 unknown_error
SpEcHiDe Jul 25, 2025
3c39ba9
Merge branch 'dev' into stickers
SpEcHiDe Jul 28, 2025
78509c5
Merge branch 'dev' into stickers
SpEcHiDe Aug 10, 2025
4b9a7f4
Merge branch 'dev' into stickers
SpEcHiDe Aug 13, 2025
21863fc
Merge branch 'dev' into stickers
SpEcHiDe Aug 20, 2025
e79dfd6
Merge branch 'dev' into stickers
SpEcHiDe Sep 13, 2025
e531c86
Merge branch 'dev' into stickers
SpEcHiDe Sep 18, 2025
b68f531
Merge branch 'dev' into stickers
SpEcHiDe Feb 15, 2026
fd7fb2f
Merge branch 'dev' into stickers
SpEcHiDe Mar 1, 2026
6641700
Merge branch 'dev' into stickers
SpEcHiDe Mar 3, 2026
8a398b8
StickerType
SpEcHiDe Mar 3, 2026
3df139a
Merge branch 'dev' into stickers
SpEcHiDe Mar 7, 2026
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
9 changes: 9 additions & 0 deletions compiler/docs/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,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 @@ -606,6 +612,7 @@ def get_title_list(s: str) -> list:
Animation
Audio
Document
File
Story
Video
VideoNote
Expand Down Expand Up @@ -1028,6 +1035,8 @@ def get_title_list(s: str) -> list:
ProfileColor
AccentColor
SentCodeType
StickerFormat
StickerType
NextCodeType
UserStatus
""",
Expand Down
44 changes: 24 additions & 20 deletions pyrogram/enums/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,35 @@
from .parse_mode import ParseMode
from .poll_type import PollType
from .sent_code_type import SentCodeType
from .sticker_format import StickerFormat
from .sticker_type import StickerType
from .user_status import UserStatus
from .client_platform import ClientPlatform
from .accent_color import AccentColor
from .profile_color import ProfileColor
from .button_style import ButtonStyle

__all__ = [
'ChatAction',
'ChatEventAction',
'ChatJoinType',
'ChatMemberStatus',
'ChatMembersFilter',
'ChatType',
'MessageEntityType',
'MessageMediaType',
'MessageOriginType',
'MessageServiceType',
'MessagesFilter',
'NextCodeType',
'ParseMode',
'PollType',
'SentCodeType',
'UserStatus',
'ClientPlatform',
'AccentColor',
'ProfileColor',
'ButtonStyle',
"ChatAction",
"ChatEventAction",
"ChatJoinType",
"ChatMemberStatus",
"ChatMembersFilter",
"ChatType",
"MessageEntityType",
"MessageMediaType",
"MessageOriginType",
"MessageServiceType",
"MessagesFilter",
"NextCodeType",
"ParseMode",
"PollType",
"SentCodeType",
"StickerFormat",
"StickerType",
"UserStatus",
"ClientPlatform",
"AccentColor",
"ProfileColor",
"ButtonStyle",
]
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"
34 changes: 34 additions & 0 deletions pyrogram/enums/sticker_type.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 StickerType(AutoName):
"""Type of sticker."""

CUSTOM_EMOJI = auto()
"The sticker is a custom emoji to be used inside message text and caption"

MASK = auto()
"The sticker is a mask in WEBP format to be placed on photos or videos"

REGULAR = auto()
"The sticker is a regular sticker"
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
Loading