Skip to content

Commit

Permalink
Fix editing notes, resolve #3094
Browse files Browse the repository at this point in the history
  • Loading branch information
fourjr committed Nov 21, 2021
1 parent 0de26a3 commit 8d76a32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
- Large server sizes results in Guild.name == None. ([GH #3088](https://github.com/kyb3r/modmail/issues/3088))
- Attachments did not work on plain replies. ([GH #3102](https://github.com/kyb3r/modmail/issues/3102))
- Support LOTTIE stickers. ([GH #3119](https://github.com/kyb3r/modmail/issues/3119))
- Editing notes now work. ([GH #3094](https://github.com/kyb3r/modmail/issues/3094))

### Internal

Expand Down
13 changes: 7 additions & 6 deletions core/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,13 +677,14 @@ async def edit_message(self, message_id: typing.Optional[int], message: str) ->
embed1.description = message

tasks = [self.bot.api.edit_message(message1.id, message), message1.edit(embed=embed1)]
if message2 is not [None]:
for m2 in message2:
embed2 = m2.embeds[0]
embed2.description = message
tasks += [m2.edit(embed=embed2)]
elif message1.embeds[0].author.name.startswith("Persistent Note"):
if message1.embeds[0].author.name.startswith("Persistent Note"):
tasks += [self.bot.api.edit_note(message1.id, message)]
else:
for m2 in message2:
if m2 is not None:
embed2 = m2.embeds[0]
embed2.description = message
tasks += [m2.edit(embed=embed2)]

await asyncio.gather(*tasks)

Expand Down

0 comments on commit 8d76a32

Please sign in to comment.