mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 17:45:03 +00:00
Thread events - attempt to pass message object in context (#3)
* initial * rmv console log * Update backend/src/plugins/Automod/events/runAutomodOnThreadEvents.ts Co-authored-by: Almeida <almeidx@pm.me>
This commit is contained in:
parent
8052a6f2d8
commit
cf1ffbe71e
1 changed files with 14 additions and 0 deletions
|
@ -19,6 +19,20 @@ export const RunAutomodOnThreadCreate = typedGuildEventListener<AutomodPluginTyp
|
|||
channel: thread,
|
||||
};
|
||||
|
||||
const sourceChannel = pluginData.client.channels.cache.find((c) => c.id === thread.parentId);
|
||||
if (sourceChannel?.isText()) {
|
||||
const sourceMessage = sourceChannel.messages.cache.find(
|
||||
(m) => m.thread?.id === thread.id || m.reference?.channelId === thread.id,
|
||||
);
|
||||
if (sourceMessage) {
|
||||
const message = await pluginData.state.savedMessages.find(sourceMessage.id);
|
||||
if (message) {
|
||||
message.channel_id = thread.id;
|
||||
context.message = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginData.state.queue.add(() => {
|
||||
pluginData.state.recentActions.push({
|
||||
type: RecentActionType.ThreadCreate,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue