Skip to content

Commit

Permalink
Fixed #3315: gif stickers are now rendered correctly, allow bare stic…
Browse files Browse the repository at this point in the history
…ker reply/note
  • Loading branch information
Taaku18 committed Nov 21, 2023
1 parent 048a9d2 commit 3af8dfa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
Drops support for Python 3.9. Python 3.10 and Python 3.11 are now the only supported versions.

### Fixed
- GIF stickers causes the bot to crash.
- `?alias make/create` as aliases to `?alias add`. This improves continuity between the bot and its command structure. ([PR #3195](https://github.com/kyb3r/modmail/pull/3195))
- Loading the blocked list with the `?blocked` command takes a long time when the list is large. ([PR #3242](https://github.com/kyb3r/modmail/pull/3242))
- Reply not being forwarded from DM. (PR [#3239](https://github.com/modmail-dev/modmail/pull/3239))
Expand All @@ -33,6 +34,7 @@ Drops support for Python 3.9. Python 3.10 and Python 3.11 are now the only suppo
### Changed
- Repo moved to https://github.com/modmail-dev/modmail.
- Channel name no longer shows `-0` if the user has migrated to the new username system.
- `?note` and `?reply` now allows you to send a sticker without any message.
- Guild icons in embed footers and author urls now have a fixed size of 128. ([PR #3261](https://github.com/modmail-dev/modmail/pull/3261))
- Discord.py internal logging is now enabled by default. ([PR #3216](https://github.com/modmail-dev/Modmail/pull/3216))
- The confirm-thread-creation dialog now uses buttons instead of reactions. ([PR #3273](https://github.com/modmail-dev/Modmail/pull/3273))
Expand Down
14 changes: 10 additions & 4 deletions core/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ async def edit_dm_message(self, message: discord.Message, content: str) -> None:
async def note(
self, message: discord.Message, persistent=False, thread_creation=False
) -> discord.Message:
if not message.content and not message.attachments:
if not message.content and not message.attachments and not message.stickers:
raise MissingRequiredArgument(DummyParam("msg"))

msg = await self.send(
Expand All @@ -821,7 +821,7 @@ async def reply(
self, message: discord.Message, anonymous: bool = False, plain: bool = False
) -> typing.Tuple[typing.List[discord.Message], discord.Message]:
"""Returns List[user_dm_msg] and thread_channel_msg"""
if not message.content and not message.attachments:
if not message.content and not message.attachments and not message.stickers:
raise MissingRequiredArgument(DummyParam("msg"))
if not any(g.get_member(self.id) for g in self.bot.guilds):
return await message.channel.send(
Expand Down Expand Up @@ -1020,8 +1020,14 @@ def lottie_to_png(data):
return stream.read()

for i in message.stickers:
if i.format in (discord.StickerFormatType.png, discord.StickerFormatType.apng):
images.append((i.url, i.name, True))
if i.format in (
discord.StickerFormatType.png,
discord.StickerFormatType.apng,
discord.StickerFormatType.gif,
):
images.append(
(f"https://media.discordapp.net/stickers/{i.id}.{i.format.file_extension}", i.name, True)
)
elif i.format == discord.StickerFormatType.lottie:
# save the json lottie representation
try:
Expand Down

0 comments on commit 3af8dfa

Please sign in to comment.