mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 17:45:03 +00:00
fixes
This commit is contained in:
parent
e52db4dcd2
commit
d23e430711
3 changed files with 12 additions and 8 deletions
|
@ -14,6 +14,7 @@ export const RunAutomodOnThreadCreate = typedGuildEventListener<AutomodPluginTyp
|
||||||
|
|
||||||
const context: AutomodContext = {
|
const context: AutomodContext = {
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
|
thread,
|
||||||
threadChange: {
|
threadChange: {
|
||||||
created: thread,
|
created: thread,
|
||||||
},
|
},
|
||||||
|
@ -23,7 +24,7 @@ export const RunAutomodOnThreadCreate = typedGuildEventListener<AutomodPluginTyp
|
||||||
|
|
||||||
// This is a hack to make this trigger compatible with the reply action
|
// This is a hack to make this trigger compatible with the reply action
|
||||||
const sourceChannel = thread.parent ?? pluginData.client.channels.cache.find((c) => c.id === thread.parentId);
|
const sourceChannel = thread.parent ?? pluginData.client.channels.cache.find((c) => c.id === thread.parentId);
|
||||||
messageBlock: if (sourceChannel?.isText()) {
|
if (sourceChannel?.isText()) {
|
||||||
const sourceMessage = sourceChannel.messages.cache.find(
|
const sourceMessage = sourceChannel.messages.cache.find(
|
||||||
(m) => m.thread?.id === thread.id || m.reference?.channelId === thread.id,
|
(m) => m.thread?.id === thread.id || m.reference?.channelId === thread.id,
|
||||||
);
|
);
|
||||||
|
@ -56,6 +57,7 @@ export const RunAutomodOnThreadDelete = typedGuildEventListener<AutomodPluginTyp
|
||||||
|
|
||||||
const context: AutomodContext = {
|
const context: AutomodContext = {
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
|
thread,
|
||||||
threadChange: {
|
threadChange: {
|
||||||
deleted: thread,
|
deleted: thread,
|
||||||
},
|
},
|
||||||
|
@ -84,10 +86,11 @@ export const RunAutomodOnThreadUpdate = typedGuildEventListener<AutomodPluginTyp
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.keys(changes).length === 0) return;
|
if (Object.keys(changes).length === 0) return;
|
||||||
|
console.log("got thread changes!");
|
||||||
const context: AutomodContext = {
|
const context: AutomodContext = {
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
threadChange: changes,
|
threadChange: changes,
|
||||||
|
thread,
|
||||||
user,
|
user,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,19 +25,19 @@ export const ThreadArchiveTrigger = automodTrigger<ThreadArchiveResult>()({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triggerConfig.locked && !context.threadChange.locked) {
|
const thread = context.threadChange.archived;
|
||||||
return;
|
console.log("matching thread_archive");
|
||||||
} else if (triggerConfig.locked === false && !context.threadChange.unlocked) {
|
|
||||||
|
if (typeof triggerConfig.locked === "boolean" && thread.locked !== triggerConfig.locked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log("locked pass");
|
||||||
const thread = context.threadChange.archived;
|
|
||||||
|
|
||||||
if (triggerConfig.parent) {
|
if (triggerConfig.parent) {
|
||||||
const parentIds = Array.isArray(triggerConfig.parent) ? triggerConfig.parent : [triggerConfig.parent];
|
const parentIds = Array.isArray(triggerConfig.parent) ? triggerConfig.parent : [triggerConfig.parent];
|
||||||
if (thread.parentId && !parentIds.includes(thread.parentId)) return;
|
if (thread.parentId && !parentIds.includes(thread.parentId)) return;
|
||||||
}
|
}
|
||||||
|
console.log("parent pass");
|
||||||
return {
|
return {
|
||||||
extra: {
|
extra: {
|
||||||
matchedThreadId: thread.id,
|
matchedThreadId: thread.id,
|
||||||
|
|
|
@ -117,6 +117,7 @@ export interface AutomodContext {
|
||||||
user?: User;
|
user?: User;
|
||||||
message?: SavedMessage;
|
message?: SavedMessage;
|
||||||
member?: GuildMember;
|
member?: GuildMember;
|
||||||
|
thread?: ThreadChannel;
|
||||||
partialMember?: GuildMember | PartialGuildMember;
|
partialMember?: GuildMember | PartialGuildMember;
|
||||||
joined?: boolean;
|
joined?: boolean;
|
||||||
rolesChanged?: {
|
rolesChanged?: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue