Skip to content

Commit e42546a

Browse files
committed
Potentially breaking: improved plugin events
1 parent ee2f25a commit e42546a

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
This project mostly adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html);
77
however, insignificant breaking changes do not guarantee a major version bump, see the reasoning [here](https://github.com/kyb3r/modmail/issues/319). If you're a plugin developer, note the "BREAKING" section.
88

9+
# v3.9.0
10+
11+
### Breaking
12+
13+
- `on_thread_initiate` and `on_thread_ready` events now have `thread, creator, category, initial_message` as additional arguments.
14+
15+
### Internal
16+
17+
- `thread.reply` now returns (msg_to_user, msg_to_thread). Can be useful in plugins.
918

1019
# v3.8.6
1120

bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.8.6"
1+
__version__ = "3.9.0"
22

33

44
import asyncio

core/thread.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def cancelled(self, flag: bool):
105105

106106
async def setup(self, *, creator=None, category=None, initial_message=None):
107107
"""Create the thread channel and other io related initialisation tasks"""
108-
self.bot.dispatch("thread_initiate", self)
108+
self.bot.dispatch("thread_initiate", self, creator, category, initial_message)
109109
recipient = self.recipient
110110

111111
# in case it creates a channel outside of category
@@ -258,7 +258,7 @@ async def activate_auto_triggers():
258258
activate_auto_triggers(),
259259
send_persistent_notes(),
260260
)
261-
self.bot.dispatch("thread_ready", self)
261+
self.bot.dispatch("thread_ready", self, creator, category, initial_message)
262262

263263
def _format_info_embed(self, user, log_url, log_count, color):
264264
"""Get information about a member of a server
@@ -753,7 +753,7 @@ async def reply(
753753
tasks = []
754754

755755
try:
756-
await self.send(
756+
user_msg = await self.send(
757757
message,
758758
destination=self.recipient,
759759
from_mod=True,
@@ -809,6 +809,7 @@ async def reply(
809809

810810
await asyncio.gather(*tasks)
811811
self.bot.dispatch("thread_reply", self, True, message, anonymous, plain)
812+
return (user_msg, msg) # sent_to_user, sent_to_thread_channel
812813

813814
async def send(
814815
self,

0 commit comments

Comments
 (0)