mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-24 18:15:02 +00:00
prettier and rmv debugging
This commit is contained in:
parent
3a36b3e5ef
commit
c9627e9219
3 changed files with 7 additions and 11 deletions
|
@ -23,10 +23,10 @@ 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);
|
||||||
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,
|
||||||
);
|
);
|
||||||
if (sourceMessage) {
|
if (sourceMessage) {
|
||||||
const savedMessage = pluginData.state.savedMessages.msgToSavedMessage(sourceMessage);
|
const savedMessage = pluginData.state.savedMessages.msgToSavedMessage(sourceMessage);
|
||||||
|
@ -86,7 +86,7 @@ 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,
|
||||||
|
|
|
@ -26,18 +26,16 @@ export const ThreadArchiveTrigger = automodTrigger<ThreadArchiveResult>()({
|
||||||
}
|
}
|
||||||
|
|
||||||
const thread = context.threadChange.archived;
|
const thread = context.threadChange.archived;
|
||||||
console.log("matching thread_archive");
|
|
||||||
|
|
||||||
if (typeof triggerConfig.locked === "boolean" && thread.locked !== triggerConfig.locked) {
|
if (typeof triggerConfig.locked === "boolean" && thread.locked !== triggerConfig.locked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("locked pass");
|
|
||||||
|
|
||||||
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,
|
||||||
|
|
|
@ -25,14 +25,12 @@ export const ThreadUnarchiveTrigger = automodTrigger<ThreadUnarchiveResult>()({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triggerConfig.locked && !context.threadChange.locked) {
|
const thread = context.threadChange.unarchived;
|
||||||
return;
|
|
||||||
} else if (triggerConfig.locked === false && !context.threadChange.unlocked) {
|
if (typeof triggerConfig.locked === "boolean" && thread.locked !== triggerConfig.locked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const thread = context.threadChange.unarchived;
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue